Centos
fdisk -l 顯示 500GB,df -h 顯示 240GB
在增加我的 centos 虛擬機的磁碟空間後(在 esxi 管理程序中)
當我執行 fdsik
[root@sopiqecommerce ~]# fdisk -l Disk /dev/sda: 504.7 GB, 504658657280 bytes, 985661440 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: 0x000bd0c1 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 985661439 491781120 8e Linux LVM Disk /dev/mapper/centos-root: 241.7 GB, 241721933824 bytes, 472113152 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 /dev/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 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 /dev/mapper/centos-home: 21.5 GB, 21474836480 bytes, 41943040 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
當我執行 df -h 時:
[root@sopiqecommerce ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 226G 106G 120G 48% / devtmpfs 2.9G 0 2.9G 0% /dev tmpfs 2.9G 0 2.9G 0% /dev/shm tmpfs 2.9G 8.8M 2.9G 1% /run tmpfs 2.9G 0 2.9G 0% /sys/fs/cgroup /dev/sda1 1014M 186M 829M 19% /boot /dev/mapper/centos-home 20G 33M 20G 1% /home tmpfs 581M 0 581M 0% /run/user/0
我使用 gparted 向磁碟添加 200 GB
使用未分配的 200gb 是否缺少任何配置?
$$ update $$ 當我執行 lvdisplay :
[root@sopiqecommerce ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID S40JP2-OofD-BRls-TeFj-uP6g-aBuh-mjKHyP LV Write Access read/write LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100 LV Status available # open 2 LV Size <3.88 GiB Current LE 992 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:1 --- Logical volume --- LV Path /dev/centos/root LV Name root VG Name centos LV UUID rHtm3b-0dqp-PXvF-OAaS-rLzR-TeW5-7E21cd LV Write Access read/write LV Creation host, time sopiqecommerce, 2019-02-19 14:55:47 +0100 LV Status available # open 1 LV Size 225.12 GiB Current LE 57631 Segments 4 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:0 --- Logical volume --- LV Path /dev/centos/home LV Name home VG Name centos LV UUID g33dwM-E1cZ-G6BM-2OP1-ilap-yS7k-ABU5Po LV Write Access read/write LV Creation host, time sopiqecommerce, 2019-02-23 13:22:22 +0100 LV Status available # open 1 LV Size 20.00 GiB Current LE 5120 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 8192 Block device 253:2
我應該執行
lvextend -l+100%FREE /dev/mapper/centos-root
,以增加 /root 分區嗎?
很可能您正在使用 LVM 磁碟,因此您還需要擴展邏輯卷。
你需要執行:
lvdisplay
找到要添加空間的邏輯卷,然後執行以下命令:
lvextend -l+100%FREE /dev/full/path/here
完成後,您還需要執行:
resize2fs /dev/full/path/here
df -h 現在應該顯示正確的大小