Expanding disk size in CentOS8
I thought increasing the disk size from VM Fusion settings will do the job.
Took quite a while to disillusion me…
To see the current disk sizes:
To enter the operational mode:
Then you have to type ‘p’ for partition to see the disk profile again.
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 41943039 39843840 19G 8e Linux LVM
The main process starts by typing ’n’ to create a new partition. The newly created partition (/dev/sda3) ID is defaulted to 83 and needs to be changed to 8e by typing ‘l’ to see the hex codes. Typing ‘8e’ will complete the task. Now press ‘w’ to save and exit.
Time for a reboot and the running the following as sudo to finalise the expansion for sda2 (in my observation by merging with sda3). As you see from the difference in line numbers, I had to go through a lot of errors…
107 pvcreate /dev/sda3
110 vgextend cs /dev/sda3
115 lvextend /dev/cs/root /dev/sda3
119 xfs_growfs /dev/cs/root
120 df -h
But it was worth it: 18G used of 100.
(base) [user@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on/dev/mapper/cs-root 100G 18G 83G 18% /