Thursday 5 November 2015

LVM Thing Provision

The concept of LVM Thin Provision is to create a new size of POOL other than Volume Group (VG) from where you can create very much larger size of Logical volume partition.
Here are few simple steps are given
============================
We can assume that we have an already created Volume Group of   size 5G
============================
Note:   For Your reference i am giving you the steps for creating volume group   for example we have a partition name /dev/sda6
=============================================================
[root@desktop80 Desktop]# pvcreate /dev/sda6
Physical volume “/dev/sda6” successfully created
[root@desktop80 Desktop]#
[root@desktop80 Desktop]# vgcreate tvg /dev/sda6
Volume group “tvg” successfully created
[root@desktop80 Desktop]#
[root@desktop80 Desktop]# vgs
VG   #PV #LV #SN Attr   VSize VFree
tvg   1   0   0 wz–n- 5.00g   5.00g
tvg1   1   3   0 wz–n- 5.00g 256.00m
vol0   1   4   1 wz–n- 73.22g 13.91g
Step 1:   Now we need to create   a ThinPooL
[root@desktop80 ftp]# lvcreate –size 4500M   –thin tvg/pooL1
Logical volume “pooL1” created
Step 2: Now you can create Much larger size partition than 4500M from PooL named pooL1
[root@desktop80 ftp]# lvcreate -V10G   –name LVMthn1 –thin tvg/pooL1
Logical volume “LVMthn1” created
Step 3:   You can format the partition
[root@desktop80 ftp]# mkfs.ext4   /dev/mapper/tvg-LVMthn1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=16 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Step 4 : Now you can mount and Use LVM
[root@desktop80 ftp]# mkdir /media/LVM
[root@desktop80 ftp]# mount /dev/mapper/tvg-LVMthn1   /media/LVM
Important   : This is very much important to have real size in LVM pooL
————-
Note : We can also extend the size of LVM
==================================
############# LVM PooL extend ##############
[root@desktop80 ~]# lvextend –size +50M tvg/LVMthn1
Rounding size to boundary between physical extents: 52.00 MiB
Extending logical volume LVpooL to 4.74 GiB
Logical volume LVpooL successfully resized