How to Create and Mount a LVM Partition/Volume on CentOS 7

Logical Volume Management (LVM) is an abstraction layer between operating system and physical hard drives and can be easily managed the disk space.

This article describes How to create and Mount a LVM Partition/Volume on CentOS 7.
Step 1. Check Volume Details: Run the following command to get the volume:
  LV         VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
…………………………..
  nginx-data vg-data -wi-a—– <10.00g
Step 2. Create File System: Run the following command to create ext4 file system on LVM partition:
[[email protected] ~]# mkfs.ext4 /dev/vg-data/nginx-data
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620416 blocks
131020 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2151677952
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Step 3. Mount the Volume: Run the following command to mount earlier create file system:
Run the following command to create a directory to mount the file system:
[[email protected] ~]# mkdir -p /opt/nginx-www-data
Run the following command to mount the file system:
[[email protected] ~]# mount /dev/vg-data/nginx-data /opt/nginx-www-data/
Put the following parameters in /etc/fstab file to mount the file system across the system reboot:
[[email protected] ~]# vi /etc/fstab
……………………………………………….
/dev/vg-data/nginx-data /opt/nginx-www-data/    ext4    defaults        0 0
Step 4. Verify the Mount Point: Run the following command to verify:
Filesystem                        Size  Used Avail Use% Mounted on
…………………………….
/dev/mapper/vg–data-nginx–data  9.8G   37M  9.2G   1% /opt/nginx-www-data
Done!!! Now LVM partition is mounted and ready to use. Follow the article Howto Create LVM Partition on CentOS 7 Using Additional Hard Disk to create a LVM partition on CentOS 7 using Additional Hard Disk.

Leave a Reply