[SOLVED] Proxmox: How to assign diskspace (a folder) on a new hdd to a docker
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!
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
For a VM you have to either add a virtual disk image on the external drive (will be fixed size, cannot use existing data), or share the folder on the host via NFS and mount it in the VM with the NFS client.
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/<find-your-disks-id-and-put-it-here> 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/<vmid>.conf where the <vmid> 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.
Is this urbackup-docker in a VM or an LXC? If the latter, you don’t need to add it in storage at all; you can bind mount the folder and use it directly. Here’s some info on that. If it’s in a VM and you want to use the directory directly (as in not just make a disk image inside the directory to pass as a block device) you’ll have to do some file sharing to the VM.