Article 4PWRM mount --bind with source directory on ZFS

mount --bind with source directory on ZFS

by
King Arthur
from LinuxQuestions.org on (#4PWRM)
I am running Debian Stretch (x64) and have a ZFS dataset mounted at /home_nobackup and another one at /home. The second one is backed up regularly.

Output from 'cat /proc/mounts':

my_zfs_pool/home /home zfs rw,noatime,xattr,noacl 0 0
my_zfs_pool/home_nobackup /home_nobackup zfs rw,noatime,xattr,noacl 0 0

I'm trying to add a non backed up subdirectory for a user that is used for ftp connections with chroot to the home directory. Because of chroot I cannot used a symbolic link. So I decided to use a bind mount:

mount --bind /home_nobackup/ftp/upload/ /home/ftp/upload/

This seems to produce the desired result. But checking /proc/mounts I only get the following additional entry:

my_zfs_pool/home_nobackup /home/ftp_otr/upload zfs rw,noatime,xattr,noacl 0 0

The source directory seems to only contain the ZFS dataset and the subdirectory on this dataset is missing. Is this the expected behaviour and can I safely ignore the wrong output from mtab?

I wanted to copy this entry to the fstab, but it won't work withthe wrong source directory and type=ZFS. If I manually add a bind entry to fstab the directories '/home/ftp' and '/home/ftp/upload'
are created during reboot and ZFS fails to mount on /home as the directory is not empty.

What is the correct way to make a bind mount from a directory on ZFS persistent?latest?d=yIl2AUoC8zA latest?i=63pewTQY67o:oqqlCBeDwMc:F7zBnMy latest?i=63pewTQY67o:oqqlCBeDwMc:V_sGLiP latest?d=qj6IDK7rITs latest?i=63pewTQY67o:oqqlCBeDwMc:gIN9vFw63pewTQY67o
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments