HowTo : Creating logical volume in Linux Print E-mail
(1 vote, average: 5.00 out of 5)
Written by geekyB   
Monday, 08 December 2008 14:29

Logical volumes can be created using lvcreate command in Linux.  Consider that you have new disks /dev/sdb & /dev/sdc added to the system and it is free for use. You can use the steps mentioned below to create logical volume & filesytem on it.
 
1) Initialize the disks to be added to LVM.

# pvcreate /dev/sdb /dev/sdc
 
2) Create volume group on the physical disks. "vgcreate" command is used to create volume group. Here the volume group we create is "vg0" & we are using both /dev/sdb /dev/sdc
# vgcreate vg0 /dev/sdb /dev/sdc

3) Create Logical volumes : "lvcreate" command is used to create logical volumes. Let us say, we have to create a 100G volume of name "vol01".  This command will create the logical volume named /dev/vg0/vol01 of size 100G.

# lvcreate -L 100G -n vol01 vg0



4) Now we can create a file system on the Logical volume /dev/vg0/vol01
# mkfs.ext3 /dev/vg0/vol01

5) Mount the volume to use it.
# mount /dev/vg0/vol01 /d1

If you want this newly created LV to come up during the boot sequence, you can add it to /etc/fstab file.
Last Updated on Tuesday, 23 December 2008 03:26