Jails' mounted folders' sub-datasets don't work

Status
Not open for further replies.

quantumnerd

Dabbler
Joined
May 26, 2013
Messages
14
I installed FreeNAS 9.1.0-RELEASE and set up a jail in which I installed Deluge and mounted my home directory (/mnt/wdpool/matt) to the jail's /mnt . Everything seemed to work fine, until I tried downloading, and noticed that even though the file showed up inside the jail under /mnt/torrents, it didn't show up inside /mnt/wdpool/matt/torrents . I investigated further. Even though the initial mount had made everything in my home directory visible to the jail, changes in most places below the root of my home directory didn't seem to sync across. But changes made inside the .ssh folder would.

Basically: any changes made inside my mounted home dir's torrent dataset don't sync. But any changes made inside my mounted home dir's .ssh folder do.

The simple workaround for this is for me to structure my data so that every dataset I want to torrent into is mounted separately. As long as they don't have datasets underneath, there won't be problems. But is this broken behavior?
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Child datasets aren't mounted with the parent. You're seeing normal behavior.
 

quantumnerd

Dabbler
Joined
May 26, 2013
Messages
14
Did some digging, found some mailing-list arcana that I can't quite understand: http://lists.freebsd.org/pipermail/freebsd-jail/2011-June/001563.html (I tried to reproduce it myself "on paper" but the passed-through command I think mount_nullfs should generate shouldn't be a mount point that doesn't exist on the original filesystem... I'm probably doing the calculations wrong). So it looks like at the FreeBSD level, this is expected behavior.

(Side question: if these child datasets aren't mounted, why are the contents of child datasets that were present at mount time browsable?)

Knowing that child datasets aren't properly mounted with the parent, I'll work around this behavior-- but it's still a bit odd. The average user probably expects dataset/zvol hierarchies to act as if they're folder hierarchies-- being able to initially browse the mounted child datasets perpetuates that idea. And it's common for users of Transmission to want to torrent into the whole FS/their whole home directory, which means that users will often try to mount something that contains child datasets. Basically, they'll do what I did and fail. I think I should add a note to the documentation in http://doc.freenas.org/index.php/Adding_Jails#Adding_Storage to warn against this pitfall.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Datasets are mounted outside the jail just like in the jail. They need a folder to act as the mount point. You can hide data this way by putting the secrets in a directory and then mounting something over the secret dir. It's not good security, but it'll fool plenty.

So when you mount a parent dataset in a jail, you'll see the placeholder directories as well as any files directly inside the dataset. Any sub folders that aren't datasets will be there with their appropriate sub-folders as well.

That's what you're seeing as a “partially” mounted dataset.

The proper way to handle this is to mount any child datasets as well, though you'll probably have to create the nested target folders within the jail and make sure your datasets are ordered properly in the storage section or you'll end up hiding them in the jail, as discussed near the start of this post.
 

quantumnerd

Dabbler
Joined
May 26, 2013
Messages
14
That makes sense. Basically, the datasets have to be mounted to their proper places regardless of whether they're inside the jail or out, and I've just forgotten to mount them that way inside the jail.

The proper way to handle this is to mount any child datasets as well, though you'll probably have to create the nested target folders within the jail and make sure your datasets are ordered properly in the storage section or you'll end up hiding them in the jail, as discussed near the start of this post.
I was planning to mount my datasets (/mnt/wdpool/matt/<dataset>) instead of the parent dataset (/mnt/wdpool/matt), since each dataset needs to have a mount point (I could mount the parent dataset as well, but I don't need it). I'm not sure what you mean by "create the nested target folders within the jail" and "make sure your datasets are ordered properly in the storage section," though. Isn't it enough for every dataset to have its own mount point?
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
That comment was for if you wanted the children to show up inside the parent, which you aren't doing now.
 

quantumnerd

Dabbler
Joined
May 26, 2013
Messages
14
That comment was for if you wanted the children to show up inside the parent, which you aren't doing now.


All right, thanks! Everything is working now.

For future reference though (and the docs), if I were to mount the parent and then mount the children to the existing placeholder directories, everything would be accessible, right? Not sure what you mean by creating the folders (the placeholders already exist) or ordering the datasets (I'm not sure where ordering comes into this).
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Ordering so the parent is mounted and then the children. If you mount in the other order (child, then parent) the placeholder wouldn't be there (unless you created it first) and the parent would hide it anyway.

their -> there ** gah
 
Status
Not open for further replies.
Top