首页 » Linux » 解决fdisk与df命令显示的磁盘空间不一样

解决fdisk与df命令显示的磁盘空间不一样

作者: vForce 分类: Linux 发布时间: 2017-08-07 17:59 ė浏览 10,519 次 6没有评论

之前通过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-2010)
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

 

本文出自 Tech Trace,转载时请注明出处及相应链接。

本文永久链接: https://www.qiujiahui.com/2017/08/07/%e8%a7%a3%e5%86%b3fdisk%e4%b8%8edf%e5%91%bd%e4%bb%a4%e6%98%be%e7%a4%ba%e7%9a%84%e7%a3%81%e7%9b%98%e7%a9%ba%e9%97%b4%e4%b8%8d%e4%b8%80%e6%a0%b7/

0

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*

Ɣ回顶部
%d 博主赞过: