之前通过df -h检查一台云服务器的时候发现,磁盘只有10G:
Filesystem Size Used Avail Use% Mounted on
/dev/vda2 9.3G 6.1G 2.8G 69% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 477M 184M 268M 41% /boot
但是实际上我分配了50G,并且从fdisk里也能看到是50G
Disk /dev/vda: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00050b1f
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 104025 51915576 83 Linux
一直很奇怪剩下的空间在哪里,查了很久之后,终于在这篇帖子里找到了答案:
resize2fs /dev/vda2(改为目标磁盘位置)
执行上述代码后,分区大小成功扩容到50G了。
resize2fs 1.41.12 (17-May-)
Filesystem at /dev/vda2 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 4
Performing an on-line resize of /dev/vda2 to 12978894 (4k) blocks.
The filesystem on /dev/vda2 is now 12978894 blocks long.
Filesystem Size Used Avail Use% Mounted on
/dev/vda2 49G 6.1G 41G 14% /
tmpfs 499M 0 499M 0% /dev/shm
/dev/vda1 477M 184M 268M 41% /boot
赞过:
赞 正在加载……
相关