How to use USB storage for backup/restore

Mar 24, 2022
23
8
8
I've been trying to Google the "how-to" for USB backup & restore with Proxmox. I'm not sure I'm having a lot of success. I have tried a few things too.

To do a backup is easy:
* insert USB storage
* Datacenter/<node>/Disks/Directory then "Create: Directory" and I can create a "Directory" using the USB storage to put backups on.

This is where it starts to get a bit .. "interesting" ...

To remove it from Proxmox I need to go to the command line:
Bash:
$ pvesm set <volname> -disable 1
$ umount /dev/sdb1

But the restore (elsewhere is a bit baffling.) e.g.
* insert USB storage
* Cannot "Create Directory"

I tried a "quick" add but that didn't work...
Bash:
$ pvesm add dir myname --path /dev/sdb1
create storage failed: mkdir /dev/sdb1: File exists at /usr/share/perl5/PVE/Storage/Plugin.pm line 1735.

However if I go the long way:
Bash:
$ mount /dev/sdb1 /mnt/pve/myname
$ pvesm add dir myname --path /mnt/pve/myname --content backup

Then the list of VM backups shows up correctly under "backups" if I click on the volume.

Again making the USB stick ready for removal requires manually unmounting:
Bash:
$ umount /mnt/pve/myname

But the volumes still show up under "pvesm status"
Code:
Name              Type     Status           Total            Used       Available        %
myname             dir   disabled               0               0               0      N/A

Now to clean up I need to manually remove that:

Bash:
$ pvesm remove myname

Is this it? The best way to achieve pluggable USB storage for backup/restore?
 
I'm not the most experienced. But it seems to be a good way. I did exactly the same. What makes me feel unsafe is the point, where it comes to creating the new "directory" on the same HDD. There could be a hint in the GUI, saying something about data being deleted / not deleted by this procedure. Creating a basic structure on a volume always feels like erasing everything.