我把VPS的磁盘大小从20GB升级到了40GB,新增加的20GB却无法使用,fdisk -l
显示40GB却du -h
显示20GB!
root@ubuntu:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 385M 656K 385M 1% /run
/dev/sda1 19G 16G 2.5G 87% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
tmpfs 385M 0 385M 0% /run/user/0
root@ubuntu:~# fdisk -l
Disk /dev/sda: 38.2 GiB, 40961572864 bytes, 80003072 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
Disklabel type: dos
Disk identifier: 0x7a5a5ba2
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 80003038 80000991 38.2G 83 Linux
答案1
您正在寻找的命令可能是
sudo resize2fs /dev/sda1
。