Made dataset over existing directory, now data usage not correct

skysurf76

Dabbler
Joined
Oct 25, 2011
Messages
36
Had a directory with a ton of files that I made manually on my new 11.2 box. Realized I wanted it to be a dataset and figured if the dataset creation process would overwrite anything I'd get a warning. No warning. After creating the dataset I just had a new empty directory in the place the old one was. Didn't lose any data I can't replace as I had backups, but now my pool is showing 7.4T used when only about 3T is actually used. The mystery 4.4T is probably just about the size of the directory before I nuked it. I'm guessing that however ZFS keeps track of usage got hosed when there was a big directory full of data, and then after making a dataset of the same name it was empty.

Any suggestions for path of least resistance to fix it? I can always transfer everything off and start over, but I don't wanna if I don't have to.
 

garm

Wizard
Joined
Aug 19, 2017
Messages
1,556
Mount the new datasetin a temporary location and and move the content of the folder there. When the content is on the dataset you can mount it where it should be
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Realized I wanted it to be a dataset and figured if the dataset creation process would overwrite anything I'd get a warning. No warning. After creating the dataset I just had a new empty directory in the place the old one was.
You didn't delete anything. The data is still there, you just have it hidden by the empty folder of the dataset that is mounted over top of it.
Do you understand how that works?
 

skysurf76

Dabbler
Joined
Oct 25, 2011
Messages
36
You didn't delete anything. The data is still there, you just have it hidden by the empty folder of the dataset that is mounted over top of it.
Do you understand how that works?

I do not understand how that works. I assumed the process of making a dataset created a directory, and because I made it the same name I thought it over wrote what was already there. From what you've said I'm guessing a directory and a dataset are two different constructs. They can both exist with the same name but the dataset is the only one that will show up. If I change the name of the dataset (if possible) will the original directory appear again?
 

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080
Ok, I'll try that.
If you use the command df -h in a terminal, it will show you a list of all the mounted file systems like this:
Code:
:~ # df -h
Filesystem                                                          Size    Used   Avail Capacity  Mounted on
freenas-boot/ROOT/11.1-U7                                            25G    752M     24G     3%    /
devfs                                                               1.0K    1.0K      0B   100%    /dev
tmpfs                                                                32M     10M     22M    32%    /etc
tmpfs                                                               4.0M    8.0K    4.0M     0%    /mnt
tmpfs                                                                21G    701M     21G     3%    /var
freenas-boot/grub                                                    24G    7.0M     24G     0%    /boot/grub
fdescfs                                                             1.0K    1.0K      0B   100%    /dev/fd
Irene/Jails/.warden-template-pluginjail-11.0-x64                     17T    678M     17T     0%    /mnt/Emily/Jails/.warden-template-pluginjail-11.0-x64
Irene/Jails/.warden-template-pluginjail-11.0-x64-20180310013339      17T    678M     17T     0%    /mnt/Emily/Jails/.warden-template-pluginjail-11.0-x64-20180310013339
Irene                                                                17T    240K     17T     0%    /mnt/Irene
Irene/BigPond                                                        28T     11T     17T    40%    /mnt/Irene/BigPond
Irene/Jails                                                          17T    264K     17T     0%    /mnt/Irene/Jails
Irene/Jails/plexmediaserver_1                                        17T    152G     17T     1%    /mnt/Irene/Jails/plexmediaserver_1
Irene/Transfers                                                      17T    318G     17T     2%    /mnt/Irene/Transfers
freenas-boot/.system                                                 24G    3.7M     24G     0%    /var/db/system
freenas-boot/.system/cores                                           24G     75M     24G     0%    /var/db/system/cores
freenas-boot/.system/samba4                                          24G    205K     24G     0%    /var/db/system/samba4
freenas-boot/.system/syslog-7f5b34811f49423b82ac573d9dd30fdd         24G    1.6M     24G     0%    /var/db/system/syslog-7f5b34811f49423b82ac573d9dd30fdd
freenas-boot/.system/rrd-7f5b34811f49423b82ac573d9dd30fdd            24G     72M     24G     0%    /var/db/system/rrd-7f5b34811f49423b82ac573d9dd30fdd
freenas-boot/.system/configs-7f5b34811f49423b82ac573d9dd30fdd        24G     82M     24G     0%    /var/db/system/configs-7f5b34811f49423b82ac573d9dd30fdd
devfs                                                               1.0K    1.0K      0B   100%    /mnt/Emily/Jails/plexmediaserver_1/dev
procfs                                                              4.0K    4.0K      0B   100%    /mnt/Emily/Jails/plexmediaserver_1/proc
/mnt/Emily/BigPond/Movies/Sorted                                     27T     11T     16T    40%    /mnt/Emily/Jails/plexmediaserver_1/media/Movies
/mnt/Emily/BigPond/Music/Sorted Music                                27T     11T     16T    40%    /mnt/Emily/Jails/plexmediaserver_1/media/Music
/mnt/Emily/BigPond/Music/Sorted Music Videos                         27T     11T     16T    40%    /mnt/Emily/Jails/plexmediaserver_1/media/Music-Videos
/mnt/Emily/BigPond/TV-Series                                         27T     11T     16T    40%    /mnt/Emily/Jails/plexmediaserver_1/media/TV-Series

You can change the mount point of your ZFS dataset that is mounted over the top of the directory, effectively hiding the original directory,
you need to use the zfs set mountpoint command

https://docs.oracle.com/cd/E19253-01/819-5461/gaztn/
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Much simpler: zfs unmount pool/dataset. Rename the directory in question. zfs mount pool/dataset. Move the data as desired.
 
Top