this post was submitted on 21 Feb 2024
32 points (92.1% liked)

Selfhosted

40018 readers
553 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi. I switched from a few SBCs to a proxmox-server and i really enjoy it. Now - after playing a little bit around - i plugged an external 8tb-hdd on my server mainly for backups. I followed this tutorial: https://ostechnix.com/add-external-usb-storage-to-proxmox/

Next step is to use urbackup. I created a folder /urbackup on the 8tb-hdd and now i would like to assign this folder to the urbackup-docker but i do not understand how to do this.

What "content" do i have to choose for this case and how can i assign the folder to the docker?

Important EDIT: I forgot to mention that i do not use a VM but LXC!

SOLUTION in this case is pretty simple: https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points

For example, to make the directory /mnt/bindmounts/shared accessible in the container with ID 100 under the path /shared, add a configuration line such as:

mp0: /mnt/bindmounts/shared,mp=/shared

into /etc/pve/lxc/100.conf.

Or alternatively use the pct tool:

pct set 100 -mp0 /mnt/bindmounts/shared,mp=/shared

to achieve the same result.

Thanks a lot for your help!

you are viewing a single comment's thread
view the rest of the comments
[–] 4am@lemm.ee 3 points 8 months ago (2 children)

Are you running docker on the PVE host? Or within a LXC container or VM?

Note that running docker on the PVE host is not recommended as this can cause networking problems for both docker and the host+guests

If you are running docker in a VM as is recommended then pass thru the USB drive to that VM, it will act as if it was plugged directly into the VM.

[–] moddy@feddit.de 1 points 8 months ago (1 children)

Ah, ok, i see. In the future i always have to write about the way i host the services on the proxmox. I use onlx LXC's. Also docker is in a LXC.

[–] 4am@lemm.ee 2 points 8 months ago* (last edited 8 months ago)

It would help to be explicit yeah. If only for the reason that sometimes your issue could be caused by the way you set things up.

For reference, I have some LXCs with docker as an experiment( a privileged container with nesting=1 (also fuse=1 and keyctl=1, not sure if those help) and I haven’t had problems, but they’ve never needed a restore. I think unprivileged is where you will run into problems.

For doing what you want, you’ll want to bind mount your external drive. I’d recommend not using drive letter mounts (“/dev/sdc” for example) as those can change across reboots. Instead, use /dev/disk/by-id/ which is the same no matter when the disk is mounted on the host. To make a bind mount, you have to edit the .conf file for your container on the host at /etc/pve/lxc/.conf where the is the container is number and then start the container back up. The disk will then appear in the container mounted at the path you specify. Check out the Proxmox docs for LXC bind mounts for info on how to configure that.