Sunday, September 23, 2012

Linux LVM Configuration Tutorial



Linux LVM Configuration:

Add the physical disks to the linux server.

Using fdisk command create the partition with the system id 8e.

Then use the following command to create the PV.

pvcreate <dev name>

pvcreate /dev/sdg1

Use the pvscan command to list all the Pv's





Crate a Volume Group using the following command.
vgcreate  <vgname> <PV>

vgcreate senthilvg </dev/sdg1>

vgscan command used to list the Volume groups.





After creating the PV and VG then create the Logical Volume.

To create logical volume use the lvcreate command.

lvcreate -L <size> <vgname>

lvcreate -L 100m senthilvg

Use the lvscan command to list the Logical Volumes.




Now create the file system. Use the following command.

mkfs -t ext3 /dev/<vgname>/<lvname> 

mkfs -t ext3 /dev/senthilvg/lvol1





After successfully creating the file system, mount the file system in any mount point.

mkdir /ldata

mount /dev/senthilvg/lvol1   /ldata

Now you can create the files and directories.

Any time you can resize the logical volumes and anytime you can add the disks to the existing volume group.



1 comment:

  1. In VMware after adding hard disk no need to reboot.(if it SCSI device)
    We can use the follwoing command:
    echo " - - - " >> /sys/class/scsi_host/host*/scan
    it will automatically detect the the harddisk that you use.* indicates all host present inside scsi_host.For more info just get inside to the directory /sys/class/scsi_host.

    ReplyDelete