Search This Blog

Showing posts with label LVM. Show all posts
Showing posts with label LVM. Show all posts

Tuesday, April 17, 2012

LVM from scatch



Click on below image for zoom.
 
You can see three main layers in LVM.
1) Physical volume.
2) Volume group.
3) Logical volume.

 1) Physical Volume:
This is the first level in LVM . Here you create physical volume out of actual physical disk/partition.
command used to create a Physical volume is as below.

e.g.
#pvcreate  /dev/sdb

2) Volume group:
This is the second level and assumes that you have already created physical volumes.At this stage you create group of physical volume and name them.


e.g
#vgcreate /dev/sdb vg_group01

3) Logical volume:
This is the last step in LVM creation .Here you specify the Logical volume name , size and volume group name.
e.g.
#lvcreate -n lv_01 -L 200 

Note:-
If you dont specify a unit, megabyte will be used as default.
You can also specify the logical volume size in terms of Logical extents .
To specify volume size in terms of Logical extents you use -l option. 
Specifying a name using -n option is optional .If you dont specify any name for Logical volume ,LVM2 automatically assigns it for you. 
Incase you want to change the name of Logical volume you can do it using 
lvrename oldname newname .



Wednesday, June 1, 2011

How to Extend Root partition using LVM?

In this article,I am using a virtual instance of linux machine hosted on SUN virtual box.

The linux machine is allocated a harddisk space of 5 gb .
The root partition itself occupied 4 GB of space and the rest was allocated to Swap.

It was all clear from a beginning that i m going to face space crunch on the newly created machine.

Thankfully root was partitioned with LVM.

So i added a new Hardisk of 8 GB and extended the / size.

I found following post very useful .

http://www.turnkeylinux.org/blog/extending-lvm

I described my problem on following forum and the reply was so informative.
http://www.unix.com/unix-dummies-questions-answers/160635-how-extend-root-partition.html#post302526559

http://www.linuxquestions.org/questions/showthread.php?p=4372596#post4372596

I learned not to grow the partition when it is mounted(Especially /) and rather use live CD to do the same.