CentOS 8에서 파일 시스템을 확장할 수 없습니다.

CentOS 8에서 파일 시스템을 확장할 수 없습니다.

내 CentOS 8 시스템에는 다음과 같은 파티션이 있습니다.

[root@XXXXX]# fdisk -l
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 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: 0xbccac24e

Device     Boot   Start       End   Sectors Size Id Type
/dev/sda1  *       2048   2099199   2097152   1G 83 Linux
/dev/sda2       2099200 167768063 165668864  79G 8e Linux LVM




Disk /dev/mapper/cl-root: 76.5 GiB, 82137055232 bytes, 160423936 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/cl-swap: 2.5 GiB, 2684354560 bytes, 5242880 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
[root@XXXXX]# 

/dev/mapper/cl-root디스플레이 크기는 76.5GiB입니다. 그러나 df -h루트 디렉터리에는 22G라는 다른 크기가 표시됩니다.

[root@XXXXX]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             1.9G     0  1.9G   0% /dev
tmpfs                1.9G     0  1.9G   0% /dev/shm
tmpfs                1.9G  9.5M  1.9G   1% /run
tmpfs                1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/cl-root   22G   22G   62M 100% /
/dev/sda1            976M  256M  654M  29% /boot
tmpfs                379M  1.2M  377M   1% /run/user/42
tmpfs                379M  4.6M  374M   2% /run/user/1000
[root@XXXXX]# 

공간이 부족하기 때문에 루트 파일 시스템을 확장해야 합니다. 나는 그것을 알아낼 수 없습니다 . 합계에 대한 결과 /dev/mapper/cl-root는 다음과 같습니다 .pvdisplaylsblk

[root@XXXXX]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               cl
  PV Size               <79.00 GiB / not usable 1.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              20223
  Free PE               0
  Allocated PE          20223
  PV UUID               XXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXX-XXXXX
   
[root@XXXXX]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0   80G  0 disk 
├─sda1        8:1    0    1G  0 part /boot
└─sda2        8:2    0   79G  0 part 
  ├─cl-root 253:0    0 76.5G  0 lvm  /
  └─cl-swap 253:1    0  2.5G  0 lvm  [SWAP]
sr0          11:0    1 1024M  0 rom  
[root@XXXXX]# 

lvdisplay다음 출력이 표시됩니다.

[root@XXXXX]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/cl/swap
  LV Name                swap
  VG Name                cl
  LV UUID                000000000000000000000000000
  LV Write Access        read/write
  LV Creation host, time localhost, 2020-01-29 21:17:47 -0500
  LV Status              available
  # open                 2
  LV Size                2.50 GiB
  Current LE             640
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/cl/root
  LV Name                root
  VG Name                cl
  LV UUID                00000000000000000000000000
  LV Write Access        read/write
  LV Creation host, time localhost, 2020-01-29 21:17:48 -0500
  LV Status              available
  # open                 1
  LV Size                <76.50 GiB
  Current LE             19583
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
   
[root@XXXXX]# 

CentOS 8을 사용하고 있습니다. 나는 무엇을 해야 합니까?

답변1

귀하의 LV가 /dev/cl/root사용 가능한 최대 크기에 도달했습니다. 필요한 것은 파일 시스템의 크기를 조정하는 것입니다. 기본 옵션을 사용하는 경우 xfs명령은 다음과 같아야 합니다.

xfs_growfs /이 명령은 xfs 볼륨을 사용 가능한 모든 공간으로 확장합니다. xfs크기는 줄일 수 없다는 점을 기억하세요 .

를 사용하면 xfs_growfs / -D size확장할 크기를 지정할 수 있지만 이는 MB/GB가 아닌 파일 시스템 블록으로 표현됩니다. xfs_info이 명령은 블록 크기를 표시합니다.

이 명령은 LV 크기와 xfs 볼륨 크기의 차이를 확인하는 데 도움이 됩니다.
lsblk -o name,fstype,size,fssize,mountpoint,label,model,vendor

또한 pvsLVM 물리 볼륨, 볼륨 그룹, 논리 볼륨이 각각 잘 요약되어 있습니다 vgs.lvs

관련 정보