Create new lvm partition from allocated disk space

To create a new LVM partition from allocated disk space, you can follow these steps:

Step 1: Identify the available disk space

Use the df command to identify the available disk space on your system:

df -h

This will show you a list of disk partitions and their available space.

Step 2: Identify the LVM volume group

Use the vgdisplay command to identify the LVM volume group (VG) that you want to add the new partition to:

vgdisplay

This will show you a list of LVM VGs and their available space.

Step 3: Create a new logical volume

Use the lvcreate command to create a new logical volume (LV) within the identified VG:

lvcreate -L <size> -n <name> <vg_name>

Replace <size> with the desired size of the new LV, <name> with the desired name of the new LV, and <vg_name> with the name of the VG.

For example:

lvcreate -L 10G -n mylv myvg

This will create a new LV named mylv with a size of 10GB within the myvg VG.

Step 4: Format the new logical volume

Use the mkfs command to format the new LV:

mkfs.<filesystem_type> /dev/<vg_name>/<lv_name>

Replace <filesystem_type> with the desired filesystem type (e.g. ext4, xfs, etc.), <vg_name> with the name of the VG, and <lv_name> with the name of the LV.

For example:

mkfs.ext4 /dev/myvg/mylv

This will format the new LV with the ext4 filesystem.

Step 5: Mount the new logical volume

Use the mount command to mount the new LV:

mount /dev/<vg_name>/<lv_name> /mnt

Replace <vg_name> with the name of the VG, <lv_name> with the name of the LV, and /mnt with the desired mount point.

For example:

mount /dev/myvg/mylv /mnt

This will mount the new LV at the /mnt mount point.

That's it! You have now created a new LVM partition from allocated disk space.