RHEL6-15-LOGICAL
VOLUME MANAGER (LVM)-2
DIFFERENT LV’S:
HOW TO USE THE LV:
DIFFERENT LV’S:
1) Linear Volume
2) Striped Volume
3) Mirrored Volume
[root@rhel6-client1 ~]# pvcreate /dev/sdc1
/dev/sdc2 /dev/sdc3
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdc2" successfully created
Physical volume "/dev/sdc3" successfully created
[root@rhel6-client1 ~]# vgcreate
myvg01 /dev/sdc1 /dev/sdc2 /dev/sdc3
Volume group "myvg01" successfully created
1) Linear Volume
[root@rhel6-client1 ~]# lvcreate
-L 200M -n mylv01 myvg01
Logical volume "mylv01" created
2) Striped Volume
For large sequential reads and writes,
stripe volumes can improve the efficiency of the data I/O.
[root@rhel6-client1 ~]# lvcreate
-L 100M -i2 -I64 -n mystripevol01 myvg01
Rounding size (25 extents) up to stripe boundary size (26 extents)
Logical volume "mystripevol01" created
-i is the no of stripes
-I is the stripe size
(tuned to a power of 2 between 4kB and 512kB)
We need to consider the no of PV’s while
providing the no of stripes via –i
[root@rhel6-client1 ~]# lvcreate
-L 100M -i4 -I64 -n mystripevol02 myvg01
Rounding size (25 extents) up to stripe boundary size (28 extents)
Number of stripes (4) must not exceed number of physical volumes (3)
[root@rhel6-client1 ~]# lvdisplay
/dev/myvg01/mystripevol01
---
Logical volume ---
LV
Path /dev/myvg01/mystripevol01
LV
Name mystripevol01
VG
Name myvg01
LV
UUID
7tbZvH-dQpx-7lwJ-Mhbt-dSPu-d4U5-0xURjv
LV
Write Access read/write
LV
Creation host, time rhel6-client1, 2017-03-28 18:51:52 +0530
LV
Status available
#
open 0
LV
Size 104.00 MiB
Current LE 26
Segments 1
Allocation inherit
Read
ahead sectors auto
-
currently set to 512
Block device 253:8
3) Mirrored Volume
When you create a mirrored volume, you
specify the number of copies of the data to make with the -m argument of the
lvcreate command. Specifying -m1 creates one mirror, which yields two copies of
the file system: a linear logical volume plus one copy. Similarly, specifying
-m2 creates two mirrors, yielding three copies of the file system.
A mirror maintains identical copies of data
on different devices. When data is written to one device, it is written to a
second device as well. This provides protection for device failures.
An LVM mirror divides the device being
copied into regions that are typically 512KB in size. LVM maintains a small log
which it uses to keep track of which regions are in sync with the mirror. This
log can be kept on disk, which will keep it persistent across reboots, or it
can be maintained in memory. The following command will create a mirrored
logical volume.
[root@rhel6-client1 ~]# lvcreate
-L 100M -m1 -n
mymirrorvol01 myvg01
Logical volume "mymirrorvol01" created
[root@rhel6-client1 ~]# lvdisplay
/dev/myvg01/mymirrorvol01
---
Logical volume ---
LV
Path
/dev/myvg01/mymirrorvol01
LV
Name mymirrorvol01
VG
Name myvg01
LV
UUID
WsnrVm-w3pJ-xHAn-f4ba-7ra1-3TIc-haFvrb
LV
Write Access read/write
LV
Creation host, time rhel6-client1, 2017-03-28 19:00:36 +0530
LV
Status available
#
open 0
LV
Size 100.00 MiB
Current LE 25
Mirrored volumes 2 ççç
Segments 1
Allocation inherit
Read
ahead sectors auto
-
currently set to 256
Block device 253:12
[root@rhel6-client1 ~]# lvcreate
-L 100M -m2 -n
mymirrorvol02 myvg01
Logical volume "mymirrorvol02" created
[root@rhel6-client1 ~]# lvdisplay
/dev/myvg01/mymirrorvol02
---
Logical volume ---
LV
Path
/dev/myvg01/mymirrorvol02
LV
Name mymirrorvol02
VG
Name myvg01
LV
UUID
fsb7im-z96c-1Cec-it8S-u3z8-Iny9-TZDRTj
LV
Write Access read/write
LV
Creation host, time rhel6-client1, 2017-03-28 19:02:29 +0530
LV
Status available
#
open 0
LV
Size 100.00 MiB
Current LE 25
Mirrored volumes 3 ççç
Segments 1
Allocation inherit
Read
ahead sectors auto
-
currently set to 256
Block device 253:17
HOW TO USE THE LV:
We had already created PV-VG-LV
[root@rhel6-client1 ~]# pvs
PV VG
Fmt Attr PSize PFree
/dev/sdb1 vg01 lvm2 a--
5.00g 0
/dev/sdb2 vg01 lvm2 a--
3.00g 0
/dev/sdb3 vg02 lvm2 a--
2.00g 2.00g
[root@rhel6-client1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg01 2
4 0 wz--n- 7.99g 0
vg02 1
0 0 wz--n- 2.00g 2.00g
[root@rhel6-client1 ~]# lvs
LV VG
Attr LSize Pool Origin
Data% Move Log Cpy%Sync Convert
lv02 vg01 -wi-a---- 2.00g
lvol0 vg01 -wi-a---- 1.00g
mylv vg01 -wi-a---- 1.60g
mylv2 vg01 -wi-a---- 3.39g
[root@rhel6-client1 ~]# mkfs.ext4 /dev/vg01/mylv
mke2fs
1.41.12 (17-May-2010)
Filesystem
label=
OS
type: Linux
Block
size=4096 (log=2)
Fragment
size=4096 (log=2)
Stride=0
blocks, Stripe width=0 blocks
104832
inodes, 418816 blocks
20940
blocks (5.00%) reserved for the super user
First
data block=0
Maximum
filesystem blocks=432013312
13
block groups
32768
blocks per group, 32768 fragments per group
8064
inodes per group
Superblock
backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing
inode tables: done
Creating
journal (8192 blocks): done
Writing
superblocks and filesystem accounting information: done
This
filesystem will be automatically checked every 30 mounts or
180
days, whichever comes first. Use tune2fs
-c or -i to override.
[root@rhel6-client1 ~]# mkdir /mylv
[root@rhel6-client1 ~]# mount /dev/vg01/mylv /mylv
[root@rhel6-client1 ~]# df -kh /mylv
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg01-mylv
1.6G 35M
1.5G 3% /mylv
[root@rhel6-client1 ~]# vi /etc/fstab
[root@rhel6-client1 ~]# grep mylv /etc/fstab
/dev/vg01/mylv /mylv ext4
defaults 0 0
REFERENCES & GOOD READ:
No comments:
Post a Comment