Naming Convention:
Logical Volume's can have a name of max. 255 chars.
It can be assigned by the admin or done by the system.
Default names of the form /dev/vgxx/lvoln (for block device) and /dev/vgxx/rlvoln (for raw device).
Few Points to remember :
1. A logical volume can be used for swap, dump, raw data or a file system.
Here are the mostly used commands for managing LV's :
To create a LV :
# lvcreate
To change the characteristics of a LV :
# lvchange
To display info about LVs :
# lvdisplay
To increase the size of a LV :
# lvextend
To decrease the size of a LV :
# lvreduce
To remove a LV :
# lvremove
To prepare a LV to be a root, primary swap or dump volume, updating the boot info on a boot PV :
# lvlnboot
To remove the link that makes a LV a root, primary swap or dump volume :
# lvrmboot
To split a mirrored LV into 2 LVs :
# lvsplit
To merge 2 LVs into 1 mirrored LV :
# lvmerge
To sync the mirrored copies of a mirrored LV :
# lvsync
Few Examples,
1. To display the properties of a LV :
# lvdisplay /dev/vg01/lvol8
2. To display the detailed properties of a LV :
# lvdisplay -v /dev/vg01/lvol8
3. To create a LV of size 100MB in vg01 :
# lvcreate -L 100 /dev/vg01
4. To create a LV named myvol in vg01 of size 100MB :
# lvcreate -n myvol -L 100 /dev/vg01
5. To extend the size of a LV to 200MB :
# lvextend -L 200 /dev/vg01/lvol8
6. To extend the size of a LV by 12 LE's from disk8 :
# lvextend -l 12 /dev/vg01/myvol /dev/disk/disk8
7. To extend the size of a LV to 120MB by taking space from disk8 :
# lvextend -L 120 /dev/vg01/myvol /dev/disk/disk8
8. To list out the processes using a LV :
# fuser -cu /dev/vg01/myvol
9. To add additional copy (mirror) for a LV :
# lvextend -m 1 /dev/vg01/myvol
10. To do the same as above but using a specific PV :
# lvextend -m 1 /dev/vg01/myvol /dev/disk/disk9
11. To remove the mirror copies from a LV :
# lvreduce -m 0 /dev/vg01/myvol
This will remove all the mirror copies. I mean only the original copy is left on the LV.
12. To do the same as above but mentioning a specific PV where to remove the copy :
# lvreduce -m 0 /dev/vg01/myvol /dev/disk/disk9
13. To rename a LV :
a. Rename both the block and raw device files of the LV :
# mv /dev/vg01/myvol /dev/vg01/newvol
# mv /dev/vg01/rmyvol /dev/vg01/rnewvol
b. Finally change the lv names in other config files like /etc/fstab
14. To remove a logical volume :
First of all make sure the LV is not in use.I mean if it got any file system, then unmount the file system.
Then remove the lv using the below command.
# lvremove /dev/vg01/myvol
No comments:
Post a Comment