Linux Disk Extend

Linux Disk Extend

Here’s a step-by-step guide on extending a disk in AlmaLinux, typically done using Logical Volume Manager (LVM):

Check Current Disk Status:

First check the current disk status and directory using the following command:

df -khT

The device must be added for the additional disk added with this command.

We select the empty disk and click New.

We select the Type section, (8e Linux should be selected as LVM.)

We select the Write section and exit.

 

Update the kernel’s information about the current state of the disk partitions and ask it to re-read the partition table.

partprobe

Extend Physical Volume (PV): Add the new disk space to the LVM as a physical volume:

pvcreate /dev/sda3

Now that our physical space is created, we put our sda3 disk in the same group as other disks. In our structure, the group was determined as almalinux. To see this more clearly

pvdisplay

We add it to the group using this command.

vgextend almalinux /dev/sda3

Extend Logical Volume (LV): Extend the Logical Volume (for example, “/dev/VG_NAME/LV_NAME”):

lvextend -l +100%FREE /dev/mapper/almalinux-root

File System Extension: Update the file system size:

If you are using the XFS file system:

xfs_growfs /dev/mapper/almalinux-root

If you are using the Ext4 file system:

resize2fs /dev/mapper/almalinux-root  
These steps provide an overview of the process of expanding a disk using LVM. However, the steps may differ depending on the specific features of your system and disk configuration.
Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.