Recently, I have been using XenServer to run a small cloud instance, this has been great but there are a few things you can’t just do with the XenCenter GUI. One of these, was to control and manage an extra externally attached hard drive.
There are reasons why you might want to attach a locally attached drive to a XenServer installation, without putting it in as a Storage Repository. In my case I want to back up data to an external drive (attached via eSata). The idea here is to make the XenServer see this drive as as a removable storage device.
Most of my servers use an ISCSI based SAN, but for backups I don’t want to back up to the same device, plus I want to be able to remove and swap the backup around so adding an extra, external disk is the perfect answer.
To get XenServer to recognise the drive, we need to create some extra symlinks in the /dev tree, this is managed by udev when USB and SATA drives are attached.
In my case, my new drive shows up as sdb, so we add the following lines to /etc/udev/rules.d/50-udev.rules – note, you can do this multiple times if you want to attach multiple drives. Once this has been added, reboot your server and you are ready to roll.
ACTION=="add", KERNEL=="sdb", SYMLINK+="xapi/block/%k", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
ACTION=="remove", KERNEL=="sdb", RUN+="/bin/sh -c '/opt/xensource/libexec/local-device-change %k 2>&1 >/dev/null&'"
Be First to Comment