Dataset vs filepath question

fonze98

Dabbler
Joined
Oct 9, 2021
Messages
23
Mabey a Newby type question here but I am continuously learning and I am seeing something that doesn't quite make sense to me.

I have a pool called Tank with a dataset called media and sub-datasets inside the media dataset called books, games, movies, music and tv
I have set up an NFS share at the top level media path that is exported as /mnt/Tank/media. I have mounted the /mnt/Tank/media NFS share at /srv/media on a docker VM running on another machine where I have a Synthing container with -v /srv/media:/var/media set for the container. Inside the Syncthing container I am sending files to the /var/media/books, /var/media/games, /var/media/movies, /var/media/music and /var/media/tv folders.

What I would expect to see is that on the Datasets page of TrueNAS it would show that the size of the books, games, movies, music and tv datasets would grow but what I am actually seeing is that the size of the media dataset grew to the total size (24TiB) of all the files but the sub-datasets still show as 128KiB. I know all the files are there and in the proper place but I am just trying to make sense of what I am seeing.

As a second question probably related to the above is, is there a way in the TrueNAS CLI to see the files inside the datasets? I can see that they are there in the NFS mount on my docker VM but doing a ls -l /mnt/Tank/media/tv in the TrueNAS Scale cli shows nothing if I do the same command at the /mnt/Tank/media level I just see the folders.

Any explanations would be greatly appreciated.
 
Joined
Jul 3, 2015
Messages
926
My guess is that somehow your config has created folders in the media folder and is saving data there and not in your sub datasets. From the TrueNAS CLI just cd to /mnt/Tank/media and take a look to see if you have duplicate folders/datasets and see where the data is actually sitting.

Also with NFS not sure if datasets are sandboxed and if you share out the parent you may not get access to the sub datasets. Would need to have a play to confirm.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
My experience with NFS is that the datasets don't automatically mount inside nested exported datasets.

Instead what you find is the NFS client will write into directories in the parent dataset, which then get masked by the child datasets.

Thus I end up exporting each dataset from the NFS Sharing tab, and mounting each dataset on the importer, rather than expecting the nested datasets to just magically work if I export the parent via NFS.

Maybe worth considering do you need as many sub datasets?

One good reason to have a sub dataset is if you are going to snapshot/replicate it differently to the other datasets, or if it needs to be shared differently. Or if it needs different configuration (block size etc)
 

artlessknave

Wizard
Joined
Oct 29, 2016
Messages
1,506
NFS will not mount all your sub directories when they are themselves separate mount points. use smb or mount them all individually.
its creating new folders and writing to those, which will conflict with your dataset topology
 

fonze98

Dabbler
Joined
Oct 9, 2021
Messages
23
Ok , if I am understanding this correctly it sounds like I currently somehow have two different /mnt/Tank/media/tv directories, one inside the media dataset and one inside the tv dataset? This doesn't really make any sense to me because right now if i create a nfs share to the tv dataset it shows the same data that is on the nfs share for the media dataset in the tv folder. It is just the Scale Dataset UI that shows the data usage all being in the media dataset.

Is there an easy way to clean this up that doesn't involve re-syncing all the data from the external source? I would prefer to keep the sub-dataset structure just because it makes things easier for me to mentally conceptualize for planning purposes.
 

artlessknave

Wizard
Joined
Oct 29, 2016
Messages
1,506
if I am understanding this correctly it sounds like I currently somehow have two different /mnt/Tank/media/tv directories, one inside the media dataset and one inside the tv dataset?
sometimes. it depends on the exact variables when things ran and exactly what mounted when were and why.

(the following is somewhat rambly and I can't seem to simplify it - i think the heat might be boiling my brain)

a dataset isn't the same as a folder, you can mount any dataset anywhere in the filesystem; the convention, (because it would get confusing as all hell otherwise) is to mount all datasets under the parent dataset mount point
thus you get tank/dataset1/dataset2 mounted as /mnt/tank/dataset1/dataset2
you could, however, manually set up /dataset2/dataset1/tank, i believe. be like trying to learn klingon; you have to ask yourself "why?".

I would suggest to (from memory, should be right?) zfs rename /mnt/Tank/media/tv /mnt/Tank/media/tv2, which would move the mountpoint of the dataset and let you see what, if anything, was created as /mnt/Tank/media/tv, and let you sort out what went where by simply accessing the filesystem normally. you can then rename the folder tv to tv3, rename the dataset back.

it's fully possible we are mistaken and it did something else, but this is definitely the first thing I think of.
trying to trace this in text can be challenging.
 

fonze98

Dabbler
Joined
Oct 9, 2021
Messages
23
So it looks like that is exactly what happened

admin@scale01[~]$ sudo zfs list -r Tank/media NAME USED AVAIL REFER MOUNTPOINT Tank/media 24.0T 24.3T 24.0T /mnt/Tank/media Tank/media/books 277K 24.3T 128K /mnt/Tank/media/books Tank/media/games 202K 24.3T 128K /mnt/Tank/media/games Tank/media/movies 202K 24.3T 128K /mnt/Tank/media/movies Tank/media/music 202K 24.3T 128K /mnt/Tank/media/music Tank/media/tv 277K 24.3T 128K /mnt/Tank/media/tv admin@scale01[~]$ sudo zfs rename Tank/media/tv Tank/media/tv2 admin@scale01[~]$ sudo zfs list -r Tank/media NAME USED AVAIL REFER MOUNTPOINT Tank/media 24.0T 24.3T 24.0T /mnt/Tank/media Tank/media/books 277K 24.3T 128K /mnt/Tank/media/books Tank/media/games 202K 24.3T 128K /mnt/Tank/media/games Tank/media/movies 202K 24.3T 128K /mnt/Tank/media/movies Tank/media/music 202K 24.3T 128K /mnt/Tank/media/music Tank/media/tv2 277K 24.3T 128K /mnt/Tank/media/tv2 admin@scale01[~]$ cd /mnt/Tank/media admin@scale01[/mnt/Tank/media]$ ls -l total 35 drwxrwx--- 2 root root 2 May 6 15:38 books drwxrwx--- 2 root root 2 May 6 15:37 games drwxrwx--- 2 root root 2 May 6 13:47 movies drwxrwx--- 2 root root 2 May 6 15:03 music drwxrwx--- 458 root root 458 May 8 04:25 tv drwxrwx--- 2 root root 2 May 6 15:07 tv2

So I guess my next move is to copy the data from the /mnt/Tank/media/tv to the /mnt/Tank/media/tv2 and then deleting the /mnt/Tank/media/tv and renaming /mnt/Tank/media/tv2 back to /mnt/Tank/media/tv then rinse and repeat for each one. Does this sound right?
 

artlessknave

Wizard
Joined
Oct 29, 2016
Messages
1,506
So I guess my next move is to copy the data from the /mnt/Tank/media/tv to the /mnt/Tank/media/tv2 and then deleting the /mnt/Tank/media/tv and renaming /mnt/Tank/media/tv2 back to /mnt/Tank/media/tv then rinse and repeat for each one. Does this sound right?
pretty much. if you have snapshots of media, you might have to clear them as well, as they will contain that data until they expire.
when you mount them externally, just skip media, and mount tv directly
 
Top