请提供建议。我尝试在 VMware 虚拟机中的 CentOS 8 上扩展根分区。
lvdisplay
显示 LV 大小为 210 GiB。
--- Logical volume ---
LV Path /dev/cl/root
LV Name root
VG Name cl
LV UUID r1Vl5U-xFsT-ENN1-Or1d-cfRB-jbeG-GatGcD
LV Write Access read/write
LV Creation host, time localhost, 2019-10-30 18:41:53 +0300
LV Status available
# open 1
LV Size <210.00 GiB
Current LE 53759
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
但df -h
显示大小为50G。
Filesystem Size Used Avail Use% Mounted on
devtmpfs 397M 0 397M 0% /dev
tmpfs 411M 0 411M 0% /dev/shm
tmpfs 411M 5.7M 406M 2% /run
tmpfs 411M 0 411M 0% /sys/fs/cgroup
/dev/mapper/cl-root 50G 34G 17G 68% /
/dev/sda1 976M 177M 733M 20% /boot
/dev/mapper/cl-home 27G 224M 27G 1% /home
tmpfs 83M 0 83M 0% /run/user/0
然后我尝试resize2fs /dev/cl/root
并得到错误
resize2fs 1.44.3 (10-July-2018)
resize2fs: Bad magic number in super-block while trying to open /dev/cl/root
Couldn't find valid filesystem superblock.
也不起作用xfs_growfs /dev/cl/root
,出现错误xfs_growfs: /dev/cl/root is not a mounted XFS filesystem
。命令xfs_growfs /dev/mapper/cl-root
给出相同的结果。
mount | grep /dev/mapper/cl-root
输出:
/dev/mapper/cl-root on / type xfs rw,relatime,seclabel,attr2,inode64,noquota)
file -Ls /dev/mapper/cl-root
输出:
/dev/mapper/cl-root: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
答案1
感谢@KamilMaciorowski,通过运行xfs_growfs /
命令解决了这个问题。因为确实xfs_growfs
不像我之前那样接受设备名称,而是接受挂载点。