[SOLVED] zfs mount to container for access

sbartley

New Member
Dec 30, 2015
10
1
1
45
I need a little help to figure out how to mount my zfs pool to a container. Here's my situation I have a pool with a datatset called /zpool/public.files/tunes and I would like to mount it to /mnt/tunes in container 100 which is Plex.
 

Hi, I came across this post while trying to figure out how to mount my zfs pool to a container. I have already been through that link and mounting regular directories works great, my issue now is that I cannot see the content of the subvolumes inside the mount (in the container).

My pool is like:

root@pve:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
pool 2.73T 2.47T 170K /pool
pool/local 1.58G 2.47T 170K /mnt/local_storage
pool/local/git 1.58G 2.47T 1.58G /mnt/local_storage/git
pool/shared 2.73T 2.47T 11.2G /mnt/shared_storage
pool/shared/backups 1.16T 2.47T 610G /mnt/shared_storage/backups
pool/shared/files 47.0G 2.47T 47.0G /mnt/shared_storage/files
pool/shared/games 568G 2.47T 568G /mnt/shared_storage/games
pool/shared/media 882G 2.47T 879G /mnt/shared_storage/media
pool/shared/os 62.1G 2.47T 62.1G /mnt/shared_storage/os
pool/shared/software 38.5G 2.47T 38.5G /mnt/shared_storage/software
pool/shared/temp 526K 2.47T 298K /mnt/shared_storage/temp
...

In my .conf file I added "mp0: /mnt/shared_storage,mp=/mnt/storage" as described in the link and I can see the /mnt/storage as well as all the subvolumes inside it (backups, files...), the issue is that they are all empty. If I mount the subvolume itself (like I did for "pool/shared/media" in my plex container), I can see all the files inside it.

Is there any option for some kind of a recursive bind mount or something?
 
Is there any option for some kind of a recursive bind mount or something?

You simply mount everything you need on the host side. You then see the same inside the container. That is
how bind mounts work.

You can also use a zfs storage driver and create and mount subvolumes individually (instead of bind mounts)
 
You simply mount everything you need on the host side. You then see the same inside the container. That is how bind mounts work.

Well, all my subvolumes are already mounted and I can access everything on the host side, it's the content of the subvolumes that are not passed to the container.

Or you mean, bind mount each subvolume in the .conf?

mp0: /mnt/pool,mp=/mnt/pool
mp1: /mnt/pool/subvol1,mp=/mnt/pool/subvol1
mp2: /mnt/pool/subvol2,mp=/mnt/pool/subvol2
...
 

Thanks I have it working now but I need to complicate this just a little more. I would like to share the same folders that i mounted across the network so that I can add, and edit files and folders. I know I could turn samba on and let zfs share the datasets but I would only like to do this if there is not other way to share the mounted datasets. I conifguring samba config file but not luck however here's what I have done.

mounted and works perfectly with plex
mp0: /zpool/public.files/music,mp=/music

This is what I have in my samba config file with a few other changes but it doesn't seem to work
[MUSIC]
comment = music
path = /music
browsable = yes
guest ok = yes
read only = no
create mask = 0755
 
Bind mounts are not recursive, so you need to include mountpoints "inside" bind mounts in the config separately.
 
Thanks guys, I added a separate bind for each subvolume and it is working as expected.

mp0: /mnt/pool,mp=/mnt/pool
mp1: /mnt/pool/subvol1,mp=/mnt/pool/subvol1
mp2: /mnt/pool/subvol2,mp=/mnt/pool/subvol2
...

@sbartley, you and I seem to have a similar set up. Here is a nice guide by quidsup I followed to set up samba share http://quidsup.net/tutorials/?p=ubuntu-create-nas, you can just copy and paste the config and change the user name. My zfs pool is on Proxmox itself but I got samba running in a container (hence i needed to pass all the subvolumes to it), where are you running samba?
 
  • Like
Reactions: sbartley
Thanks guys, I added a separate bind for each subvolume and it is working as expected.

I took a slightly different route. I created a plex container with all the mounted datasets then I created another container for a fileserver and installed samaba and webadmin. I still have a few tweaks but it seems to be working almost like I want and similar to the guide you posted, I wish you would have posted this earlier before all the heartburn from trying to get this to work. :D:D
 
  • Like
Reactions: pro lamer
I took a slightly different route. I created a plex container with all the mounted datasets then I created another container for a fileserver and installed samaba and webadmin. I still have a few tweaks but it seems to be working almost like I want and similar to the guide you posted, I wish you would have posted this earlier before all the heartburn from trying to get this to work. :D:D

just an FYI, in case you did not see it, there is a great TurnKey FileServer container available in Proxmox.
just download the template, setup and turn on. add your bind mounts to it and you are done.
it runs Webmin, Webmin SAMBA and WebDAV already. last version is Debian 8.
I love it. I am playing with it on my test setup , but it seems a perfect fit for my real server setup.
just need to figure out how to pass through the webDAV to outside so I can access the data remotely.
I am building a Proxmox based pfSense router (yes very strange idea :) ) so that is probably what will route the connections.
 
  • Like
Reactions: pro lamer

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!