Breaking News
Loading...
Wednesday, August 28, 2013

Linux Logical Volume Manager

8:18 AM
The Linux Logical Volume Manager
The second generation of the Linux Logical Volume Manager (LVM2) is a logical volume manager capable of pooling multiple storage devices together to represent a single volume or volumes, either in a striped or mirrored fashion. Everything is created and managed on a layer-by-layer basis. First is the physical volume. It is followed by the volume group and then the mountable logical volume itself. Most mainstream Linux distributions usually have the LVM2 userland tools preinstalled. If you find that it’s not installed on your distribution, download and install it via your distribution’s package repository
.
The idea is almost similar in concept to the Redundant Array of Independent Disks (RAID), and although LVM2 does not support any parity-driven striping, it still adds additional value. For instance, LVM2 allows for the uninterrupted addition, removal and replacement of storage devices. It makes for easy dynamic resizing of volume groups and logical volumes

How to setup Linux LVM  at command line 
Step 1: Login with root user ID and try to avoid using sudo command for simplicity reason.

Step2:UsingthewholesecondaryharddiskforLVMpartition:

#fdisk /dev/hdb
At the Linux fdisk command prompt,
  1. press n to create a new disk partition,
  2. press p to create a primary disk partition,
  3. press 1 to denote it as 1st disk partition,
  4. press ENTER twice to accept the default of 1st and last cylinder – to convert the whole secondary hard disk to a single disk partition,
  5. press t (will automatically select the only partition – partition 1) to change the default Linux partition type (0×83) to LVM partition type (0x8e),
  6. press L to list all the currently supported partition type,
  7. press 8e (as per the L listing) to change partition 1 to 8e, i.e. Linux LVM partition type,
  8. press p to display the secondary hard disk partition setup. Please take note that the first partition is denoted as /dev/hdb1 in Linux,
press w to write the partition table and exit fdisk upon completion.
Step 3:Next, this LVM command will create a LVM physical volume (PV) on a regular hard disk or partition:

# pvcreate /dev/hdb1
Step:4  Now, another LVM command to create a LVM volume group (VG) called vg0 with a physical extent size (PE size) of 16MB:

# vgcreate -s 16M vg0 /dev/hdb1
Be properly planning ahead of PE size before creating a
Step:5 Create a 400MB logical volume (LV) called lvol0 on volume group vg0:

#lvcreate -L 400M -n lvol0 vg0

lvcreatecommandwillcreateasoftlink/dev/vg0/
lvol0pointtoacorrespondenceblockdevicefilecalled/dev/
mapper/vg0-lvol0.

Step:6 The Linux LVM setup is almost done. Now is the time to format logical volume lvol0 to create a Red Hat Linux supported file system, i.e. EXT3 file system, with 1% reserved block count:

#mkfs -t ext3 -m 1 -v /dev/vg0/lvol0
Step:7 Create a mount point before mounting the new EXT3 file system:

#mkdir /mnt/vfs

Step:8 The last step of this LVM tutorial – mount the new EXT3 file system created on logical volume lvol0 of LVM to /mnt/vfs mount point:

# mount -t ext3 /dev/vg0/lvol0 /mnt/vfs

To confirm the LVM setup has been completed successfully, the df -h command should display these similar message:

/dev/mapper/vg0-lvol0388M11M374M3%/mnt/vfs

Some of the useful LVM commands reference:
vgdisplay vg0

To check or display volume group setting, such as physical size (PE Size), volume group name (VG name), maximum logical volumes (Max LV), maximum physical volume (Max PV), etc.
lvdisplay -  display attributes of a logical volume .lvdisplay allows you to see the attributes of a logical volume like size, read/write status,  snapshot information etc.

pvscan
To check or list all physical volumes (PV) created for volume group (VG) in the current system.

vgextend
To dynamically adding more physical volume (PV), i.e. through new hard disk or disk partition, to an existing volume group (VG) in online mode. You’ll have to manually execute vgextend after pvcreate command that create LVM physical volume (PV).

Lvextend lvextend allows you to extend the size of a logical volume. Extension of snapshot logical volumes  is supprted as well.

3 comments:

  1. Voyance coaching tirage de cartes marie claire

    Feel free to visit my web page: voyance par telephone gratuit

    ReplyDelete
  2. Horoscope du jour gratui signification des signes astrologiques

    Also visit my blog :: voyance gratuite

    ReplyDelete
  3. Cartomancie denis la pierre tirage tarot gratuit en ligne amour

    Feel free to visit my webpage; voyance

    ReplyDelete

 
Toggle Footer