How To Configure Linux LVM on Oracle 7 / rhel 7/Centos 7 |Three major steps we
have to follow to Setup a Logical Volume Manager (LVM). The Steps are :
Physical Volume : Arrange the Physical Harddisk’s some way so
that Linux LVM can recognise the Device and can be used to configure
Volume Group and Logical Volumes is called as Physical Volume.
To create Physical
volume you can use the command pvcreate.
You can execute pvdisplay
command to show all available Physical Volume’s in the system.
To know about the Physical
Volume details Summary use the command pvs.
Physical Volume is partitioned in to little bits of size is called as Physical Extent.
Volume Group : Addition of Multiple Physical Volume is made Volume Group.
To create Volume Group
you can use the command vgcreate.
To check the details of VGs we can execute the vgdisplay command.
To know the Volume Group
Summary use the command vgs.
Logical Volume : We can create Partitions out of Volume Group
to store data is called as Logical Volume.
To create Logical Volume
you can use the command lvcreate.
To check the details of
Logical Volume you can use the command lvdisplay.
To know the
Logical Volume Summary use the command lvs.
To configure Linux LVM
we need at least a Physical Harddisk . Here I have 3 Harddisk’s i.e : /dev/sdb,
/dev/sdc, /dev/sdd with size 2 GB each.
You can check harddisk
and partition using the below command
# fdisk -l
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63
sectors/track, 261 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x00000000
Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63
sectors/track, 261 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x00000000
Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63
sectors/track, 261 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x00000000
Create Physical Volume
To create Physical volume
you can use the command pvcreate.
Syntax:
pvcreate[disk]
Now we are creating
Physical Volume by the given three physical harddisk
# pvcreate /dev/sdb
Physical volume "/dev/sdb"
successfully created
# pvcreate /dev/sdc
Physical volume "/dev/sdc"
successfully created
# pvcreate /dev/sdd
Physical volume "/dev/sdd"
successfully created
You can use pvdisplay
command to show all available Physical Volume’s in the system.
# pvdisplay /dev/sdc
"/dev/sdc" is a
new physical volume of "2.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 2.00
GiB
Allocatable NO
PE Size
0
Total PE 0
Free PE
0
Allocated PE 0
PV UUID Joqlch-yWSj-kuEn-IdwM-01S9-XO8M-mcpsVe
PV Name : Physical disk
Name
VG Name : Volume Group
Name
PV Size : Physical
Volume Size
Allocatable : The amount
of Space we can allocate
PE Size : PE stands for
Physical Extent.
Total PE : Total
available Physical Extents.
Free PE : Remaining
Physical Extents.
You can use pvs
command to check the quick short summary of all available Physical Volumes.
# pvs
PV
VG Fmt
Attr PSize PFree
/dev/sdb
lvm2 a-- 2.00g 2.00g
/dev/sdc
lvm2 a-- 2.00g 2.00g
/dev/sdd
lvm2 a-- 2.00g 2.00g
Create Volume Group
To create volume Group
you can use the command vgcreate.
Syntax: vgcreate
[Name of Volume Group] [Physical Volumes]
# vgcreate testvg /dev/sdb /dev/sdc /dev/sdd
We use vgdisplay command to check the details of Volume Group.
# vgdisplay
--- Volume group ---
VG Name
testvg
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
5.99 GiB
PE Size
4.00 MiB
Total PE
1533
Alloc PE / Size
0 / 0
Free PE / Size
1533 / 5.99 GiB
To know the Volume Group
Summary use the command vgs.
# vgs
VG
#PV #LV #SN Attr VSize
VFree
testvg 3 0 0
wz--n- 5.99g 5.99g
Create Logical Volume
We can create Partitions
out of Volume Group to store data is called as Logical Volume.
To create Logical Volume
you can use the command lvcreate.
To check the details of
Logical Volume you can use the command lvdisplay.
To know the
Logical Volume Summary use the command lvs.
syntax:lvcreate -L
[Size] -n [Name of the LV] VG
We are creating Logical Volume with name testlv
# lvcreate -L 5G -n testlv testvg
To check the details of
Logical Volume you can use the command lvdisplay.
To know the
Logical Volume Summary use the command lvs.
Now we are ready
to store data on logical volumes. we need to create file system in
Logical Volume by formatting it .
# mkfs.ext4 /dev/testvg/testlv
Now we needownload to create a directory to mount Logical Volume.
# mkdir /testlvm
we can mount it manually
by using this below command
# mount /dev/testvg/testlv /testlvm/
For automatic mount you
must need entry in fstab
After successfully enter
in fstab do the following command
#mount -a
Finally check it by the
below command
#df -h
If this article is helpful to know about How To Configure Linux LVM on Oracle 7 / rhel 7/Centos 7 please share and subscribe this article.
0 comments:
Post a Comment