Changes RSS

====== Installing Citrix XenServer from and to USB ====== This document will in time provide instructions for: * Installing Citrix XenServer from USB stick * Installing Citrix XenServer to USB stick The difference is significant: the first uses USB flash as an install media while installing to existing disks, while the second installs onto USB flash so that local disk storage is not needed on your XenServer. The document is written as I am doing the installs, and as a result, only the first, installing from USB, will be here initially... ===== Installing Citrix XenServer from USB ===== This is a description of how to create a XenServer installer on a USB flash drive. The required tools are: * the XenServer 5.5 install CD ISO file [[|(Download)]] * A USB flash drive, minimum 1GB * A linux system to do the preparations on. I am using a Ubuntu system, thus my commands will be littered with "sudo". If you are on a system that does not use sudo, or prefer working as root (please don't), simply log in, or su to root, and run the commands without the "sudo"... What is presented here is not novel research, it is based directly on the following articles: * * This method makes the USB flash drive a native installer, as opposed to the alternative method, which is to use [[|UNetbootin]]. For a brief description of that method, look to [[|this article on xenappblog]]. ==== Identify your USB flash drive ==== Plug in your USB Flash drive, and identify the device names allocated to it by usb-storage. Two alternative ways of doing this is to look in /dev/disk, and looking at your kernel output. Looking in /dev/disks: $ ls -l /dev/disk/by-id/ | grep usb lrwxrwxrwx 1 root root 9 2009-12-08 16:54 usb-TDKMedia_Trans-It_07930C12126D-0:0 -> ../../sdd lrwxrwxrwx 1 root root 10 2009-12-08 16:54 usb-TDKMedia_Trans-It_07930C12126D-0:0-part1 -> ../../sdd1 lrwxrwxrwx 1 root root 9 2009-12-08 16:14 usb-USB_DISK_2.0_ZOTWKIC9SAVIOWL2-0:0 -> ../../sdh lrwxrwxrwx 1 root root 10 2009-12-08 16:14 usb-USB_DISK_2.0_ZOTWKIC9SAVIOWL2-0:0-part1 -> ../../sdh1 This shows me my USB-attached disks, some identifying data, and the device-names. I suggest making sure only one is attached during this process, to ensure that you don't mistakenly run commands with the wrong device. In this output, I am interested in the data at the end of the two last lines, the USB-stick I will be using is assigned /dev/sdh and has one partition, /dev/sdh1 Looking at kernel output: $ dmesg [output cut] [1735768.124211] usb 1-3: new high speed USB device using ehci_hcd and address 19 [1735768.258629] usb 1-3: configuration #1 chosen from 1 choice [1735768.262290] scsi8 : SCSI emulation for USB Mass Storage devices [1735768.263067] usb-storage: device found at 19 [1735768.263070] usb-storage: waiting for device to settle before scanning [1735773.251305] usb-storage: device scan complete [1735774.492179] scsi 8:0:0:0: Direct-Access USB DISK 2.0 0604 PQ: 0 ANSI: 0 CCS [1735774.504372] sd 8:0:0:0: [sdh] 3981312 512-byte hardware sectors (2038 MB) [1735774.505495] sd 8:0:0:0: [sdh] Write Protect is off [1735774.505499] sd 8:0:0:0: [sdh] Mode Sense: 43 00 00 00 [1735774.505501] sd 8:0:0:0: [sdh] Assuming drive cache: write through [1735774.508363] sd 8:0:0:0: [sdh] 3981312 512-byte hardware sectors (2038 MB) [1735774.509488] sd 8:0:0:0: [sdh] Write Protect is off [1735774.509491] sd 8:0:0:0: [sdh] Mode Sense: 43 00 00 00 [1735774.509493] sd 8:0:0:0: [sdh] Assuming drive cache: write through [1735774.509496] sdh: sdh1 Quite a bit more information here, but the net result is the same. It allows me to identify the correct USB flash drive, and the device names assigned to it: /dev/sdh with one partition, /dev/sdh1 === Optional: backup the MBR of the stick === Should you want to, or need to, restore your USB stick to use as a regular flash drive, you may need to restore the original Master Boot Record onto it. The easiest way is to have an MBR backup available, and that implies that you'll have to make the backup before proceeding. $ sudo dd if=/dev/sdh bs=512 count=1 of=USB_drive_MBR-backup.bin ==== Disable hotplugging of removable drives ==== This is for Ubuntu users with automounting enabled. This needs to be off! System -> Preferences -> Removable Drives and Media. Unselect the following choices: * Mount removable drives when hot-plugged * Mount removable media when inserted * Browse removable media when inserted After completing the process, you may well re-enable this. ==== Partition the Flash drive ==== Using the partitioner of your choice, create the following setup on the drive: Two FAT16 partitions, one of 600MB size, the other filling the rest of the drive. This is the sequence for doing this using plain old fdisk: sudo fdisk /dev/sdh * List the partition table to be sure you are seeing the correct drive * p * Remove existing partitions. Normally your stick contains one.. * d 1 * Create a 600Mb primary bootable partition: * n p 1 <enter> +600M * Define as FAT 16: * t 6 * Make the partition active and thus bootable: * a 1 * Create another partition for Linux Client, filling the rest of the drive: * n p 2 <enter> <enter> * Define this also as FAT 16: * t 2 6 * Print partition table: * p * Write partition table to the USB disk: * w You may want to unplug and plug back in the drive to make sure the kernel picks up on the new partitioning. This is by no means needed, it's just a cautionary step. ==== Make new MBR, filesystems, and prep with syslinux ==== We need lilo to write a working MBR to the flash drive. Your system most likely runs grub(8), so you'll have to install lilo to perform this step. Note that you are only installing the software package. Please do not replace grub with lilo as your boot loader. $ sudo apt-get install lilo DO NOT RUN liloconfig(8) $ sudo lilo -M /dev/sdh Create valid VFAT filesystems on the partitions you created: $ sudo mkfs.msdos -n xenserver /dev/sdc1 $ sudo mkfs.msdos -n client /dev/sdc2 The -n option sets a FAT volume label on the partitions. Now, install and use syslinux to set up the basic boot structure: $ sudo apt-get install syslinux $ sudo syslinux -sf /dev/sdh1 That concludes the base prep'ing of the flash disk. ==== Mount the USB flash drive, and the XenServer ISO ==== Next, we prepare for the transfer of the install image onto the flash drive by mounting both the ISO and the Flash drive. Create a directory as a mount-point for both. I prefer using /mnt for all manual mounts, that is more familiar to me, and avoids confusion with automount's in /media... $ sudo mkdir /mnt/target $ sudo mkdir /mnt/source Next, do the actual mount. Naturally, we mount the flash-drive as our target. We loop-mount the ISO directly, no need to put that on a disc just to get at the data.. $ sudo mount /dev/sdh1 /mnt/target/ $ sudo mount -o loop FREE_XenServer-5.5.0-install-cd.iso /mnt/source/ ==== Copy the installer to the drive ==== The following is a slightly advanced, but more reliable way of saying "copy everything that starts with a letter or number recursively"... $ sudo cp -r /mnt/source/[a-zA-Z0-9]* /mnt/target/ Now, the source is an isolinux-based CD image. We need to change what we copied over into a syslinux format. This is basically as simple as renaming everything that has "isolinux" in it to have "syslinux" instead. We also have to move the location of the XenServer CD isolinix folder to the root of the flash drive.. $ sudo mv /mnt/target/boot/isolinux/ /mnt/target/syslinux $ sudo rename 's/isolinux/syslinux/' /mnt/target/syslinux/isolinux.* ==== Unmount ==== Preparations are basically complete for the install image it self, so it is time to unmount it. Simply do that as you should be used to: $ sudo umount /mnt/source/ $ sudo umount /mnt/target/ ==== Additional tools ==== If you wish to install the Linux Tools/templates as well, at the time of installing your XenServer, simply dump the data from the -linux-cd.iso onto the second partition created on the flash drive. $ sudo mount -o loop FREE_XenServer-5.5.0-linux-cd.iso /mnt/source/ $ sudo mount /dev/sdh2 /mnt/target/ $ sudo cp -r /mnt/source/[a-zA-Z0-9]* /mnt/target/ When the installer asks you if you want to install additional tools, accept, and verify the media. The installer will automagically use the second partition.