DEV Community

Daniel
Daniel

Posted on • Edited on

Proxmox: How to use a USB drive as storage for your containers

So you have a USB drive that you want to mount to a specific container.

In my case, I want to mount a 10TB USB hard drive (a Seagate Expansion) where I store my media for radarr, sonnar and jellyfin.

Let's get started!

Permanently mount your USB drive

There are several steps you need to follow for a USB device to be permanently mounted to Proxmox. This is, to have it mounted even if the node restarts.

Find the USB device by going to your node -> Disks

Disks in Proxmox node

In my case it's easily identifiable, as I can see a USB device with 10TB of space: /dev/sdb2

Edit the /etc/fstab file

You can use nano or your favorite editor and add the following line to the end of the file:

<file system> <mount point> <type> <options> <dump> <pass>
Enter fullscreen mode Exit fullscreen mode

In my case:

/dev/sdb2 /mnt/expansion xfs defaults,noatime,nofail 0 2
Enter fullscreen mode Exit fullscreen mode

This means that I'm:

  • Mounting the device in /dev/sdb2
  • Mounting it to the route /mnt/expansion in my Proxmox host
  • Mounting it as an xfs file system
  • With the options
    • defaults (enables several standard mount options)
    • noatime (disables updating of file access times on the filesystem)
    • nofail (tells the system to continue booting even if this device cannot be mounted)
  • Dump 0 means the filesystem will not be backed up by the dump utility
  • File system check 2 indicates this filesystem should be checked after the root filesystem

Note: I previously formatted my external drive as xfs before plugging it in to make my life easier since that format is directly compatible with my Proxmox host.

Mount it!

You can either reboot your system or run mount -a to finish mounting your device.

Passing the device to the container

Start by editing the configuration file for your container. Identify your container ID and run:

nano /etc/pve/lxc/<continer id>.conf 
Enter fullscreen mode Exit fullscreen mode

Add this line to the end of the file:

<Mount point id> <Host path>,mp=<container path>
Enter fullscreen mode Exit fullscreen mode

In my case I have:

mp0: /mnt/expansion,mp=/home/media
mp1: /mnt/downloads,mp=/home/downloads
Enter fullscreen mode Exit fullscreen mode

As you can see the mount points are sequential, so be mindful of the id you're choosing if you already have other mount points in your container

Restart your container and you're good to go!

Verify mount points

If you now go to your container resources in the Proxmox GUI you should see your mountpoints being specified there:

Container mount points

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay