[SOLVED] How to remove Datastore (Directory)

Rotzbub

Member
Sep 18, 2020
11
6
8
30
Hi,
Proxmox
Backup Server 1.0-1

Put in a new Disk. Create Directory and add as Datastore.
  1. I can not find a way to remove a Datastore (in GUI)
    # proxmox-backup-manager datastore remove store1

    "Note: The above command removes only the datastore configuration. It does not delete any datafrom the underlying directory."
  2. The underlying directory is still available and I cannot find a way to delete this.
    even if I unmount/plug the disk it is still there.
How can I use the disk (again) to create a 'new' datastore ?
 
Hi,
How can I use the disk (again) to create a 'new' datastore ?

So you created a datastore on a disk and what to recreate one on the same, forgive me if I ask but why so?
After all, you'd get the same thing again.
 
Hi,


So you created a datastore on a disk and what to recreate one on the same, forgive me if I ask but why so?
After all, you'd get the same thing again.
I created a Datastore via: Administration - Storage/Disks - Directory - Create: Directory - (checked "add as Datastore")

I cannot delete the Directory which is using the dev uuid and marking the disk 'in use'. eg:
  • want to rename the Directory
  • use another filesystem
  • decided to create a zfs (single disk)
  • upgrade to zfs (mirror)
  • ...
The disk is marked as in use and listed in Directory (Storage/Disks)
 
Ok. Some things like renaming can often done without recreating everything, that's why I asked.

If you want to clear the disk completely (delete all data on it again), you can zap the disk:

Bash:
# WARNING: below is dangerous, wipes disk partitions, use with care!
sgdisk --zap-all /dev/sdX

Replace the /dev/ path with the respective device, triple check you got the right one and hit enter. After that, it should be useable again for creating a new storage+datastore with it.
 
Last edited:
  • Like
Reactions: carlosericel
Thanks for the quick reply! I can use the disk again.

Still:
  • how to rename the Directory path it is using
  • after sgdisk --zap-all /dev/sdX the Directory ist still listed in "Storage/Disks - Directory" as /mnt/datastore/<name>
 
  • Like
Reactions: Mevlock
Just re-checked and we have actually already support for that in the API, and there are some patches from a colleague open for review to add it to the web interface.

For now, as workaround please delete the systemd mount unit manually,for that execute:
systemctl disable mnt-datastore-<id>.mount

where the ID is the datastore ID of that mount you used, it needs to be escaped though, so either use CLI autocompletion to get it or the systemd-escape <my-id> command to get the escaped version of your ID.
 
  • Like
Reactions: Rotzbub
Just re-checked and we have actually already support for that in the API, and there are some patches from a colleague open for review to add it to the web interface.

For now, as workaround please delete the systemd mount unit manually,for that execute:
systemctl disable mnt-datastore-<id>.mount

where the ID is the datastore ID of that mount you used, it needs to be escaped though, so either use CLI autocompletion to get it or the systemd-escape <my-id> command to get the escaped version of your ID.
Thank you. This solves my problem.
 
I use this lil script to remove a datastore located on a extern USB device.
Parameter is the Datastore Name

#!/bin/bash
error=$(proxmox-backup-manager datastore remove $1 2>&1 >/dev/tty)
if [ "$error" == "" ]
then
systemctl restart proxmox-backup proxmox-backup-proxy
fi
pfad=$(mount | awk "/$1/ {print "'$3'"}")
if [ "$pfad" != '' ]
then
error=$(zpool export $1 2>&1 >/dev/tty)
if [ "$error" == "" ]
then
rm -r $pfad
fi
fi

Important ! .. Dont run it from build in GUI Shell use SSH /Putty to run it.
 
systemctl restart proxmox-backup proxmox-backup-proxy
That breaks/interrupts all current incoming backup jobs and more, always use systemctl try-reload-or-restart ...
But it shouldn't be required anyway...
 
Thx, in a prior version of PBS "zpool export" didnt work without.
Tested on 1.0-11 and works without

Script changed to

error=$(proxmox-backup-manager datastore remove $1 2>&1 >/dev/tty)
if [ "$error" == "" ]
then
pfad=$(mount | awk "/$1/ {print "'$3'"}")
if [ "$pfad" != '' ]
then
error=$(zpool export $1 2>&1 >/dev/tty)
if [ "$error" == "" ]
then
rm -r $pfad
fi
fi
fi

Script to attach i use

#!/bin/bash
txt=$(zpool import)
pool=$(echo "$txt" | awk '/pool:/ {print $2}')
state=$(echo "$txt" | awk '/state:/ {print $2}')
if [ "$state" == "ONLINE" ]
then
zpool import -f $pool
pfad=$(mount | awk "/$pool/ {print "'$3'"}")
if [ "$pfad" != "" ]
then
echo "
datastore: $pool
path $pfad" >> /etc/proxmox-backup/datastore.cfg
fi
else
echo $state
fi
 
So more than a year later and no way to delete an existing datastore from pbs?

Above comment:

where the ID is the datastore ID of that mount you used, it needs to be escaped though, so either use CLI autocompletion to get it or the systemd-escape <my-id> command to get the escaped version of your ID.

didn't make much sense to me anyways... so any help would be appreciated..

With a GUI, you should think deleting, adding a datastore should be trivial.. Guess it still is not..

Also still can't get any nfs share to be used as a datastore which is odd in 2022.

>> anyway.. proxmox-backup-manager datastore remove <name> worked
 
Last edited:
I see it now. But I do feel tricked by the extremely odd and non-intuitive placement of the button. I guess this isn't meant for normal users.
On my screen, it's way off to the right where my eye would not normally go.
 

Attachments

  • Screenshot from 2022-10-13 13-41-53.png
    Screenshot from 2022-10-13 13-41-53.png
    87 KB · Views: 232
Last edited:
  • Like
Reactions: pmra

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!