Create three physical partitions:
/dev/sde
/dev/sdf
/dev/sdg
I have allocated all the space to the sde sdf sdg respectively.
Lets create physical volumes out of the partitions we created.
[root@rajcentos ~]# pvcreate /dev/sde1 /dev/sdf1 /dev/sdg1
Physical volume "/dev/sde1" successfully created
Physical volume "/dev/sdf1" successfully created
Physical volume "/dev/sdg1" successfully created
I have named the volume group as raj_vg
[root@rajcentos ~]# vgcreate raj_vg /dev/sde1 /dev/sdf1 /dev/sdg1
Volume group "raj_vg" successfully created
If you run pvscan:
[root@rajcentos ~]# pvscan
PV /dev/sde1 VG raj_vg lvm2 [48.00 MB / 48.00 MB free]
PV /dev/sdf1 VG raj_vg lvm2 [28.00 MB / 28.00 MB free]
PV /dev/sdg1 VG raj_vg lvm2 [16.00 MB / 16.00 MB free]
PV /dev/sda2 VG VolGroup00 lvm2 [7.88 GB / 32.00 MB free]
Total: 4 [7.96 GB] / in use: 4 [7.96 GB] / in no VG: 0 [0 ]
Here is the vgdisplay output:
[root@rajcentos ~]# vgdisplay
--- Volume group ---
VG Name raj_vg
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 3
Act PV 3
VG Size 92.00 MB
PE Size 4.00 MB
Total PE 23
Alloc PE / Size 0 / 0
Free PE / Size 23 / 92.00 MB
VG UUID hinsab-4Ube-dinI-HmsK-TQ19-UWu1-j9h0bF
[root@rajcentos ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 7.88G 32.00M
raj_vg 3 0 0 wz--n- 92.00M 92.00M
[root@rajcentos ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 7.88G 32.00M
/dev/sde1 raj_vg lvm2 a- 48.00M 48.00M
/dev/sdf1 raj_vg lvm2 a- 28.00M 28.00M
/dev/sdg1 raj_vg lvm2 a- 16.00M 16.00M
Now create logical volume groups from the "raj_vg"
[root@rajcentos ~]# lvcreate -n lv_one --size 20M raj_vg
Logical volume "lv_one" created
[root@rajcentos ~]# lvcreate -n lv_two --size 20M raj_vg
Logical volume "lv_two" created
[root@rajcentos ~]# lvcreate -n lv_three --size 20M raj_vg
Logical volume "lv_three" created
[root@rajcentos ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-ao 7.34G
LogVol01 VolGroup00 -wi-ao 512.00M
lv_one raj_vg -wi-a- 20.00M
lv_three raj_vg -wi-a- 20.00M
lv_two raj_vg -wi-a- 20.00M
[root@rajcentos ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 7.88G 32.00M
raj_vg 3 3 0 wz--n- 92.00M 32.00M
Lets format the filesystem:
[root@rajcentos ~]# mkfs -t ext3 /dev/mapper/raj_vg-lv_one
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rajcentos ~]# mkfs -t ext3 /dev/mapper/raj_vg-lv_two
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rajcentos ~]# mkfs -t ext3 /dev/mapper/raj_vg-lv_three
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
5136 inodes, 20480 blocks
1024 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=20971520
3 block groups
8192 blocks per group, 8192 fragments per group
1712 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
run lvs now:
[root@rajcentos ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-ao 7.34G
LogVol01 VolGroup00 -wi-ao 512.00M
lv_one raj_vg -wi-a- 20.00M
lv_three raj_vg -wi-a- 20.00M
lv_two raj_vg -wi-a- 20.00M
Creating the directories so that the newly created volumes can be mounted:
[root@rajcentos ~]# mkdir /apps
[root@rajcentos ~]# mkdir /vontu
[root@rajcentos ~]# mkdir /ppm
To mount the volumes refer to the path:
[root@rajcentos ~]# mount /dev/mapper/raj_vg-lv_one /apps
[root@rajcentos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.3G 1.2G 5.7G 18% /
/dev/sda1 99M 13M 81M 14% /boot
none 125M 0 125M 0% /dev/shm
/dev/mapper/raj_vg-lv_one
20M 1.2M 18M 7% /apps
[root@rajcentos ~]# mount /dev/mapper/raj_vg-lv_two /vontu
[root@rajcentos ~]# mount /dev/mapper/raj_vg-lv_three /ppm
[root@rajcentos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7.3G 1.2G 5.7G 18% /
/dev/sda1 99M 13M 81M 14% /boot
none 125M 0 125M 0% /dev/shm
/dev/mapper/raj_vg-lv_one
20M 1.2M 18M 7% /apps
/dev/mapper/raj_vg-lv_two
20M 1.2M 18M 7% /vontu
/dev/mapper/raj_vg-lv_three
20M 1.2M 18M 7% /ppm
[root@rajcentos ~]# pvscan
PV /dev/sde1 VG raj_vg lvm2 [48.00 MB / 8.00 MB free]
PV /dev/sdf1 VG raj_vg lvm2 [28.00 MB / 8.00 MB free]
PV /dev/sdg1 VG raj_vg lvm2 [16.00 MB / 16.00 MB free]
PV /dev/sda2 VG VolGroup00 lvm2 [7.88 GB / 32.00 MB free]
Total: 4 [7.96 GB] / in use: 4 [7.96 GB] / in no VG: 0 [0 ]
[root@rajcentos ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
7579576 1254184 5940368 18% /
/dev/sda1 101086 13240 82627 14% /boot
none 127364 0 127364 0% /dev/shm
/dev/mapper/raj_vg-lv_one
19827 1202 17601 7% /apps
/dev/mapper/raj_vg-lv_two
19827 1202 17601 7% /vontu
/dev/mapper/raj_vg-lv_three
19827 1202 17601 7% /ppm
Adding a new physical volume to the volume group. You can use vgextend:
/dev/sdb1 and 2 I have created saperately so that those could be added to the
existing raj_vg.
[root@rajcentos ~]# lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
LogVol00 VolGroup00 -wi-ao 7.34G
LogVol01 VolGroup00 -wi-ao 512.00M
lv_one raj_vg -wi-a- 20.00M
lv_three raj_vg -wi-a- 20.00M
lv_two raj_vg -wi-a- 20.00M
[root@rajcentos ~]# vgextend raj_vg /dev/sdb1
Volume group "raj_vg" successfully extended
[root@rajcentos ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 7.88G 32.00M
raj_vg 4 3 0 wz--n- 404.00M 344.00M
[root@rajcentos ~]# vgextend raj_vg /dev/sdb2
Volume group "raj_vg" successfully extended
Now see the change in the size of raj_vg
[root@rajcentos ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 2 0 wz--n- 7.88G 32.00M
raj_vg 5 3 0 wz--n- 500.00M 440.00M
No comments:
Post a Comment