21 December 2014

XenServer: Setup an ISO share

To Create a New Partition 

e.g. Use the Remaining portion of the XenServer Install Disk

  1. Get the current partition table (using a lower case L at the end):
    fdisk –l

If you need a new Partition:

  1. Assuming your install disk is at /dev/sda1 then run the following to get more information:
    gdisk /dev/sda
  2. Print the partition table by entering 'p' at the gdisk command prompt:
    Command (? for help): p
  3. If you need a new partition enter n and accept the defaults:
    Command (? for help): n          
    Partition number (3-128, default 3):
    First sector (34-488327006, default = 16777250) or {+-}size{KMGT}:
    Last sector (16779264-488327006, default = 488327006) or {+-}size{KMGT}:
    Hex code (L to show codes, 0 to enter raw code, Enter = 0700): 
  4. Enter the 'p' command to check your new partition exists
  5. Enter 'w' to save your changes
  6. Reboot
  7. Format it for use as an ISO share:
     mkfs.ext3 /dev/sdaX
    where X is the number

To Use an Existing Disk

Setup a share on your local XenServer to use when installing new VMs:
  1. Run the following to assess your server's setup:
    df -h
  2. Note the ‘large’ sector ending with a GUID and cd to it e.g.
    cd /var/run/sr-mount/<GUID>

Make a Mount Point and Add It to XenServer

  1. Make a mount point:
    mkdir /mnt/isos 
  2. Mount it:
    mount /dev/sda3 /mnt/isos
  3. Check its mounted:
  4. Add it to fstab so it's available on reboot (see Ubuntu's docs for more info):
    echo "/dev/sda3 /mnt/isos ext3 defaults 1 1" >> /etc/fstab
  5. Check the mounting works:
    sudo mount -a
  6. Add it to XenServer:
    • Make it available in XenServer:
      xe-mount-iso-sr /mnt/isos –o bind
    • Create the XenServer point:
      xe sr-create name-label=ISOs type=iso device-config:location=/mnt/isos device-config:legacy_mode=true content-type=iso
      NB: you might need to change the location to:
  7. Check it and view it's UUID:
    xe sr-list

To Delete a Storage Repository

  1. Get the UUID of the SR:
    xe sr-list
  2. Get the PDB UUID of the SR:
    xe pbd-list sr-uuid=[UUID of the SR]
  3. Unplug the PDB using the first UUID returned:
    xe pbd-unplug uuid=[UUID of PDB]
  4. 'Forget' the SR:
    xe sr-forget uuid=[UUID of SR]
  5. Check it's gone:
    xe sr-list

Installing an OS

You can use a remote URL to install e.g. http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/
  1. Put an ISO on the server:
    • Get an ISO e.g
      cd /mnt/isos
      wget http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso
    • or scp one up:
      scp /Users/<username>/Downloads/ubuntu-14.04.1-server-amd64.iso root@
    • Use a program like FileZilla to connect via SFTP
  2. Re scan the archive:
    Find the uuid: xe pbd-list
    xe sr-scan uuid=<sr UUID>


No comments:

Post a Comment