Posts Tagged ‘Linux LVM Mirror’

1. The scenario

On my box I’ve two disks from two differents Storage Disk.

Using multipath I’ve this disks
/dev/dm-15 from Storage Disk A (in use)
/dev/dm-28 from Storage Disk B (not in use yet.)

I’ve the Volume Group with name vg_gfs00 on /dev/dm-15
I’ve the Logical Volume with name lv00 on the Volume Group VG_GFS

Looking my outputs pvs, vgs and lvs

PVS output
# pvs
PV         VG          Fmt  Attr PSize   PFree
/dev/dm-15 vg_gfs00    lvm2 a-   278,98G 39,95G
/dev/sda3  rootvg      lvm2 a-   131,47G 86,19G

VGS output
# vgs
VG          #PV #LV #SN Attr   VSize   VFree
rootvg        1  11   0 wz--n- 131,47G 86,19G
vg_gfs00all   8   7   0 wz--n- 278,98G 39,95G

LVS output
# lvs
LV          VG          Attr   LSize
homelv      rootvg      -wi-ao 512,00M
optlv       rootvg      -wi-ao   1,00G
rootlv      rootvg      -wi-ao   1,00G
tmplv       rootvg      -wi-ao   2,00G
usrlv       rootvg      -wi-ao   4,00G
varloglv    rootvg      -wi-ao   8,00G
varlv       rootvg      -wi-ao   4,00G
lv00        vg_gfs00    -wi-ao 239,03G

2. Objective

Implement a mirror on filesystems for high availbility if my Storage Disk A or B crashs.

3. Implementing

a. Make a PV on new disk (/dev/dm-28)

# pvcreate /dev/dm-28

b. Add new volume on the vg_gfs00

# vgextend vg_gfs00 /dev/dm-28

c. Make a mirror on Logical Volume

# lvconvert -m1 vg_gfs00/lv00 /dev/dm-28
vg_gfs00/lv00: Converted: 17,1%
vg_gfs00/lv00: Converted: 34,1%
vg_gfs00/lv00: Converted: 51,0%
vg_gfs00/lv00: Converted: 68,4%
vg_gfs00/lv00: Converted: 85,5%
vg_gfs00/lv00: Converted: 100,0%

Note: If your LV are in more PVs you can specify all PVs
Sample:

# lvs -a -o +devices | grep lv00
lv00          vg_gfs00 -wi-ao  10,00G     /dev/dm-15(0)
lv00          vg_gfs00 -wi-ao  10,00G     /dev/dm-16(123490)

In this case dm-15 and dm-16 are on my Storage Disk A, I need two disks on the Storage Disk B, sample dm-28 and dm-29.
For convert I use this
# lvconvert -m1 vg_gfs00/lv00 /dev/dm-28 /dev/dm-29

d. Checking Mirror with lvs -a -o +devices

# lvs -a -o +devices | grep vl00
lv00            vg_gfs00 mwi-ao  10,00G       lv00_mlog 100,00         lv00_mimage_0(0),lv00_mimage_1(0)
[lv00_mimage_0] vg_gfs00 iwi-ao  10,00G                                /dev/dm-15(10242)
[lv00_mimage_1] vg_gfs00 iwi-ao  10,00G                                /dev/dm-28(14086)

Looking details:

lv00 is a lv00_mlog and have a 100% of sync to lv00_mimage_0 and lv00_image1.
The lv00_mimage_0 is stored on /dev/dm-15
The lv00_mimage_1 is stored on /dev/dm-28

Looking with a simple lvs

# lvs
LV          VG          Attr   LSize  Origin Snap%  Move Log              Copy%  Convert
homelv      rootvg      -wi-ao 512,00M
optlv       rootvg      -wi-ao   1,00G
rootlv      rootvg      -wi-ao   1,00G
tmplv       rootvg      -wi-ao   2,00G
usrlv       rootvg      -wi-ao   4,00G
varloglv    rootvg      -wi-ao   8,00G
varlv       rootvg      -wi-ao   4,00G
lv00        vg_gfs00    -wi-ao 239,03G              lv00_mlog 100,00

If the lv00_mlog is not 100% you have a problem with one of disks.

4. Documentation:

* http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Cluster_Logical_Volume_Manager/
– 2.3.3. Mirrored Logical Volumes
– 4.4.1.3. Creating Mirrored Volumes
– 6.3. Recovering from LVM Mirror Failure

Anúncios