最近在搞香橙派的开发板的时候,发现烧录进去的系统的磁盘空间很小,所以我们要开发的时候往往要扩展磁盘空间,所以想记录下来以后开发板的扩展也可以参考。具体过程如下:
root@orangepi:/home/orangepi# fdisk /dev/mmcblk0
Command (m for help): d
Partition number (1-4): 2
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (2048-31481855, default 2048): 124928
, +sectors or +size{K,M,G} (124928-31481855, default 31481855): 31481855
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 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)
Syncing disks.
到了此步之后千万记得要关机重启。
然后继续输入命令:
ororangepi@orangepi:~$ sudo resize2fs /dev/mmcblk0p2
[sudo] password for orangepi:
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 3873920 blocks long.
orangepi@orangepi:~$ df -h
df: ‘/media/orangepi/F875-EAED’: Permission denied
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 2.8G 12G 20% /
devtmpfs 168M 4.0K 168M 1% /dev
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 50M 676K 49M 2% /run
none 5.0M 0 5.0M 0% /run/lock
none 248M 72K 248M 1% /run/shm
none 100M 24K 100M 1% /run/user
最后看到size那里变大了表示扩容成功。