Solved Datasets and mountpoints - chicken and egg problem?

Greetings all,

I would like to separate my data from the /usr data-sets/hierarchy structure and at the same time to mount the data-set containing the data at /usr/home/myname.

However, since the script creates the data-set system/data during the FreeBSD installation, the user with myname does not exist; consequently, the mount-point /usr/home/myname does not exist.

I cannot find any information, whether I can have the script to execute:
Code:
zfs create -o mountpoint=/usr/home/myname system/data
and the data-set will be mounted once I create the user:
Code:
adduser myname
which creates the mount-point /usr/home/myname. Or, whether I need to initially have the script to execute:
Code:
zfs create -o mountpoint=none system/data
and then remount the data-set:
Code:
zfs mountpoint=/usr/home/myname system/data
after the mount-point /usr/home/myname has been created.

Thank you for any help in this matter.

Kindest regards,

M
 
I'm not sure I fully understand what you're trying to do here...

I would like to separate my data from the /usr data-sets/hierarchy structure and at the same time to mount the data-set containing the data at /usr/home/myname.

However, since the script creates the data-set system/data during the FreeBSD installation, the user with myname does not exist; consequently, the mount-point /usr/home/myname does not exist.
Easy solution: don't rely on the script to set up your hierarchy for you but instead drop to a shell and set the whole thing up manually. Make sure to mount the new hierarchy under /mnt (if I remember correctly) and if you're using a filesystem setup which doesn't mount automatically (such as UFS) you also need to provide a suitable fstab in the /tmp directory.

Note: this is all from mind, it's been a while since I used the actual installer.
 
Hi ShelLuser,

tank you for the answer, but I am not sure how does it help with my quandary.

First, I am not using an installer, I start my script from an installer shell, and the script still has to execute the commands in order. BTW, the topic is marked as zfs.

Could you please clarify?

Kindest regards,

M
 
First, I am not using an installer, I start my script from an installer shell, and the script still has to execute the commands in order. BTW, the topic is marked as zfs.
Then I still fail to see what the actual problem is.

When you add a user then you don't necessarily have to create a home directory; you can also point it to an existing directory. So there should be no problem with creating system/data first and then later refer to that when you're creating the users. For example by using pw(8) instead of adduser. See the useradd option for pw which can use the -d parameter.
 
Hi ShelLuser,

it appears that I cannot communicate my question correctly. Let me try to restate it.

I certainly can create the system/data data-set. But, what should be the mount-point for the system/data data-set? Can it be the /usr/home/myname, since at this point of time the /usr/home/myname does not yet exist? Or, do I initially mount the system/data data-set at
Code:
mountpoint=none
and after I create the user and the associated /usr/home/myname, remount form
Code:
mountpoint=none
to
Code:
mountpoint=/usr/home/myname

Kindest regards,

M
 
I cannot find any information, whether I can have the script to execute:
Code:
zfs create -o mountpoint=/usr/home/myname system/data
and the data-set will be mounted once I create the user:

The mountpoint is created when the dataset gets mounted. If you create a directory /usr/home/myname beforehand, you'd hide that underneath the mounted zfs dataset because FreeBSD doesn't support overlay mounts like e.g. illumos.

As long as the parent directory exists, the dataset will be mounted at the specified mountpoint. You can also create datasets with invalid mountpoints; ZFS doesn't care, these datasets just can't/won't be mounted automatically if the mount points parent directory is non-existent.
 
Hi sko,

thank you very much, the second paragraph clarifies my question.

Thank you also for the clarification re overlay mounts. When experimenting, I was confused about data in the /usr/home/myname disappearing/reappearing when mounting/unmounting the system/data.

Kindest regards,

M
 
Back
Top