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

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

赞过:

赞 正在加载……

相关

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值