LVM commands tutorial : Part 3 : Logical Volume (lvcreate, lvdisplay, lvremove)

Series of tutorial to learn LVM commands. In this part, learn how to create, delete logical volume and view details of it (lvcreate, lvdisplay, lvremove)

Logical volumes are small slices carved out of physical volumes storage space which is collectively available in volume group. 
Command : lvcreate
This command used to create new logical volume. Logical volumes are mounted on directories as a mount point. So logical volume size is the size you want for mount point. Use command like below :
In above command you need to supply size in MB (1 GB in above example) to -L argument and volume group name in which you need to create that LV. If no name suggested in command then by default command creates LV with name /dev/vg01/lvolX (X is next avaibale number).
This command supports below options –
  • -l  : Number of LEs
  • -n : LV Name
Created LV details can be seen using command lvdisplay.

Command : lvdisplay
We seen above how to create LV, now we will see how to view details of it. This command is same as pvdisplay for PV and vgdisplay for VG. It shows you details like name, volume group it belongs to, size, permission, status, allocation policy etc.
More detailed output can be obtained with -v option. In this detailed outpout you can get the LE details where they resides and LV distribution across disks.

Command : lvremove
Removing a logical volume is data destroying task. Make sure you take backup of data within mount point then empty it and stop all user/app access to it. If LV is not empty then command will prompt you for confirmation to proceed. 
Once lvol is delete its number is again available for next new lvol which is being created in same VG. All PE assigned to this LV will be released as free PE and hence free space in VG will increase.


We will be seeing how to extend and reduce LV also how to activate or deactivate LV in next post.
SHARE

sangeethakumar

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment