Installation do not use whole of disk

from one of the cloud provider I by cloud server, during create this cloud server I choose rocky linux 9.3 as OS, for size of SSD disk I choose 240 GB and 32GB RAM and 16 Core CPU, after creation, I login to this server and run df -h and see

 df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             4.0M     0  4.0M   0% /dev
tmpfs                 16G     0   16G   0% /dev/shm
tmpfs                6.3G   17M  6.3G   1% /run
efivarfs             256K   28K  223K  12% /sys/firmware/efi/efivars
/dev/mapper/rl-root   13G  1.9G   11G  15% /
/dev/sda2            960M  273M  688M  29% /boot
/dev/sda1            599M  7.1M  592M   2% /boot/efi
tmpfs                3.2G     0  3.2G   0% /run/user/0
tmpfs                3.2G     0  3.2G   0% /run/user/1000

and I see whole of disk does not use
when I run this commnad

sudo fdisk -l

I see


 sudo fdisk -l
[sudo] password for admin: 
GPT PMBR size mismatch (33554431 != 503316480) will be corrected by write.
Disk /dev/sda: 240 GiB, 257698038272 bytes, 503316481 sectors
Disk model: Virtual disk    
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: gpt
Disk identifier: B133D9B5-CF8F-4786-BE67-B0734B59F71D

Device       Start      End  Sectors  Size Type
/dev/sda1     2048  1230847  1228800  600M EFI System
/dev/sda2  1230848  3327999  2097152    1G Linux filesystem
/dev/sda3  3328000 33552383 30224384 14.4G Linux LVM


Disk /dev/mapper/rl-root: 12.81 GiB, 13753122816 bytes, 26861568 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/rl-swap: 1.6 GiB, 1719664640 bytes, 3358720 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

and I see

lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda           8:0    0  240G  0 disk 
├─sda1        8:1    0  600M  0 part /boot/efi
├─sda2        8:2    0    1G  0 part /boot
└─sda3        8:3    0 14.4G  0 part 
  ├─rl-root 253:0    0 12.8G  0 lvm  /
  └─rl-swap 253:1    0  1.6G  0 lvm  [SWAP]
sr0          11:0    1 1024M  0 rom  

How I can resize the disk and use whole of disk?

Basically you can expand it with those three commands (adjust the size with the -L argument):

  1. growpart /dev/sda 3
  2. lvextend -L +60G /dev/mapper/rl-root
  3. xfs_growfs /

You can check out this topic for more info and context:

Expanding the disk always comes with little risk, so the best practice is to make a backup before expanding.
You can also consider expanding the root by only the amount you need for it. LVM gives you the possibility to create more partitions and expand every partion independently. xfs cannot be shrunk, so if you take all the space for / now, you won’t be able to create another partition at some point in the future.

2 Likes

Thank you save my life.