SR 설정 수동 복구를 통한 XenServer 재설치 후 VM 복구 하기

SR 설정 수동 복구를 통한 XenServer 재설치 후 VM 복구 하기

작성일 : 2015년 3월 31일

작성자 : 서진우

시나리오 :

XenServer OS 문제로 XenServer OS 를 재설치 해야한다. 이때 가지고 있는 VM 의 백업 본은 metadata 밖에 없다.

복구방법 :

XenServer 설치 시 Guest Storage를 구성하지 않아 기존의 VM 이 위치한 SR의 실제 데이터 는 보존하고 , XenServer OS 만 새로 설치한다 .

XenServer OS 설치 후 , 기존 XenServer SR 정보를 그대로 반영하여 SR 설정을 기존 상태로 복구한다 .

그런 후 VM export meta 백업 파일을 해당 SR 에 import  시켜서 VM 을 복구 한다 .

 

  1. XenServer 재설치전 작업

 

# pvscan

# cat /proc/partitions

major minor  #blocks  name

7        0      52252 loop0

8        0  878542848 sda

8        1   41942033 sda1

8        2   41942033 sda2

8        3  794655727 sda3

8       16  878542848 sdb

8       32  878542848 sdc

8       48  878542848 sdd

252        0       4096 dm-0

252        1       4096 dm-1

252        2       4096 dm-2

252        3       4096 dm-3

# ls -al /dev/disk/by-id/

합계 0

drwxr-xr-x 2 root root 180  3 월 25 19:04 .

drwxr-xr-x 8 root root 160  3 월 25 19:04 ..

lrwxrwxrwx 1 root root   9  3 월 25 19:04 scsi-36003005701bee8b01bcf61f197dd33e7 -> ../../sda

lrwxrwxrwx 1 root root  10  3 월 25 19:04 scsi-36003005701bee8b01bcf61f197dd33e7-part1 -> ../../sda1

lrwxrwxrwx 1 root root  10  3월 25 19:04 scsi-36003005701bee8b01bcf61f197dd33e7-part2 -> ../../sda2

lrwxrwxrwx 1 root root  10  3월 25 19:04 scsi-36003005701bee8b01bcf61f197dd33e7-part3 -> ../../sda3

lrwxrwxrwx 1 root root   9  3 월 25 19:04 scsi-36003005701bee8b01bcf61f197dd872b -> ../../sdb

lrwxrwxrwx 1 root root   9  3 월 25 19:04 scsi-36003005701bee8b01bcf61f197ddd990 -> ../../sdc

lrwxrwxrwx 1 root root   9  3 월 25 19:04 scsi-36003005701bee8b01bcf61f197de2d2c -> ../../sdd

# sr-uuid

uuid ( RO)                : b701c6ab-7af3-a9e8-68b8-96170b6f8683

name-label ( RW): VDI Storage 1

uuid ( RO)                : a8dcbd67-4832-cf1e-5c08-bbce854d2fa1

name-label ( RW): Local storage

uuid ( RO)                : 520506ae-2830-7381-aa9c-7709f048d4b8

name-label ( RW): VDI Storage 2

uuid ( RO)                : 986c14c2-6498-b5f3-b9aa-3ea7e6da13a7

name-label ( RW): VDI Storage 3

# xe vm-list name-label=<VM_NAME> params=all | grep SR-uuid

suspend-SR-uuid ( RW): b701c6ab-7af3-a9e8-68b8-96170b6f8683

# xe vm-export vm=<vm_name> file-name=<vm_export_file> –metadata=true –multiple ;; 해당 VM이 소속된 SR-uuid 와 SR name-label은 기억해 두길 ..

 

  1. XenServer 재설치

 

XenServer 설치

– Guest Storage 는 절대 잡으면 안된다 .

– XenServer 설치 시 sda 파티션이 새로 생성되기 때문에 sda3 에 적용된 SR 은

복구가 힘들다 . (????)

– xenserver update 는 XenServer 재 설치전 상태와 동일하게 맞춘다.

 

  1. XenServer 재설치후VM 복구

 

# pvscan

PV /dev/sdd   VG VG_XenStorage-986c14c2-6498-b5f3-b9aa-3ea7e6da13a7   lvm2 [837.83 GB / 837.83 GB free]

