Creating LVM with group Permissions (Complete Guide).

  1. Add Existing User to a group setup for permissions.

sudo groupadd <groupname>

sudo usermod -aG <groupname> <User>

  • Install required Packages for LVM

sudo yum install lvm2 (For Centos)

sudo apt install lvm2 (For Ubuntu)

  • Create Physical Volume

sudo pvcreate /dev/vdb /dev/vdc

  • Create Volume Group

sudo vgcreate <volume name> /dev/vdb /dev/vdc

  • Create Logical Volume

sudo lvcreate -L <size>(m/G) <path>

note: if you want to make use of all the size available

use: vgdisplay  (check for free allocation)

  • Change Type to XFS

Mkfs.xfs <Logical Volume Path>

  • Mount to specific directory

Mount /dev/<group name>/<lv volume name>   /<directory>

  • Make sure the mount point is persistent across reboots

ls /dev/mapper

copy the path for the selected volume.

Add the following line to /etc/fstab

/dev/mapper/<volume> <mount point directory path> xfs defaults 0 0

  • Manage Ownership and Permissions.

Chown :<specified group name> <directory path>

  1. Manage read write execute permissions.

Chmod 770 <directory path> ( Owner and Group Permissions, no permissions to other)

Leave a Reply

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