我新購買的基於 KVM 的 VPS(虛擬伺服器)運行 Centos 7,在我看來,df -h 命令與 fdisk -l 和 ssm list 的結果很奇怪。
我將各種磁碟相關命令的輸出放在下面。
當我執行 df -h 時,我期望在 /dev/vda1 上看到大約 60 GB 的大小
ssm 顯示磁碟區大小和 FS 大小之間的差異。
我缺什麼?
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 2.0G 1.1G 754M 60% /
devtmpfs 912M 0 912M 0% /dev
tmpfs 921M 0 921M 0% /dev/shm
tmpfs 921M 17M 904M 2% /run
tmpfs 921M 0 921M 0% /sys/fs/cgroup
tmpfs 921M 17M 904M 2% /etc/machine-id
看來我的 / 掛載上只有 2 GB。
然而,fdisk 顯示:# fdisk -l
Disk /dev/vda: 64.4 GB, 64424509440 bytes, 125829120 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: 0x000dcb5c
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 121632383 60815168 83 Linux
/dev/vda2 121632384 125826687 2097152 82 Linux swap / Solaris
ssm 給了這個:
# ssm list
--------------------------------
Device Total Mount point
--------------------------------
/dev/vda 60.00 GB PARTITIONED
/dev/vda1 58.00 GB /
/dev/vda2 2.00 GB SWAP
--------------------------------
-------------------------------------------------------------------
Volume Volume size FS FS size Free TypeMount point
-------------------------------------------------------------------
/dev/vda1 58.00 GB ext4 1.97 GB 851.11 MB part/
-------------------------------------------------------------------
答案1
您需要擴充根檔案系統。嘗試發出resize2fs /dev/vda1
.與往常一樣,首先進行備份。
答案2
謝謝肖丹肖克
這做到了:
# resize2fs /dev/vda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 8
The filesystem on /dev/vda1 is now 15203792 blocks long.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 58G 1.1G 54G 2% /