Create a new volume group in RHEL

·

1 min read

Create a Physical Volume:

Initialize the disk or partition you want to use. For example, if you want to use /dev/sdb:

sudo pvcreate /dev/sdb

Create a Volume Group:

Create a new volume group and add the physical volume to it. For example, to create a volume group named VolGroup01:

sudo vgcreate VolGroup01 /dev/sdb

Create a Logical Volume:

Create a new logical volume within the volume group. For example, to create a 13G logical volume named asr_vol:

sudo lvcreate -L 13G -n asr_vol VolGroup01

Format the Logical Volume:

Format the new logical volume with a filesystem, such as ext4:

sudo mkfs.ext4 /dev/VolGroup01/asr_vol

Create a Mount Point:

Create the directory where you want to mount the new volume:

sudo mkdir -p /shared/asr

Mount the Logical Volume:

Mount the new logical volume to the created directory:

sudo mount /dev/VolGroup01/asr_vol /shared/asr

Update /etc/fstab:

To ensure the volume mounts automatically at boot, add an entry to /etc/fstab:

sudo vi /etc/fstab

Add the following line:

/dev/VolGroup01/asr_vol /shared/asr ext4 defaults 0 2