2011/02/11

LVMのミラーリングを作ってみた。

HDDを冗長化するためにmdadmのRAID1ではなくLVMのミラーリングを試してみる。
まずはPhysicalVolumeとVolumeGroupを作成。
# pvcreate /dev/sd[bcd]
  Physical volume "/dev/sdb" successfully created
  Physical volume "/dev/sdc" successfully created
  Physical volume "/dev/sdd" successfully created
# vgcreate testvol /dev/sd[bcd]
  Volume group "testvol" successfully created
# pvs
  PV         VG      Fmt  Attr PSize   PFree
  /dev/sdb   testvol lvm2 a-   931.51G 931.51G
  /dev/sdc   testvol lvm2 a-   931.51G 931.51G
  /dev/sdd   testvol lvm2 a-   931.51G 931.51G
# vgs
  VG      #PV #LV #SN Attr   VSize VFree
  testvol   3   0   0 wz--n- 2.73T 2.73T
LogicalVolumeは-mオプションを指定して作成。
# lvcreate -L 5GB -m 1 -n testlog testvol
  Logical volume "testlog" created
# lvs -a -o +devices
  LV                 VG      Attr   LSize Origin Snap%  Move Log          Copy%  Convert Devices                                
  testlog            testvol mwi-a- 5.00G                    testlog_mlog 100.00         testlog_mimage_0(0),testlog_mimage_1(0)
  [testlog_mimage_0] testvol iwi-ao 5.00G                                                /dev/sdb(0)                            
  [testlog_mimage_1] testvol iwi-ao 5.00G                                                /dev/sdc(0)                            
  [testlog_mlog]     testvol lwi-ao 4.00M                                                /dev/sdd(0)
/dev/sdbと/dev/sdcでミラーリングされているらしい。
/dev/sddはログらしいけど、これがなくなったらどうなるのやら。
というわけで実験してみましょう。

0 件のコメント:

コメントを投稿