The default Proxmox local storage location is /var/liz/vz
. This is where all the Proxmox containers, VMs, and their VZdump backups, ISO images, disk images, snippets and templates are stored. If you run Proxmox on production, you should not keep all containers and VMs in the local disk itself. You must add an additional backup storage to regularly backup Proxmox containers and virtual machines. Just in case if your Proxmox system is crashed, you will still have your containers and VMs. In this brief tutorial, we will see how to add an external USB storage to Proxmox VE.
At the end of this guide, we also included a link that demonstrates how to use the newly added storage to backup the proxmox containers and VMs.
Table of Contents
Preparing External USB Disk As Backup
Make sure your external USB disk has adequate free space to store your Proxmox containers and VMs. For the purpose of this guide, I will be using 1 TB Western Digital external SSD.
First, create the mount point to mount our external USB.
$ sudo mkdir /media/ostechnix/SK_WD_SSD
Replace /media/ostechnix/SK_WD_SSD
with your own mount point.
Format the drive using your preferred filesystem type. I am going to format my drive in exfat
. Expat supports Linux, macOS and Windows.
$ sudo mkfs.exfat -L SK_WD_SSD /dev/sda1
Here, I am using "SK_WD_SSD" as drive label name for the sake of easy remembering. SK is short for my name Senthilkumar, WD is short for Western Digial, and SSD indicates the drive is solid state drive. You can keep any label of your choice.
After formatting the drive, edit your fstab file:
$ sudo nano -Bw /etc/fstab
Here, -B
flag is used to backup original fstab to /etc/fstab~
and -w
flag is used to disable wrap of long lines.
Add the following line to automount the USB drive on system reboot.
[...] LABEL=SK_WD_SSD /media/ostechnix/SK_WD_SSD exfat errors=remount-ro,defaults,users,noatime,nodiratime,umask=0 0 2
Here,
LABEL=SK_WD_SSD
- Drive label name./media/ostechnix/SK_WD_SSD
- Mount point.exfat
- Filesystem type.errors=remount-ro
- Mount the drive in 'read-only' when there is an error.defaults
- Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.users
- Permit any user to mount/unmount the drive.noatime
- Disables writing file access times to the drive every time you read a file.nodiratime
- Disables the writing of file access times only for directories while other files still get access times written.umask=0
- Enable read/write access to all users.0
- This is dump. <dump> is used by thedump
utility to decide when to make a backup. This field is usually set to 0, which disables the check.2
- Sets the order for file system checks at boot time. For the root device, it should be 1. For other partitions, it should be 2.
Press CTRL+O
followed by CTRL+X
to save the file and exit.
Now, run the following command to mount the USB drive:
$ sudo mount -a
Check if the drive is mounted or not with lsblk
command:
$ lsblk -s
Sample output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda1 8:1 0 931.5G 0 part /media/ostechnix/SK_WD_SSD └─sda 8:0 0 931.5G 0 disk sda2 8:2 0 32M 0 part └─sda 8:0 0 931.5G 0 disk nvme0n1p1 259:1 0 512M 0 part /boot/efi └─nvme0n1 259:0 0 465.8G 0 disk nvme0n1p2 259:2 0 464.3G 0 part /run/timeshift/backup └─nvme0n1 259:0 0 465.8G 0 disk nvme0n1p3 259:3 0 976M 0 part [SWAP] └─nvme0n1 259:0 0 465.8G 0 disk
From now on, the external USB drive will be automatically mounted on every reboot.
Please note that if you use Proxmox on a Debian desktop, the USB drive letter path (E.g. /dev/sda1
) may change. This is why you must permanently mount the USB drive using the LABEL name instead of the drive letter path
Create Backup Directory In USB Drive
Create a backup directory to store your Proxmox containers and VMs.
$ mkdir /media/ostechnix/SK_WD_SSD/PVExtStorage
Here, PVExtStorage is a backup directory which is created in my USB drive. Replace it with your own directory name.
We have now mounted the USB drive and created a backup directory in the USB drive. It is time to add a new storage in Proxmox.
Add External Storage To Proxmox
Open Proxmox web UI by navigating to https://proxmox-ip:8006 URL from your browser. Enter the login details.
From the Proxmox dashboard, go to Datacenter -> Storage -> Add -> Directory.
Give a meaningful name for the new storage directory in the "ID" column. In the "Directory" column, enter the actual path of the backup directory that you created in the external usb drive in the previous step. And finally, choose the content types that you want to backup from the Proxmox server from the "Content" drop-down box.
Here, I named the new Proxmox storage as "PVExtStorage" and my backup directory location is "/media/ostechnix/SK_WD_SSD/PVExtStorage/". And, I selected all file types to backup.
That's it. A new storage has been added to the Proxmox server.
You will also see some new sub directories are created under "PVExtStorage" directory in your external drive.
You can now backup your Proxmox containers and VMs to the newly created USB Storage. To know how to backup a Container or VM to an USB drive, please refer the following guide.
Conclusion
In this guide, we looked at how to permanently mount an external storage in Proxmox server, and how to add the external USB storage to Proxmox to backup containers and VMs.
As I stated already, it is important to backup your data regularly. Keeping backups in the same system is not a real backup. You must maintain an offsite backup for production systems.
3 comments
could be interesting to save directly snapshot to another drive or be able to copy them to another drive
I have tried to follow your steps 12 times now on a completely blank WD EXT 1TB HDD (USB) – nothing works. The very first command fails – therefore all the rest of them fail as well.
I am doing this on a PROXMOX 7.3-3 system in the SHELL console. See below – both with and without sudo command.
Linux proxmox01 5.15.74-1-pve #1 SMP PVE 5.15.74-1 (Mon, 14 Nov 2022 20:17:15 +0100) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Dec 18 08:01:55 EST 2022 on pts/0
root@proxmox01:~# sudo mkdir /media/proxmox/WD_EXT_SSD
-bash: sudo: command not found
root@proxmox01:~# mkdir /media/proxmox/WD_EXT_SSD
mkdir: cannot create directory ‘/media/proxmox/WD_EXT_SSD’: No such file or directory
root@proxmox01:~#
You’re probably trying to create the directory under a nonexistent path. Make sure the path
/media/proxmox
exists and try again.