[SOLVED] saving backups/dumps to an external usb drive

hjw

New Member
Mar 22, 2024
8
0
1
I'd like to save a backup of a vm to an external drive so that I can move it over to a node in a different location.
How would I do this? I tried creating a zpool on the drive and then a directory dataset but clearly was missing something because it only showed up in the gui as a zfs store and wouldn't let me allocate a directory store from it.
 
Last edited:
Hello again!

Easiest way is just to manually mount (don't add in fstab or in Proxmox storage) an external USB drive / flash key (ext4 formatted or similar) & copy over the files there. Then umount the drive & remove.
 
  • Like
Reactions: waltar and hjw
Hi @hjw

Please try the using USB to backup and restore VM to another location.

To back up a Proxmox virtual machine (VM) to an external drive for migration to another node, follow these steps:

1. Prepare the External Drive:
  • Connect the Drive: Plug in your external USB drive to the Proxmox server.
  • Format the Drive: Format the drive to a Proxmox-supported filesystem, such as ext4. For example:
mkfs.ext4 /dev/sdX1

Replace /dev/sdX1 with your actual device identifier.
  • Label the Drive: Assign a label to the drive for easy identification:
e2label /dev/sdX1 backup_drive
Replace backup_drive with your desired label.

2. Mount the Drive:
  • Create a Mount Point: Create a directory to mount the drive:
mkdir /mnt/backup_drive
  • Mount the Drive: Mount the drive using its label:
mount -L backup_drive /mnt/backup_drive

Automount Configuration: To ensure the drive mounts automatically after a reboot, add the following line to your /etc/fstab:
LABEL=backup_drive /mnt/backup_drive ext4 noauto,x-systemd.automount 0 0
This configuration prevents Proxmox from attempting to back up the drive if it's not connected.

3. Configure Proxmox Storage:
  • Add Directory Storage:
    • In the Proxmox web interface, navigate to Datacenter > Storage.
    • Click Add and select Directory.
    • In the dialog:
      • ID: Enter a name for the storage (e.g., BackupStorage).
      • Directory: Enter the mount path (/mnt/backup_drive).
      • Content: Select "VZDump backup file".
      • Is Mountpoint: Check this option to ensure Proxmox recognizes the directory as a mount point.
    • Click Add to save the configuration.
4. Back Up the VM:
  • Initiate Backup:
    • In the Proxmox web interface, select the VM you wish to back up.
    • Go to the Backup tab.
    • Click Backup now.
    • In the dialog:
      • Storage: Select the storage you configured earlier (BackupStorage).
      • Mode: Choose "Snapshot" for consistent backups.
      • Compression: Select your preferred compression method.
    • Click Backup to start the process.
5. Transfer the Backup to Another Node:
  • Locate the Backup File: On the source Proxmox server, navigate to /mnt/backup_drive/dump/ to find the backup file.
  • Transfer the File: Copy the backup file to the external drive.
  • Connect to New Node: Plug the external drive into the destination Proxmox server.
  • Mount the Drive: Mount the drive as described in steps 2 and 3.
  • Restore the VM:
    • In the Proxmox web interface of the destination server, navigate to Datacenter > Storage.
    • Select the storage where the backup is located.
    • Go to the Backups tab.
    • Select the backup file and click Restore.
    • Configure the restore options as needed and initiate the restoration process.
Other information:
  • Using ZFS for Backups: If you prefer using ZFS, ensure that the external drive is properly configured as a ZFS pool. Create a dataset for backups and verify that it's recognized in the Proxmox GUI. For detailed guidance on setting up ZFS for backups, refer to the Proxmox support forum.
By following these steps, you can back up your Proxmox VMs to an external drive and restore them on a different node, facilitating migration and ensuring data safety.

Please try this and see if it works for you.

Thank you
 
  • Like
Reactions: hjw
Keep in mind, that PVE has a different way of storage for VMs as VMware ESX. There is no "folder" with everything that belongs to a VM, config and vm-disk have different locations, and datastore can be a block device, which has only access via GUi or shell commands.
 
  • Like
Reactions: Johannes S
Hi @hjw

Please try the using USB to backup and restore VM to another location.

To back up a Proxmox virtual machine (VM) to an external drive for migration to another node, follow these steps:

1. Prepare the External Drive:
  • Connect the Drive: Plug in your external USB drive to the Proxmox server.
  • Format the Drive: Format the drive to a Proxmox-supported filesystem, such as ext4. For example:
mkfs.ext4 /dev/sdX1

Replace /dev/sdX1 with your actual device identifier.
  • Label the Drive: Assign a label to the drive for easy identification:
e2label /dev/sdX1 backup_drive
Replace backup_drive with your desired label.

2. Mount the Drive:
  • Create a Mount Point: Create a directory to mount the drive:
mkdir /mnt/backup_drive
  • Mount the Drive: Mount the drive using its label:
mount -L backup_drive /mnt/backup_drive

Automount Configuration: To ensure the drive mounts automatically after a reboot, add the following line to your /etc/fstab:
LABEL=backup_drive /mnt/backup_drive ext4 noauto,x-systemd.automount 0 0
This configuration prevents Proxmox from attempting to back up the drive if it's not connected.
Going to avoid the auto mount instructions since this for an occasionally plugged in usb drive… I already went down that path at one point in this adventure and ended up booting into some flavor of rescue mode, where I had to manually mount the root drive and remove the line in /etc/fstab which referred to the not present external usb.
3. Configure Proxmox Storage:
  • Add Directory Storage:
    • In the Proxmox web interface, navigate to Datacenter > Storage.
    • Click Add and select Directory.
    • In the dialog:
      • ID: Enter a name for the storage (e.g., BackupStorage).
      • Directory: Enter the mount path (/mnt/backup_drive).
      • Content: Select "VZDump backup file".
      • Is Mountpoint: Check this option to ensure Proxmox recognizes the directory as a mount point.
    • Click Add to save the configuration.
4. Back Up the VM:
  • Initiate Backup:
    • In the Proxmox web interface, select the VM you wish to back up.
    • Go to the Backup tab.
    • Click Backup now.
    • In the dialog:
      • Storage: Select the storage you configured earlier (BackupStorage).
      • Mode: Choose "Snapshot" for consistent backups.
      • Compression: Select your preferred compression method.
    • Click Backup to start the process.
5. Transfer the Backup to Another Node:
  • Locate the Backup File: On the source Proxmox server, navigate to /mnt/backup_drive/dump/ to find the backup file.
  • Transfer the File: Copy the backup file to the external drive.
I’m a little confused here; since your instructions have me manually mount the usb drive, and chose it as the storage in the backup window, wasnt the backup saved to my external drive? I ask because I’ve realized that one of my issues has been that I’m backing up a vm running home assistant os and can’t get to a normal Linux command line, only their ha-cli/ this vm.
  • …<snip>…
Other information:
  • Using ZFS for Backups: If you prefer using ZFS, ensure that the external drive is properly configured as a ZFS pool. Create a dataset for backups and verify that it's recognized in the Proxmox GUI. For detailed guidance on setting up ZFS for backups, refer to the Proxmox support forum.

This is really what I’d like to do and what I have not been able to figure out:… how do I setup an external drive as a zpool with a dataset on it that can store backups… I cane wipe the drive, and use zpool create on it from the command line but can’t figure out from the docs how to create a directory based storage on it (which seems to be what I need for the backup gui to offer it as a location to save the backup to.
By following these steps, you can back up your Proxmox VMs to an external drive and restore them on a different node, facilitating migration and ensuring data safety.

Please try this and see if it works for you.

Thank you
Thanks for spelling things out step by step using an ext4 formatted drive. Hopefully you or gng... can explain how to do this with a zfs based external drive.
 
This is really what I’d like to do and what I have not been able to figure out:… how do I setup an external drive as a zpool with a dataset on it that can store backups…
I have already advised you strongly against this. Your aim should be to have a portable storage unit - for transferring the backups. Thus:

1. The external drive should NOT be setup in the Proxmox storage config.
2. The drive should be manually mounted - not automatically.
3. Use a simple ext4 format for that drive. Don't try ZFS - that would be pointless.

For your requirements - you should use your existing (LVM) setup & copy the backups using the CLI to that external drive.
Then install the fresh (ZFS) install to a new disk (preserving the original one) - & finally reattach that external drive to copy back those VM backups.
 
  • Like
Reactions: waltar
It’s a 1tb drive that I intend to use in a “permanent” way on one of these systems. Yes, I could format it as ext4 for this transfer and then reformat it as zfs for use on the machine after the transfer is fine but that seemed like an extra step. That’s why I wanted to understand how to do it with the disk in zfs format
 
External drive - should remain an external drive, that is only used parttime to copy/transfer files. It is best in PVE to not configure an external drive as a server-relied on storage.
 
  • Like
Reactions: waltar
<sigh> ok. I went ahead and reformatted the drive as ext4 and did the backup/restore successfully.
Thanks for the explicit info on how to do that.
I’ll have to come up with other “exercises” to get more comfortable with using zfs.
At least I now, having done the command line mounting and gui creation of data stores, plus clicking on the data store to display to the gui window which shows what’s on the data store, have a little more experience with how the gui works and how the cli interacts with it.
Thanks again
 
Happy you got it working.

At least I now, having done the command line mounting and gui creation of data stores, plus clicking on the data store to display to the gui window which shows what’s on the data store, have a little more experience with how the gui works and how the cli interacts with it.
That is exactly the learning experience I wish for all users. You will see that PVE has a learning curve - but is absolutely master-able!

Maybe mark this thread as Solved. At the top of the thread, choose the Edit thread button, then from the (no prefix) dropdown choose Solved.