1. 仅是参考,比较危险,出问题自负
root@CentOS-7:~# fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 31.3 GB, 31268536320 bytes, 61071360 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
Disk label type: dos
Disk identifier: 0x240d1f0f
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 32831 5119999 ... 83 Linux
看到/dev/mmcblk0p1 起始扇区 32831
cat > fdisk.cmd <<-EOF
d
n
p
1
32831
w
EOF
echo "fdisk.cmd done!"
echo "disk partition..."
fdisk /dev/mmcblk1 < fdisk.cmd
mount -o remount,rw /
resize2fs /dev/mmcblk0p1
df -h
2. 安全一点的办法
centos
#yum update
yum install cloud-utils-growpart -y
debian
# apt-get update
apt-get install cloud-guest-utils xfsprogs -y
扩展mmcblk0设备的第1分区
growpart /dev/mmcblk0 1
resize2fs /dev/mmcblk0p1
网友评论