Linux Stuff && Coffee

LVcreate Example: Create Logical Volume Linux

| Comments

This tutorial provides a lvcreate example showing you how to create a logical volume in Linux. The examples below assume you have free space in your existing Logical Group (LG for short), the operating system I am creating the LV’s on is CentOS however this should work on any other linux distro Ubuntu, Debian etc however you may find other distros structure the way they create LG’s and LV’s differently. Fedora, Redhat, CentOS should keep a similar structure to below.

lvcreate – create logical volume called backups

lvcreate logical volume

The lvcreate example below will create a logical volume with 120Gb Logical Volume called “backups” in Volume Group “vg00” (to find out what you VG is called run “vgdisplay”).

lvcreate -L 120G -n backups vg00

Create file system on Logical Volume

To create a ext3 filesystem on the new logical volume you just created, run the following:

mkfs.ext3 /dev/vg00/backups

You probably want this partition to be auto mounted at boot, so create the /etc/fstab entry for /backups:

/dev/vg00/backups       /backups        ext3     defaults,usrquota       0 2

Create mount point for Logical Volume in Linux

Don’t forget to create the mount point!

mkdir /backups

Test this mounts before you reboot to avoid a failed startup… The last thing you want if you are working remotely.

mount /backups

The curser should drop to the line below, like so:

[root@darthvader ~]# mount /backups
[root@darthvader ~]#

That’s all there is to creating a logical volume with lvcreate, formatting it with an ext3 file system and mounting it at boot.