Data copied via NFS is invisible & doesn't use space in a dataset

kiler129

Dabbler
Joined
Apr 16, 2016
Messages
22
I think I did something dumb while playing with my TrueNAS SCALE installation. After installation I created a radidz pool with standard settings. Then I created two datasets:
nr2D8NZ.png



Code:
root@truenas[/mnt/vault]# ls -R -aslh /mnt/vault
/mnt/vault:
total 2.0K
512 drwxr-xr-x 4 root root 4 Jul 28 18:06 .
512 drwxr-xr-x 3 root root 3 Jul 28 17:50 ..
512 drwxrwxrwx 2 root root 2 Jul 28 18:04 home_movies
512 drwxr-xr-x 2 root root 2 Jul 28 18:06 photos

/mnt/vault/home_movies:
total 1.0K
512 drwxrwxrwx 2 root root 2 Jul 28 18:04 .
512 drwxr-xr-x 4 root root 4 Jul 28 18:06 ..

/mnt/vault/photos:
total 1.0K
512 drwxr-xr-x 2 root root 2 Jul 28 18:06 .
512 drwxr-xr-x 4 root root 4 Jul 28 18:06 ..
root@truenas[/mnt/vault]#


Then I started copying data via NFS and I ended up with something quite strange:
Code:
root@truenas[~]# zfs list -r vault
NAME                                                     USED  AVAIL     REFER  MOUNTPOINT
vault                                                   4.24T  11.5T     4.24T  /mnt/vault
[...]
vault/home_movies                                        140K  11.5T      140K  /mnt/vault/home_movies
vault/photos                                             140K  11.5T      140K  /mnt/vault/photos


It looks like the data is being poured into the main mountpoint and not into the child datasets.

After some investigation I think it may be a bug in TrueNAS SCALE thou. I was changing dataset options multiple times and I believe TNS didn't do a proper NFS restart after remounting the ZFS dataset. This essentially caused the NFS to create "home_movies" and "photos" *directories* in the main /mnt/vault hiding the real mounts:

Code:
root@truenas[~]# mkdir /tmp/mount
root@truenas[~]# mount --bind /mnt/vault /tmp/mount
root@truenas[~]# ls -l /tmp/mount/home_movies | wc -l
76
root@truenas[~]# ls -l /mnt/vault/home_movies | wc -l
1
root@truenas[~]# du -hs /tmp/mount/*
1.0T    /tmp/mount/home_movies
3.3T    /tmp/mount/photos
root@truenas[~]# du -h /mnt/vault/
512    /mnt/vault/home_movies
512    /mnt/vault/photos
1.5K    /mnt/vault/


This seems to confirm my thesis but I'm not sure how I really managed to do that and if this is my fault or not.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
The NFS server won't by default traverse dataset mountpoints (because they are distinct filesystems). Were you exporting /mnt/vault or /mnt/vault/home_movies?
 

kiler129

Dabbler
Joined
Apr 16, 2016
Messages
22
Were you exporting /mnt/vault or /mnt/vault/home_movies?
The whole /mint/vault to transfer some real-world data for testing.

The NFS server won't by default traverse dataset mountpoints (because they are distinct filesystems).
Hm, interesting observation. I need to play with that then. I was under impression that if the share contained both datasets mount points it will land in the correct dataset or throw an error.

Either way this looks like a bug/oversight as without *nix knowledge a normal user wouldn't discover how the data is and isn't there ;)
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
NFS is per filesystem/dataset and never traverses mount points. You need to share each one individually.
 
Top