View previous topic :: View next topic |
Author |
Message |
tenspd1370 Tux's lil' helper
Joined: 14 Dec 2017 Posts: 119
|
Posted: Thu Oct 18, 2018 11:35 pm Post subject: zfs / nfs / fstab - bind mount occurs to early [solved] |
|
|
Hi all -
I have my root file system on a SSD, and my home data in a zfs pool. I need to share my home directory over nfs. I have nfs configured right as I can mount my home directory on a client device. So, the directory structure looks like this:
Code: | /home (SSD)
|
|/<user> (mounted from ZFS import rpool/HOME/<user>, mountpoint is set as /home/<user>)
/export
|
|/home
|
|/<user>
|
Code: |
fstab
PARTLABEL=boot /boot vfat noauto,noatime 1 2
PARTLABEL=rootfs / ext4 noatime 0 1
PARTLABEL=swap none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
/home /export/home none rw,bind 0 0
/home/<user> /export/home/<user> none rw,bind 0 0
|
(Sorry I couldn't get the spacing right....)
Code: |
exports
/export *(rw,async,fsid=0,insecure,no_root_squash)
/export/home *(rw,async,nohide,insecure,no_root_squash)
/export/home/<user> *(rw,async,nohide,insecure,no_root_squash)
|
(I know it is open to the world, when I figure this out, I will lock it back down)
What seems to happen is the bind mount of my user directory happens before zfs mounts it, so it appears empty in the /exports directory. I verified this by creating a file on the client and having it show up in /export/home/<user>. After I remove it and redo the bind moutn and restart nfs on the server and client it then is correct - /export/home/<user> mirrors /home/<user>, and /home/<user> on the client is correct.
How can I ensure that zfs has run and mounted /home/<user> on the server before the /export/home/<user> bind mount is done?
Thanks!
[Moderator edit: added [code] tags to preserve output layout. -Hu]
Last edited by tenspd1370 on Wed Oct 24, 2018 3:51 pm; edited 1 time in total |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Fri Oct 19, 2018 4:02 am Post subject: |
|
|
Do you use openrc or systemd?
In case of openrc (mount -a), the mounting should happen in order of the fstab file.
In case of systemd, the mounting can happen in random order unless you write .mount units with corresponding dependencies. |
|
Back to top |
|
|
tenspd1370 Tux's lil' helper
Joined: 14 Dec 2017 Posts: 119
|
Posted: Fri Oct 19, 2018 6:02 am Post subject: |
|
|
I use openrc. Another thing I stumbled onto after I posted this was that I may need the 'crossmnt' option on the root of my exports (/export in this case). I'll give that a try when I get back to work, particularly since I should be following the order specified in my fstab. |
|
Back to top |
|
|
tenspd1370 Tux's lil' helper
Joined: 14 Dec 2017 Posts: 119
|
Posted: Fri Oct 19, 2018 3:31 pm Post subject: |
|
|
Hmm - crossmnt doesn't seem to be the problem. When I reboot and check /exports/home/<user> on the server, it is empty. When I unmount it and remount it, it mirrors /home/<user> on the server. Somehow zfs and bindmount isn't playing nicely together.... |
|
Back to top |
|
|
tenspd1370 Tux's lil' helper
Joined: 14 Dec 2017 Posts: 119
|
Posted: Fri Oct 19, 2018 3:48 pm Post subject: |
|
|
I think what did it was adding
Code: |
rc_need="zfs-mount"
|
to /etc/conf.d/localmount
That seems to make it work. I hope that if his is wrong, someone will let me know. I am still trying to research and understand exactly the order things get mounted in. I understand that the order is what is listed in fstab, but even my fstab lists '/boot' before '/', so that may be an oversimplification....?
Thanks! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|