fir3net
PPS-Firenetbanner-780.5x190-30-03-17

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. 

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001