How to remove a storage repository.
Hi,
This entry describes how to remove a Xen storage repository from a XenServer 4.1 Server.
Removal of a Storage repository may be needed after damage to the disk has occured or when organising one or more xen servers in a custom setup.
When trying to remove a SR, you might encounter nasty error messages like:
[root@jeremy ~]# xe pbd-destroy uuid=4c057786-4fd3-eefa-c098-39a2e9eabbf2
You attempted an operation that was not allowed.
reason: PBD is currently attached
[root@jeremy ~]# xe sr-forget uuid=d22f5ac3-4f8d-cb7c-85ed-eb32288d8371
The SR is still connected to a host via a PBD. It cannot be destroyed.
sr: d22f5ac3-4f8d-cb7c-85ed-eb32288d8371 (Local storage)
So here is a small explanation on how to really remove your repository.
First of all, find the uuid of your Storage repositiry using "xe sr-list"
uuid ( RO) : e98c3da7-14f7-c2ae-3a15-c50965244cc9
name-label ( RW): storage
name-description ( RW):
host ( RO): jeremy.firstserved.net
type ( RO): lvm
content-type ( RO): disk
Now search the corresponding PBD entry using "xe pbd-list":
uuid ( RO) : 4c057786-4fd3-eefa-c098-39a2e9eabbf2
host-uuid ( RO): 38e2b381-697d-4a11-971d-53ed1dcecd72
sr-uuid ( RO): e98c3da7-14f7-c2ae-3a15-c50965244cc9
device-config (MRO): device: /dev/drbd0
currently-attached ( RO): true
As you can see, the SR (Storage Repository) can easily be tracked using the uuid.
Now unplug the PBD from the SR:
xe pbd-unplug uuid=4c057786-4fd3-eefa-c098-39a2e9eabbf2
This allows you to either forget or destroy the SR:
xe sr-destroy uuid=e98c3da7-14f7-c2ae-3a15-c50965244cc9
As you can see, the storage repository has been removed from the system:
[root@jeremy ~]# xe sr-list
uuid ( RO) : b7060810-f98f-ddfc-2c1a-e829570ed373
name-label ( RW): Removable storage
name-description ( RW):
host ( RO): jeremy.firstserved.net
type ( RO): udev
content-type ( RO): disk
uuid ( RO) : b89f976a-46e3-3e88-febd-685d624cffa3
name-label ( RW): XenServer Tools
name-description ( RW): XenServer Tools ISOs
host ( RO): jeremy.firstserved.net
type ( RO): iso
content-type ( RO): iso
uuid ( RO) : 861138a5-f359-74a7-93f1-c20fbdb1c8a0
name-label ( RW): DVD drives
name-description ( RW): Physical DVD drives
host ( RO): jeremy.firstserved.net
type ( RO): udev
content-type ( RO): iso
Greets,
Koen