Home Proxmox How To Add External USB Storage To Proxmox

How To Add External USB Storage To Proxmox

By sk
Published: Last Updated on 11.9k views

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.

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
Fstab Entry To Automount USB Drive On System Reboot
Fstab Entry To Automount USB Drive On System Reboot

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 the dump 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 
List Block Devices
List Block Devices

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.

Login To Proxmox WebUI
Login To Proxmox WebUI

From the Proxmox dashboard, go to Datacenter -> Storage -> Add -> Directory.

Create New Storage In Proxmox
Create New Storage In Proxmox

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.

Add Proxmox Storage Directory
Add Proxmox Storage Directory

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.

New Proxmox Storage Added
New Proxmox Storage Added

You will also see some new sub directories are created under "PVExtStorage" directory in your external drive.

Storage Directories In External USB Drive
Storage Directories In External USB 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.

You May Also Like

1 comment

robergagnon September 16, 2022 - 7:34 am

could be interesting to save directly snapshot to another drive or be able to copy them to another drive

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More