remove and delete a hard drive from xenserver

From thelinuxwiki
Jump to: navigation, search

Example... delete SR named "datastore1"

Determine the Storage-Repository-UUID:

# xe sr-list | grep -B 1 -A 5 "datastore1"
uuid ( RO)                : 74ab942a-6746-04ba-0c88-f364d8ad10a0
         name-label ( RW): datastore1
   name-description ( RW): 
               host ( RO): xenner
               type ( RO): lvm
       content-type ( RO): user

Find the corresponding Physical Block Device (PBD):

# xe pbd-list sr-uuid=74ab942a-6746-04ba-0c88-f364d8ad10a0
uuid ( RO)                  : 3b9c149b-1ab7-557d-953c-46664dcc1cfc
            host-uuid ( RO): 89568def-9ecf-44e4-ae21-35e353c40c82
              sr-uuid ( RO): 74ab942a-6746-04ba-0c88-f364d8ad10a0
        device-config (MRO): device: /dev/disk/by-id/scsi-SATA_WDC_WD20EARS-00_WD-WMAZA2044059
   currently-attached ( RO): true

Unplug the PBD:

# xe pbd-unplug uuid=3b9c149b-1ab7-557d-953c-46664dcc1cfc

Delete PBD:

# xe pbd-destroy uuid=3b9c149b-1ab7-557d-953c-46664dcc1cfc

Delete the association of your SR and the PBD:

# xe sr-forget uuid=74ab942a-6746-04ba-0c88-f364d8ad10a0

Done. It will have gone poof in XenCenter after the last command.