Logical Volume Management (LVM) Part-2

Continuation...... of Logical Volume Management.


Command options:
lvchange       Change the attributes of logical volume(s)
lvconvert       Change logical volume layout
lvcreate         Create a logical volume
lvdisplay       Display information about a logical volume
lvextend        Add space to a logical volume
lvmchange    With the device mapper, this is obsolete and does nothing.
lvmdisks        can List devices that may be used as physical volumes
lvmsadc         Collect activity data
lvmsar           Create activity report
lvreduce        Reduce the size of a logical volume
lvremove       Remove logical volume(s) from the system
lvrename       Rename a logical volume
lvresize          Resize a logical volume
lvs                   Display information about logical volumes
lvscan                        List all logical volumes in all volume groups



# lvm  -           to enter into the logical volume mode
 



# lvrename   -           to rename the lv name
 



# lvremove    -           to delete the LV
 



# lvmdump   - to collect all the information about LV’s, VG’s and PV’s
 



# lvmdiskscan          -           to see LV’s, VG’s and PV’s info with size
# lvs                            -           to check logical volumes info

# lvcreate –size 100m –snapshot –name snap /dev/data/lv0 - creates a snapshot logical volume named /dev/data/snap which has access to the contents of the original  logical  volume  named /dev/data/lv0 at snapshot logical volume creation time. If the original logical volume contains a file system, you can mount the snapshot  logical  volume  on  an  arbitrary directory  in  order  to  access  the  contents  of the file system to run a backup while the original file system continues to get updated.
 



# mkfs.ext3 /dev/data/lv0  - to make file system in lv
 



# mount <lv path> <mount point>         - to mount the lv
To example of snapshot
 

To restore the snapshot data mount the snapshot to mount point and copy the files from snapshot to original path

In order to delete the logical volume
#umount /lv0
#lvremove /dev/data/lv0
#vgremove data
#pvremove /dev/sdb1
#pvremove /dev/sdb2