1. 香橙派sd卡扩容
最近购买了香橙派zero,发现烧写完程序后,sd卡的容量只有2G不到,可是我用的sd卡是16G,经过网上查阅资料,和测试,并把扩容过程记录下来。
2. orangepizero扩容
- 环境烧写的是orangepizero的ubuntu系统
- sd卡为16G
以下为扩容记录:
orangepi@orangepizero:~$ sudo fdisk /dev/mmcblk0
[sudo] password for orangepi:
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p #查看当前容量
Disk /dev/mmcblk0: 14.4 GiB, 15502147584 bytes, 30277632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdf942937
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 40960 143359 102400 50M c W95 FAT32 (LBA)
/dev/mmcblk0p2 143360 2416639 2273280 1.1G 83 Linux
Command (m for help): d #删除
Partition number (1,2, default 2): 2 #/dev/mmcblk0p2
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p #创建
Partition number (2-4, default 2): 2 #/dev/mmcblk0p2
First sector (2048-30277631, default 2048): 143360 #起始扇区 参考上面的start,是多少填多少
Last sector, +sectors or +size{K,M,G,T,P} (143360-30277631, default 30277631): 30277631 #结尾扇区,使用它给的default
Created a new partition 2 of type 'Linux' and of size 14.4 GiB.
Command (m for help): w #写入
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
orangepi@orangepizero:~$ sudo reboot -f #重启
Rebooting.
orangepi@orangepizero:~$ sudo resize2fs /dev/mmcblk0p2 #释放空间,输入后需要等待一会儿
[sudo] password for orangepi:
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p2 is now 3766784 (4k) blocks long.
orangepi@orangepizero:~$ df -lh #查看/dev/mmcblk0p2,果然扩容了
Filesystem Size Used Avail Use% Mounted on
udev 116M 0 116M 0% /dev
tmpfs 24M 2.5M 22M 11% /run
/dev/mmcblk0p2 15G 774M 13G 6% /
tmpfs 120M 0 120M 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 120M 0 120M 0% /sys/fs/cgroup
/dev/mmcblk0p1 50M 18M 33M 35% /boot
tmpfs 24M 0 24M 0% /run/user/1000
orangepi@orangepizero:~$