Gmorks Wiki
CitrixXenServer

RestoreStorage

How to restore local storage on the soft raid, after fresh install/reinstall xenserver ?
Here it is ! The necessary steps how to do it :-)

Scenario:

/dev/sda - new disk for xenserver
/dev/sdb and /dev/sdc = /dev/md0 - linux RAID1

IMPORTANT: When you will perform instalation of the xenserver UNCHECK any kind of the configuration of the /dev/sdb and /dev/sdc !
To avoid broke your riad array !

So after successful installation we can assemble old storage with your VM disks, so follow....

To assemble raid and check LVM status in console type;

mdadm --assemble /dev/md0 /dev/sdb /dev/sdc
mdadm --detail --scan > /etc/mdadm.conf
pvscan
vgscan
lvscan

Now, when raid and LVM system is ready and set up, find old uuid of the lost storage on the /dev/md0:

xe sr-probe device-config:device=/dev/md0 type=lvm

You should get lost UUID. Introduce SR:

xe sr-introduce content-type=user name-label="Local RAID1" shared=false uuid=bf69e2c5-29a8-d8d8-c2d7-a8d8ee3d84fc type=lvm

Next step is to create PBD: (where host-uuid is UUID of the our new xenserver host)

xe pbd-create sr-uuid=bf69e2c5-29a8-d8d8-c2d7-a8d8ee3d84fc host-uuid=a3850ab4-fa47-4823-8d1b-c5dbddc3af45 device-config:device=/dev/md0

You will get printed new UUID of the PBD created to the console, so plug it !:

xe pbd-plug uuid=8c913b43-8eef-3088-ced1-22d9a0356ff5 

That is all :-) You should see in the XenCenter your lost storage with your VM disk images :) Enjoy.