SCALE: datasets created in runtime are bogus

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
Is this normal?
We have a dataset /mnt/tank/backups

* We use a container with a hostmapping -> /mnt/tank/backups = /host/backups
* We start the container and also use the "shell" feature


* in truenas we create a new dataset /mnt/tank/backups/new
* In the container shell we see a directoy /host/backups/new
* In the container: touch /host/backups/new/created_in_container
* On the truenas host, notice the folder is EMPTY
* On the truenas host: touch /mnt/tank/backups/new/created_on_host
* In the container, notice the file "created_on_host" does not exist


* in truenas we create plain folder: mkdir /mnt/tank/backups/normal_folder
* In the container shell we see a directoy /host/backups/normal_folder
* In the container: touch /host/backups/normal_folder/created_in_container
* On the truenas host, notice the file does indeed exists


It seems TrueNAS/ZFS is faking a folder if we create a new dataset. However the "mapping" is fake. The data is actually stored in the container and thus get lost on shutdown.
I find this quite dangerous. If this is "normal" can we create some seatbelts? Because this not obvious to end users.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Traversing a filesystem boundary isn't something that's likely to end well in a jail/container situation (under either flavor of TrueNAS)

It's not so much that the "mapping is fake", but more like the contents of the "new" dataset aren't available to the container, so it's forced to play with a directory within itself instead.

If you don't want that to happen, you'll need to create the dataset before the container and map that host path in also.
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
If it just did not work it would be acceptable. But now i create a dataset in truenas. The jail shows directly a directory. So, everything seems fine. If it did not create the directory it would also be acceptable. But the new directory is actually /dev/null (runtime). Only if the dataset exists *before* starting the container it works.

I think i did the same for CORE and jails. They did not behave like this.
I really think we should try to seat belt this, if possible.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
But now i create a dataset in truenas. The jail shows directly a directory.
Because a directory is created in which to mount the dataset... the problem (which does also exist in jail mounts) is that that directory is empty in the container, but has the dataset mounted on the host.

I wouldn't be entirely sure that the contents aren't actually on the host in the parent, just obfuscated by the mounted dataset. (could be tested easily by unmounting that dataset)
 

MisterE2002

Patron
Joined
Sep 5, 2015
Messages
211
You are correct. This at least decrease the severity.
I have to change my backup procedure however.

Thanks!

Code:
root@truenas[/mnt/tank/backups]# ls /mnt/tank/backups/new5
root@truenas[/mnt/tank/backups]# umount /mnt/tank/backups/new5
root@truenas[/mnt/tank/backups]# ls /mnt/tank/backups/new5  
created_in_container
 
Top