PV /dev/sdc   VG VG_XenStorage-520506ae-2830-7381-aa9c-7709f048d4b8   lvm2 [837.83 GB / 837.83 GB free]

PV /dev/sdb   VG VG_XenStorage-b701c6ab-7af3-a9e8-68b8-96170b6f8683   lvm2 [837.83 GB / 386.93 GB free]

Total: 3 [2.45 TB] / in use: 3 [2.45 TB] / in no VG: 0 [0   ]

아래 부분을 기억함 . VG_XenStorage-<기존 SR-uuid>

VG_XenStorage-b701c6ab-7af3-a9e8-68b8-96170b6f8683

[root@XS-EDU00 ~]# xe sr-introduce uuid=b701c6ab-7af3-a9e8-68b8-96170b6f8683 type=lvm name-label=”VDI Storage 1″ content-type=user shared=false

b701c6ab-7af3-a9e8-68b8-96170b6f8683

[root@XS-EDU00 ~]#  xe sr-introduce uuid=520506ae-2830-7381-aa9c-7709f048d4b8 type=lvm name-label=”VDI Storage 2″ content-type=user shared=false

520506ae-2830-7381-aa9c-7709f048d4b8

[root@XS-EDU00 ~]#  xe sr-introduce uuid=986c14c2-6498-b5f3-b9aa-3ea7e6da13a7 type=lvm name-label=”VDI Storage 3″ content-type=user shared=false

986c14c2-6498-b5f3-b9aa-3ea7e6da13a7

# ls -l /dev/disk/by-id/

합계 0

lrwxrwxrwx 1 root root  9  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197dd33e7 -> ../../sda

lrwxrwxrwx 1 root root 10  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197dd33e7-part1 -> ../../sda1

lrwxrwxrwx 1 root root 10  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197dd33e7-part2 -> ../../sda2

lrwxrwxrwx 1 root root  9  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197dd872b -> ../../sdb

lrwxrwxrwx 1 root root  9  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197ddd990 -> ../../sdc

lrwxrwxrwx 1 root root  9  3 월 31 10:11 scsi-36003005701bee8b01bcf61f197de2d2c -> ../../sdd

# xe pbd-create sr-uuid=b701c6ab-7af3-a9e8-68b8-96170b6f8683 device-config:device=/dev/disk/by-id/scsi-36003005701bee8b01bcf61f197dd872b host-uuid=2fafca13-fdca-49b9-9a8b-7cffd172af3c

7aeeb3e7-b8a8-268d-f402-89b30372e261

# xe pbd-create sr-uuid=520506ae-2830-7381-aa9c-7709f048d4b8 device-config:device=/dev/disk/by-id/scsi-36003005701bee8b01bcf61f197ddd990 host-uuid=2fafca13-fdca-49b9-9a8b-7cffd172af3c

05b1bb92-93ca-b019-8a89-27ea0000b719

# xe pbd-create sr-uuid=986c14c2-6498-b5f3-b9aa-3ea7e6da13a7 device-config:device=/dev/disk/by-id/scsi-36003005701bee8b01bcf61f197de2d2c host-uuid=2fafca13-fdca-49b9-9a8b-7cffd172af3c

4d5951e5-e38b-fc8c-db88-529df45b7a4a

xe pbd-create 시 반환되는 pbd uuid 를 통해 생성된 pbd 를 활성화 시킨다 .

# xe pbd-plug uuid=7aeeb3e7-b8a8-268d-f402-89b30372e261

# xe pbd-plug uuid=05b1bb92-93ca-b019-8a89-27ea0000b719

# xe pbd-plug uuid=4d5951e5-e38b-fc8c-db88-529df45b7a4a

최종적으로 기존에 백업 받아둔 VM 의 metadata 를 통해 기존 VM 이 존재했던 SR 에 복구 시킨다 .

# xe vm-import metadata=true filename=XENSERVER-TEST01.bak sr-uuid=b701c6ab-7af3-a9e8-68b8-96170b6f8683

f1305b54-1d23-af0a-a298-d3917a5d656d

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

2 Responses

  1. 2022년 6월 22일

    2grafting

  2. 2023년 1월 27일

    3successfully