다음 부분에서는 물리 볼륨에 해당하는 기본적인 장치가 정지하여 LVM 미러 볼륨중 하나의 leg가 실패할 경우 이를 복구하는 예를 다루고 있습니다. 미러 leg 실패 경우, LVM은 미러 볼륨을 선형 볼륨으로 전환하여, 미러 중복 없이 이전과 같이 계속 실행되게 합니다. 이 때, 대체 물리 장치로서 사용할 미러를 다시 작성하기 위해 시스템에 새 디스크 장치를 추가할 수 있습니다.
다음의 명령으로 미러로 사용될 물리 볼륨을 생성합니다.
pvcreate /dev/sd[abcdefgh][12]
[root@link-08 ~]# pvcreate /dev/sd[abcdefgh][12]
Physical volume "/dev/sda1" successfully created
Physical volume "/dev/sda2" successfully created
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb2" successfully created
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdc2" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sdd2" successfully created
Physical volume "/dev/sde1" successfully created
Physical volume "/dev/sde2" successfully created
Physical volume "/dev/sdf1" successfully created
Physical volume "/dev/sdf2" successfully created
Physical volume "/dev/sdg1" successfully created
Physical volume "/dev/sdg2" successfully created
Physical volume "/dev/sdh1" successfully created
Physical volume "/dev/sdh2" successfully created
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Copy to ClipboardCopied!Toggle word wrapToggle overflow
예에서 주요 /dev/sda1 미러 leg 작업에 장애가 발생하였습니다. 미러 볼륨에 쓰기 작업을 실행할 경우 LVM이 장애가 발생한 미러를 감지하게 됩니다. 이러한 경우, LVM은 미러를 단일 선형 (linear) 볼륨으로 전환합니다. 전환 작업을 위해 dd 명령을 실행합니다.
dd if=/dev/zero of=/dev/vg/groupfs count=10
[root@link-08 ~]# dd if=/dev/zero of=/dev/vg/groupfs count=10
10+0 records in
10+0 records out
Copy to ClipboardCopied!Toggle word wrapToggle overflow
lvs 명령을 사용하여 현재 장치가 선형 (linear) 장치로 되어 있는 지를 확인할 수 있습니다. 실패한 디스크의 경우 I/O 오류가 발생합니다.
lvs -a -o +devices
[root@link-08 ~]# lvs -a -o +devices
/dev/sda1: read failed after 0 of 2048 at 0: Input/output error
/dev/sda2: read failed after 0 of 2048 at 0: Input/output error
LV VG Attr LSize Origin Snap% Move Log Copy% Devices
groupfs vg -wi-a- 752.00M /dev/sdb1(0)
Copy to ClipboardCopied!Toggle word wrapToggle overflow
이 때 논리 볼륨을 계속 사용할 수 있지만 미러 중복이 없게 됩니다.
To rebuild the mirrored volume, you replace the broken drive and recreate the physical volume. If you use the same disk rather than replacing it with a new one, you will see "inconsistent" warnings when you run the pvcreate command.