Linux – Creating a new Logical Volume / Partition

How do I create a new Logical Volume / Partition ?

We will be creating a new logical volume named DATA and mounting this on a new directory called DATA.

First of we will create the logical volume, then we will create a file system on the Logical Volume. Once complete we will create a new directory called DATA. 

lvcreate -L 145G -n DATA vg0
mkfs.ext3 /dev/Vg0/DATA
mkdir /DATA

Then add the following line to the /etc/fstab file,

/dev/vg0/DATA    /DATA         ext3    defaults        1 2

We can then mount /DATA,

mount -a 

You can now check to make sure you changes have been successful.   

[root@localhost ~]# df -kh
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root    3.9G  588M  3.2G  16% /
/dev/mapper/vg0-var      15G  278M   14G   2% /var
/dev/mapper/vg0-usr      9.7G  623M  8.6G   7% /usr
/dev/mapper/vg0-home  1.8G  146M  1.6G   9% /home
/dev/hda1                     99M   18M   77M  19% /boot
tmpfs                            502M     0  502M   0% /dev/shm
/dev/mapper/vg0-DATA  143G  188M  136G   1% /DATA

Please Note : You system will pre-allocate 10% of the total size of your new Logical Volume. 

Rick Donato

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial