Clicky

20120521

Running Xenserver from a USB stick

UPDATE 31-Mar-2015: It seems that running XenServer from a USB stick is now supported by the XenServer installer. At least from XenServer 6.5 the procedure below is not necessary anymore.

Usually Xenserver is installed on a local harddisk. That and other disk(s) are used to store and run the Virtual Machines. This article is explaining how to create a bootable/runnable Xenserver on a USB stick. You save costs (harddisk and power) and gain on reliability.

What do you need?

1. A USB stick of 16GB or higher capacity (~EUR 13,00)
2. Xenserver installation CD/DVD (in this article is the Xenserver 6.0.2 installation CD used)

How do you make Xenserver run on a USB stick?

3. Disconnect all internal drives except the CD/DVD ROM player.
4. Plug the USB stick in the PC and boot from the Xenserver installer CD/DVD.
5. Install Xenserver on the USB stick. Check the device name of the USB stick on the size shown in the menus.
6. When ready reboot and start again from the Xenserver CD. Leave the USB stick in the PC

7. Issue the next command in the console:

# cat /proc/partitions

You get a list of disks. Note the disk with three partitions (e.g. sda, sda1, sda2 and sda3). Use the first partition of that disk (in this example /dev/sda1) for the next set of commands.

8. Issue the next set of command. Note: version numbers can differ:

# mkdir /target
# mount -t ext3 /dev/sda1 /target
# mount proc /target/proc -t proc
# mount sysfs /target/sys -t sysfs
# mount --bind /dev /target/dev
# chroot /target
# cd /boot
# ls –al


Check now the current filenames/versions and replace the accodingly filenames below.


# mv initrd-2.6.32.12-0.7.1.xs5.6.100.323.170596xen.img initrd-2.6.32.12-0.7.1.xs5.6.100.323.170596xen.img.old
# mkinitrd --with-usb initrd-2.6.32.12-0.7.1.xs5.6.100.323.170596xen.img 2.6.32.12-0.7.1.xs5.6.100.323.170596xen
# exit
# sync
# reboot

9. Remove de Xenserver installation CD/DVD and configure the BIOS to boot from the USB stick.

Source: http://support.citrix.com/article/CTX130111

UPDATE (6-Oct-2012): XenServer 6.1 upgrade:
Boot from the XenServer 6.1 installation media and select the Upgrade option.
Execute the Upgrade and reboot from XenServer 6.1 installation media again
Issue the commands above, remove the XenServer 6.1 installation media and you have completed the XenServer 6.1 upgrade to USB boot device.

UPDATE (4-Aug-2013): XenServer 6.0.2 to  6.2.0 upgrade:
I made a 'dd' copy from the old Xen 6.0.2. memory stick since I wanted to replace the Xen 6.0.2 USB stick anyway. Reason for that is that Xen regularly read/write to the USB stick and I do not know how much. Writing (much) will 'wear and tear' the flash memory to a point that it won't accept new writes.
I used the copied stick for a plain-vanilla upgrade that worked well. I re-applied the USB boot support and everything is running fine on Xen Server 6.2 again





13 comments :

  1. works perfectly for me with XenServer 6.1 on HP ProLiant BL460c G7 Blades.
    Thank you

    ReplyDelete
  2. I can confirm that this still works with 6.2!
    I just tied it on a HP DL380e G8 and it's running like a dream, thanks heaps!

    ReplyDelete
  3. Works great on XenServer 6.2 :) Just a few things i want to add to the instructions to make it a little clearer.

    This should be added to step 6:
    Press F2 when "Welcome to XenServer" appears, then type "shell" and press ENTER. This will take you to the console.

    This should be added to step 8:
    Ignore the "no job control in this shell" message that comes up after you type "chroot /target"

    Optionally, if using "ls -a" is a bit hard to read, you can go for "ls -A", which will only list the file names.

    ReplyDelete
  4. Works great on 6.2, but I have a question (concern?). After running updates (specifically SP1) Xen made a new initrd image, and I needed to go in with the install disc and recreate it again --with-usb. Do you know of any way to make this automated during all initrd generations, or have any other ideas for a workaround?

    ReplyDelete
  5. @Lyndon

    If you add:

    alias scsi_hostadapter1 usb_storage

    to your /etc/modprobe.conf the next time mkinitrd is called, whether it is from a service pack, update, etc- it will automatically include the usb_storage module necessary to boot from USB.

    ReplyDelete
  6. @Frank Ellis
    Confirmed. After adding 'alias scsi_hostadapter1 usb_storage' to /etc/modprobe.conf on a USB booted XENserver 6.2.0, services packs and updates install correct, maintaining USB boot support.

    Thank you for this tip!

    ReplyDelete
  7. I Follow these instructions and works ok BUT the usb device sometimes in distincs moments goes down and crash the system. And no log are avaliable because the file system doesnt exists

    ReplyDelete
  8. Use another (good quality!) USB stick.

    ReplyDelete
    Replies
    1. Same thing happens to me and I'm using a brand new Kingston usb3 drive for this....

      Delete
  9. Can you configure this so that the local HDDs can be used for logging and crash dumps? It seems like you wouldn't want to log to the USB.

    ReplyDelete
  10. In a professional environment, this method is recommended than hard disk install?

    ReplyDelete
    Replies
    1. Yes, especially when servers are diskless and running off of a SAN for example. You can read more on SD booting HP servers here: http://h20195.www2.hp.com/v2/GetPDF.aspx%2F4AA4-9872ENW.pdf

      Delete
  11. Well, that depends on the quality of your memory stick (some fail fairly fast), the performance of the console, space and energy to have a hard disk. I
    MHO, if you do not have to much mutations and/or in Xenserver stand-alone mode, use a USB stick. You can always move to hard disk if required.

    ReplyDelete

Real Time Web Analytics