In this article we describe how you can remove a Storage Repository (SR) on XenServer / XCP-ng host when the Storage Repository is experiencing issues, all from the command line interface. A Storage Repository is used to store Virtual Machine (VM) Virtual Disks (VDIs) or Operating system ISO files.

The Storage Repository is connected to XenServer or XCP-ng host through a Physical Block Device (PBD) which contains the configuration for the Storage Repository. For this operation you’ll need access to the host terminal console, via SSH or serial interface.

Login to your XenServer or XCP-ng Virtualization host:

ssh [email protected]_or_xcp-ng_ip

Once you have a terminal access list all available Storage repositories:

# xe sr-list

You can filter the output using grep command, in this example we extract ISO Library repository information:

# xe sr-list  | grep "ISO library" -B 1 -A3
uuid ( RO)                : a52e773e-a46f-6998-9029-01e8058b954b
          name-label ( RW): NFS ISO library
    name-description ( RW): NFS ISO Library []
                host ( RO): xcp-node-01
                type ( RO): iso

As seen from the output this is an NFS storage repository on

Run the following command to find the UUID of the PBD. The SR UUID should match the results from xe sr-list for a specific SR being worked on.

xe pbd-list sr-uuid=<UUID of SR>


# xe pbd-list sr-uuid=a52e773e-a46f-6998-9029-01e8058b954b
uuid ( RO)                  : 7ea64444-a7ac-f113-da47-e47570fd17fe
             host-uuid ( RO): d58b8b54-114d-43c7-8d32-988bde2d352b
               sr-uuid ( RO): a52e773e-a46f-6998-9029-01e8058b954b
         device-config (MRO): nfsversion: 4; type: nfs_iso; location:
    currently-attached ( RO): true

This gives you UUID of the PBD.

You’ll need to disconnect the PBD before you detach or remove the Storage Repository from the XenServer host. Run the following command to unplug PBD:

# xe pbd-unplug uuid=<UUID of PBD>

# In my case this will be:
# xe pbd-unplug uuid=7ea64444-a7ac-f113-da47-e47570fd17fe

You can now remove storage repository by running the following command:

# xe sr-forget uuid=<UUID of SR>

In my setup this will be:

# xe sr-forget uuid=a52e773e-a46f-6998-9029-01e8058b954b

Executing above command is equivalent to right clicking the Storage Repository on the XenCenter Interface and selecting Forget.

The same process can be performed from XenCenter or Xen Orchestra web interface.