PVE External Drive Backups

From Da Nerd Mage Wiki
Revision as of 15:43, 10 April 2023 by Tinker (talk | contribs) (Created page with "First, need USB drive handling. = A starting point: USBmount = * [https://www.linuxuprising.com/2019/04/automatically-mount-usb-drives-on.html Automatically Mount USB Drives On Ubuntu Or Debian Server With USBmount] ** [https://github.com/rbrito/usbmount USBmount on GitHub] * <code>apt install -y git debhelper build-essential lockfile-progs</code> * <code>mkdir src</code> * <code>cd src</code> * <code>git clone https://github.com/rbrito/usbmount</code> * <code>cd usbmou...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

First, need USB drive handling.

A starting point: USBmount

Taking this a step further

Putting this to use

Note: This involves setting up the drives in advance...

You will need to set them up as GPT / EXT4 and give them matching labels.
Create a new Directory storage device in Datacenter/Storage & point it at the symlink in /var/run/usbmount/

CAVEAT: You will need to disable this device before removing or swapping drives.

(Going to the CLI & telling PVE that this storage is a mountpoint might be the correct solution... pvesm set External -is_mountpoint yes)

AAAnnnddd... PVE STILL seems to do weird shit... If the directory is enabled while the drive is not connected, PVE will create the structure it expects to see on that drive as a folder where the symlink is supposed to be. Needless to say, this is a bit of a problem. When you plug the drive back in, USBmount cannot create the symlink to access the drive.

BTTDB...

  • pvesm set External --disable 1
  • swap drives
  • pvesm set External --disable 0

Seems to do the job at the CLI.

Just need to wait for the symlink to be created. But, that does happen in a script, so...

  • vi /etc/usbmount/mount.d/01_create_label_symlink
    • Add
      • pvesm set $label --disable 0
    • at the end (before the exit 0 line...). This will enable the drive upon connection.

Just need to figure out how to send the disable & let the user know to swap the drives.

  • vi /etc/usbmount/umount.d/00_remove_model_symlink
    • Add
      • pvesm set External --disable 1
    • at the start

This actually seems to function... sometimes... But only if the timing works out that it disables the directory before PVE notices the drive is missing.

TBD

  • Still need to work on making sure Proxmox knows when it's safe to actually backup to it...
    • (IE: detect the backup drive is present & possibly which one of a set it is...)
    • In fact... As long as the directory is disabled while the drive is unplugged, PVE will simply error out the backup & give a message about it.
      • TASK ERROR: could not activate storage 'External': storage 'External' is disabled
    • Which is just fine...
  • How do I actually ensure it's safe to yank the drive?
    • For now... As long as you either disable it in the UI or on the CLI, it's all good. (Doing it in the UI means you have no excuse to fail to see if a backup is in progress too!)