Thoroughly Remove Local Storage in Proxmox VE


Problem Description

When adding local storage such as LVM, LVM-Thin, etc., from the Proxmox VE web management interface, there might be occasions when these storage items need to be deleted. However, the web management interface does not provide a menu or button for deletion. To remove these items, you need to operate from the command line of the host system Debian. If any operation is missed, although the storage configuration file “/etc/pve/storage.cfg” in Proxmox VE has been cleaned, the items still appear in the Proxmox VE web management interface, which might be intolerable for perfectionists.

Scope of Application

This operation is only applicable to the operation of single-node local storage and not to Proxmox VE clusters such as Ceph. If there is irreplaceable data on the storage, be sure to back up the data before executing the deletion.

Delete Local Storage

In the Proxmox VE web management interface, Thin-LVM appears in two places: the service view and the “LVM-Thin” menu.

Next, switch to the command line of the host system Debian and proceed with the following steps:

(1) Modify the file “/etc/pve/storage.cfg” and delete the text block related to “vdata.”

Ivmthin: vdata

thinpool vdata

vgname vdata

content images,rootdir

nodes pve99

Save the changes to the “/etc/pve/storage.cfg” file, switch to the Proxmox VE web management interface, and refresh the page to see any changes.

The display in the server view has disappeared, but the display in “Thinpool” still exists. It seems it hasn’t been completely removed, so continue with the next step.

(2) Delete the logical volume. On the host system Debian command line, view the system storage logical volumes with the command “lvs,” and search for the volume name “vdata.”

If it exists, execute the following command to delete it:

root@pve99:/etc/pve# lvremove vdata

Switch to the Proxmox VE web management interface, refresh the page, and see if the display has changed. If all goes well, it should be as expected.

If the disk that was thoroughly deleted needs to be reused, further processing is required; otherwise, there will be no available free disks.

Execute the following command on the system command line to clean it up completely:

root@pve99:/etc/pve# wipefs -a /dev/sda

Then it can be reused.

Delete Local Storage LVM

Compared to Thin-LVM, LVM appears in the same location in the Proxmox VE web management interface.

(1) On the host system Debian command line, modify the Proxmox VE storage configuration file “/etc/pve/storage.cfg” to delete the text lines related to the LVM to be deleted, then switch to the Proxmox VE web management interface to check for changes. Like deleting local Thinpool, one display still doesn’t disappear as expected, so continue with the next step.

(2) View and delete the volume group. Continue to execute on the host system Debian command line with the keyword “vdisk” query, if this volume group exists, then execute the deletion with the following specific commands:

root@pve99:/etc/systemd/system# vgdisplay | grep vdisk

root@pve99:/etc/systemd/system# vgremove vdisk

Switch to the Proxmox VE web management interface again, refresh the page, and the remaining display should completely disappear.

Delete Local Storage “Directory”

Unlike the previous two storage methods, the “Directory” storage has a mount point.

Follow the steps below based on previous experience:

(1) On the Proxmox VE host system Debian command line, modify the storage configuration file “/etc/pve/storage.cfg” to delete the text lines related to “Directory.” Save and refresh the Proxmox VE web management interface to observe changes.

After deletion, there is still residue in the Proxmox VE web management interface, so continue with the next step.

(2) On the Proxmox VE host system Debian command line, execute the following command to unmount the “Directory” storage:

root@pve99:/etc/systemd/system# umount /mnt/pve/mydisk

Continue to refresh the Proxmox VE web management interface, and the display remains unchanged, indicating that the next step is necessary.

(3) On the Proxmox VE host system Debian command line, delete the file “/etc/systemd/system/mnt-pve-mydisk.mount.” You might wonder how I knew to delete this file. I searched it using the keyword “mysqldisk.”

You can also comment out this file, which has the same effect. Refresh the Proxmox VE web management interface again, and the “Directory” display no longer includes “mydisk.”


Leave a Reply

Your email address will not be published. Required fields are marked *