28 August 2016

XenServer: Re-attach Existing or Create Local Storage

To re-attach existing storage e.g. when you've done a destructive upgrade of XenServer and have the OS on one drive and some VMs on another one, or when you need to create it

These are my notes from other posts here and here.

To Create a Repository

  1. List the paritions:
    cat /proc/partitions
  2. List the disks by id and match your parition to the scsi-<some UUID>
    ll /dev/disk/by-id
  3. Create the storage repository
    1. Get the host id
      xe host-list
    2. Create the SR:
      xe sr-create content-type=user device-config:device=/dev/disk/by-id/<scsi...> host-uuid=<host-uuid> name-label=”Local Storage 2” shared=false type=lvm

To Connect a Storage Repository

  1. Find the state of the physical drives:
    or: cat /proc/partitions
  2. Use the returned 'VG Name' to introduce it to XenServer:
    xe sr-introduce uuid=<VG Name UUID> type=lvm name-label="Local storage 2" content-type=user
  3. Connect the physical block device (PBD) with the SR:
    1. Get the host's UUID
      xe host-list
    2. Get the device name:
      ls -l /dev/disk/by-id
      You need one ending -part1,2 etc
    3. Connect the device:
      xe pbd-create host-uuid=<host UUID> sr-uuid=<VG Name UUID> \ device-config:device=/dev/disk/by-id/<device name>
    4. Plug in the new disk
      xe pbd-plug uuid=<UUID>

To Remove a Repository

  1. Find the UUID
    xe pbd-list
  2. Remove it
    xe pbd-unplug uuid=<device UUID>
  3. Remove it:
    xe sr-forget uuid=<sr-UUID>
    NB: this is the sr-uuid not the uuid

No comments:

Post a Comment