このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
01_linux:99_その他:17_lvm_mirror [2015/04/03 02:13] – [確認方法] matsui | 01_linux:99_その他:17_lvm_mirror [2020/01/14 09:34] (現在) – matsui | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== 17 LVMミラー ====== | ||
+ | ===== PV作成 ===== | ||
+ | <code console> | ||
+ | # pvcreate --metadatasize 50M /dev/vdc /dev/vdd /dev/vde /dev/vdf | ||
+ | </ | ||
+ | |||
+ | ===== VG作成 ===== | ||
+ | |||
+ | <code console> | ||
+ | # vgcreate VG01 /dev/vdc /dev/vdd /dev/vde /dev/vdf | ||
+ | </ | ||
+ | |||
+ | ===== ミラーLVM作成 ===== | ||
+ | <code console> | ||
+ | lvcreate --type raid1 -L 1G -n lvraid1 VG01 | ||
+ | lvcreate --type raid5 -L 1G -n lvraid5 VG01 | ||
+ | lvcreate --type raid10 -L 1G -n lvraid10 VG01 | ||
+ | </ | ||
+ | |||
+ | ==== 確認方法 ==== | ||
+ | |||
+ | <code console> | ||
+ | # lvs -a -o +devices | ||
+ | LV | ||
+ | lvraid1 | ||
+ | [lvraid1_rimage_0] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rimage_1] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rmeta_0] | ||
+ | [lvraid1_rmeta_1] | ||
+ | </ | ||
+ | |||
+ | === LVMミラーの復旧方法 === | ||
+ | |||
+ | === 1.正常な状態 === | ||
+ | |||
+ | <code console> | ||
+ | # lvs -a -o +devices | ||
+ | LV | ||
+ | lvraid1 | ||
+ | [lvraid1_rimage_0] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rimage_1] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rmeta_0] | ||
+ | [lvraid1_rmeta_1] | ||
+ | </ | ||
+ | |||
+ | === 2.片方のディスクを外す === | ||
+ | |||
+ | 今回はディスクが壊れた事を想定して、ddでゼロ書きしました。 | ||
+ | |||
+ | <code console> | ||
+ | # dd if=/ | ||
+ | dd: writing `/ | ||
+ | 655361+0 records in | ||
+ | 655360+0 records out | ||
+ | 5368709120 bytes (5.4 GB) copied, 13.1572 s, 408 MB/s | ||
+ | </ | ||
+ | |||
+ | |||
+ | LVSで確認すると下記の状態になっている。 | ||
+ | <code console> | ||
+ | # lvs -o +devices -a | ||
+ | Couldn' | ||
+ | LV | ||
+ | lvraid1 | ||
+ | [lvraid1_rimage_0] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rimage_1] VG01 iwi-aor-p- 1.00g | ||
+ | [lvraid1_rmeta_0] | ||
+ | [lvraid1_rmeta_1] | ||
+ | </ | ||
+ | |||
+ | === 3.壊れたディスクを外す === | ||
+ | |||
+ | |||
+ | <code console> | ||
+ | # vgreduce --removemissing VG01 --force | ||
+ | </ | ||
+ | |||
+ | |||
+ | LVSで確認すると下記の状態となる。 | ||
+ | <code console> | ||
+ | # lvs -o +devices -a | ||
+ | LV | ||
+ | lvraid1 | ||
+ | [lvraid1_rimage_0] VG01 iwi-aor--- 1.00g / | ||
+ | [lvraid1_rimage_1] VG01 vwi-aor-r- 1.00g | ||
+ | [lvraid1_rmeta_0] | ||
+ | [lvraid1_rmeta_1] | ||
+ | </ | ||
+ | |||
+ | === 4.新しいディスクを用意 === | ||
+ | |||
+ | pvcreate | ||
+ | <code console> | ||
+ | # pvcreate /dev/vde | ||
+ | </ | ||
+ | |||
+ | vgに追加 | ||
+ | <code console> | ||
+ | # vgextend VG01 /dev/vde | ||
+ | </ | ||
+ | |||
+ | === 5.LVミラーに追加 === | ||
+ | |||
+ | 一度ミラー化を解消 | ||
+ | <code console> | ||
+ | # lvconvert -v -m 0 VG01/ | ||
+ | </ | ||
+ | |||
+ | 再度新たなディスクでミラー化 | ||
+ | <code console> | ||
+ | # lvconvert -v --type raid1 -m 1 VG01/ | ||
+ | </ | ||
+ | |||
+ | === 6.正常にミラー化された事を確認 === | ||
+ | |||
+ | <code console> | ||
+ | # lvs -a -o +devices | ||
+ | LV | ||
+ | lvraid1 | ||
+ | [lvraid1_rimage_0] VG01 Iwi-aor--- 1.00g / | ||
+ | [lvraid1_rimage_1] VG01 Iwi-aor--- 1.00g / | ||
+ | [lvraid1_rmeta_0] | ||
+ | [lvraid1_rmeta_1] | ||
+ | </ | ||
+ | |||
+ | |||
+ | {{tag> |