mywindowsdownloads.blogspot.com
Click here for all Free Linux Downloads
To create a physical volume on a new hard disk, we can run following command:
# pvcreate /dev/sdb
Or else, if we have a hard disk which has partitions already created with fdisk, then in this case we can setup physical volumes on specific partition. Run fdisk to change system ID first।
This is as follows:
Command (m for help): t
Partition number (1-15): 5 ( Assuming for first logical partition)
Hex Code (type L to list codes): 8e
After this, we can create physical volume with following command:
# pvcreate /dev/sdb5
Creating volume group
After configuring two or more physical volumes, we can create volume group. A volume group is collection of physical volumes. These physical volumes may either be on single hard disk or on multiple hard disks. We can create volume group from existing physical volume. If we create more physical volumes, we can add them in existing volume group. While creating volume group we can assign it a name also. For example:
# vgcreate volgroup1 /dev/sdb5 /dev/sdc7
We can extend any already created volume group with following command:
# vgextend volgroup1 /dev/sdd2
Creating logical volume
Lastly, we can create logical volume where we can mount our file system like /home. For this we will have to know the size of physical extent in our volume. For this we can use vgdisplay command:
# vgdisplay volgroup1
This command will display a long listing, in which we will have to look at PE size. Suppose it says PE size to be 4 MB. If we wanted to setup logical volume of 500 MB, then number of PE (nPEs) will be equal to 500 divide by 4 i.e. 125. Now we can use the following command:
# lvcreate -l nPEs volgroup1 -n logvol1 ( here nPEs will be 125)
We have named the new logical volume to be logvol1. This creates new device /dev/volgroup1/logvol1. Now we can format this new device as below:
# mkfs -j /dev/volgroup1/logvol1
And finally create a directory to be mounted on and mount it:
# mkdir /home/mylv1
# mount -t ext3 /dev/volgroup1/logvol1 /home/mylv1
Now we can easily extend the size of /dev/volgroup1/logvol1, by using following command:
# lvextend -L500M /dev/volgroup1/logvol1
Here we assumed that we have spare physical extents. This command will extend the size of it to 500MB.
Tnx
ReplyDeletewaise or achaa ho sakta tha...koi ni koshish karo....
ReplyDelete