I was going to install Citrix XenServer 7.0 on a USB device on a newly bought server. I thought it was plug-and-play, but as it turns out – its not. As default the installer wont let you install on such a small device. Here is a short how-to install XenServer on a small USB device.
So, i only got a 8 GB USB drive and that seems to be enough as long as you run your virtual machines on other disks or over iSCSI or FibreChannel (thats probally going to be iSCSI/FibreChannel since you have no internal disks to install the hypervisor on).
Download the XenServer hypervisor install from the XenServer download page.
You need an USB device (or CD, but pfff, who uses that anymore?) for the installation media. I always use Rufus to convert the .iso file into a bootable USB device. That progress is pretty straight forward.
You’ll also need the USB device that XenServer will be installed on. For a good matter of fact i did a “clean” on the USB device before getting started (In Windows do: cmd as admin, diskpart, select disk <number of disk>, clean, exit, exit).
So, now we’re ready for the install. How hard can it be, lets install!
Well, erhm, nope. You’ll have to hack the install first. Otherwise you’ll get an error like “The new partition table could not be written”, “hex() argument can’t be converted into hex” (that might be because you’re trying to create a partitions for VMs to be on) or an mke2fs error that “Could not stat /dev/sda1 — no such file or directory”.
To do the install, when the installation starts and you get the first screen you’ll have to be quick and type “shell” and then press enter. The system now boots into the shell where we’re able to make the hack.
When the OS is loaded, edit the file constants.py file:
Find the following lines and change them to the below. First of all, you need to make a change so it uses MBR instead of GPT. Then you need to make change to how large the partitions should be. Make ajustment to match your USB device size. The sizes are in MB.
Im not sure why all of them need changes – for example, why is it “_old” for the root partition that needs to be changed? (you can try just to change the root_size, but it wasnt enought for me).
GPT_Support = False
root_mbr_size_old = 4096
root_mbr_size = 4096
root_gpt_size_old = 4096
root_gpt_size = 4096
backup_size = 4096 (not sure if this is needed, heck it was larger than the usb device; so changed.)
swap_size = 1024
logs_size = 1024
Now start the setup again by running the init file:
Now just follow the instructions on the screen. Remember that you’re installing on a USB device (probally usb 2.0) so it’s going to take a good amount of time for the install to complete.
When its done – you’re done! Unplug the USB and boot the server. When “rebooting” from the setup, you’ll get to the shell. Just type the command “reboot”.
Happy virtualizing! :->
After installing on this 8 GB disk im getting reports that local storage is at 95%. It sure is. But why is it only at 2.5G? To be updated (or well, i might just buy an 32/64GB usb device :-))
[root@xen01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2.5G 2.2G 135M 95% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 2.0G 48K 2.0G 1% /dev/shm
tmpfs 2.0G 1.1M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
xenstore 2.0G 0 2.0G 0% /var/lib/xenstored
/dev/loop0 55M 55M 0 100% /var/xen/xc-install
tmpfs 393M 0 393M 0% /run/user/0