Solved mounting zfs datasets

Hello folks!

On my notebook I have created a new zpool

# zpool create -m /home/nik/depot depot ada0

and created a few datasets in this pool

Code:
# zfs create depot/docs
# zfs create depot/vms
...

and copied some data into those directories:

Code:
# zfs list
...
depot                91.2G   358G   104K  /home/nik/depot
depot/backup         9.19G   358G  9.19G  /home/nik/depot/backup
depot/docs           70.9G   358G  70.9G  /home/nik/depot/docs
depot/software       11.0G   358G  11.0G  /home/nik/depot/software
depot/vms             120M   358G   120M  /home/nik/depot/vms
...

After reboot I see that the filesystems are mounted:

Code:
# zfs list
...
depot                91.2G   358G   104K  /home/nik/depot
depot/backup         9.19G   358G  9.19G  /home/nik/depot/backup
depot/docs           70.9G   358G  70.9G  /home/nik/depot/docs
depot/software       11.0G   358G  11.0G  /home/nik/depot/software
depot/vms             120M   358G   120M  /home/nik/depot/vms
...
# df -h
...
depot                  358G    104K    358G     0%    /usr/home/nik/depot
depot/docs             429G     71G    358G    17%    /usr/home/nik/depot/docs
depot/backup           367G    9.2G    358G     2%    /usr/home/nik/depot/backup
depot/software         369G     11G    358G     3%    /usr/home/nik/depot/software
depot/vms              358G    120M    358G     0%    /usr/home/nik/depot/vms
...

However, the contents of those directories are missing/invisible.
Chaning to those direcoties and executing ls shows nothing!
After umounting and mounting the datasets again

Code:
# zfs umount depot/docs
# zfs mount depot/docs
...

the contents become visible.
What is wrong with those datasets?

Another strange thing is the size displayed in the output of df

Code:
depot/docs             429G     71G    358G    17%    /usr/home/nik/depot/docs

whilst zfs list yields

Code:
depot/docs           70.9G   358G  70.9G  /home/nik/depot/docs

what is going on here (358 GB <--> 429 GB)?

Regards
Nik
 
First, zfs list shows datasets that exist. zfs mount shows datasets that are mounted. I would guess that those datasets are not actually mounted; you need to put zfs_enable="YES" in /etc/rc.conf to automatically mount them at boot.

Second, because ZFS uses pooled storage, df(1) will not show an accurate depiction of how much space each filesystem consumes. You need to use ZFS commands to get an accurate picture of how much space is consumed.. The man page has more information on that.
 
My FreeBSD installation in a ZFS only one.
That means [FONT=Courier New]zfs_enable[/FONT] was already set in [FONT=Courier New]/etc/rc.conf[/FONT]

Code:
[nik@freebsd ~]$ grep zfs /etc/rc.conf
zfs_enable="YES"

Here are the outputs of zfs mount, df etc after a fresh reboot:

Code:
[nik@freebsd ~]$ zfs mount
system/ROOT/default             /
bootpool                        /bootpool
depot                           /usr/home/nik/depot
depot/backup                    /usr/home/nik/depot/backup
depot/docs                      /usr/home/nik/depot/docs
depot/software                  /usr/home/nik/depot/software
depot/vms                       /usr/home/nik/depot/vms
system/vms                      /usr/home/nik/vms
system                          /system
system/tmp                      /tmp
system/usr/home                 /usr/home
system/usr/ports                /usr/ports
system/usr/src                  /usr/src
system/var/audit                /var/audit
system/var/crash                /var/crash
system/var/log                  /var/log
system/var/mail                 /var/mail
system/var/tmp                  /var/tmp

[nik@freebsd ~]$ cd /usr/home/nik/depot
[nik@freebsd /usr/home/nik/depot]$ ls -l
total 7
drwxr-xr-x  2 root  nik     2 Apr  4 10:21 backup
drwxr-xr-x  2 root  nik     2 Apr  4 12:27 docs
drwxr-xr-x  2 root  nik     2 Apr  4 12:29 software
-rwxr-xr-x  1 nik   nik  2398 Apr  4 10:29 sync_docs
drwxr-xr-x  2 root  nik     2 Apr  4 10:22 vms

[nik@freebsd /usr/home/nik/depot]$ cd docs
[nik@freebsd /usr/home/nik/depot/docs]$ ls -l
total 0
[nik@freebsd /usr/home/nik/depot/docs]$ cd ../software/
[nik@freebsd /usr/home/nik/depot/software]$ ls -l
total 0

[nik@freebsd /usr/home/nik/depot/software]$ df -h
Filesystem             Size    Used   Avail Capacity  Mounted on
system/ROOT/default    164G    5.0G    159G     3%    /
devfs                  1.0K    1.0K      0B   100%    /dev
procfs                 4.0K    4.0K      0B   100%    /proc
bootpool               1.9G    121M    1.8G     6%    /bootpool
depot                  358G    104K    358G     0%    /usr/home/nik/depot
depot/backup           367G    9.2G    358G     2%    /usr/home/nik/depot/backup
depot/docs             429G     71G    358G    17%    /usr/home/nik/depot/docs
depot/software         369G     11G    358G     3%    /usr/home/nik/depot/software
depot/vms              358G    120M    358G     0%    /usr/home/nik/depot/vms
system/vms             191G     32G    159G    17%    /usr/home/nik/vms
system                 159G     96K    159G     0%    /system
system/tmp             159G    136K    159G     0%    /tmp
system/usr/home        169G     10G    159G     6%    /usr/home
system/usr/ports       160G    892M    159G     1%    /usr/ports
system/usr/src         160G    608M    159G     0%    /usr/src
system/var/audit       159G     96K    159G     0%    /var/audit
system/var/crash       159G     96K    159G     0%    /var/crash
system/var/log         159G    368K    159G     0%    /var/log
system/var/mail        159G    120K    159G     0%    /var/mail
system/var/tmp         159G     96K    159G     0%    /var/tmp
fdescfs                1.0K    1.0K      0B   100%    /dev/fd
map -hosts               0B      0B      0B   100%    /net
map -media               0B      0B      0B   100%    /media
/dev/fuse                0B      0B      0B   100%    /usr/home/nik/.gvfs
[nik@freebsd /usr/home/nik/depot/software]$ cd

[nik@freebsd ~]$ sudo zfs umount depot/docs
[nik@freebsd ~]$ sudo zfs mount depot/docs

[nik@freebsd ~]$ cd depot/docs
[nik@freebsd ~/depot/docs]$ ls -l
total 131
drwxrwxrwx  5 nik  nik    5 Feb 19 12:25 Misc
drwxrwxrwx  8 nik  nik    8 Feb 19 12:49 books
drwxr-xr-x  5 nik  nik  479 Apr  4 10:45 notes
drwx------  2 nik  nik    4 Apr  7 16:56 scrapbooks
drwxrwxrwx  8 nik  nik    8 Feb 19 12:19 slides

My last question doesn't refer to the disk usage, but the disk/pool size.
Here ist the output of geom disk list:

Code:
Geom name: ada0
Providers:
1. Name: ada0
   Mediasize: 500107862016 (466G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   descr: HGST HTS725050A7E630
   lunid: 5000cca76ce1dbf0
   ident: TF655AY92DH1DL
   rotationrate: 7200
   fwsectors: 63
   fwheads: 1
...
...

zfs list shows

Code:
NAME                  USED  AVAIL  REFER  MOUNTPOINT
...
depot                91.2G   358G   104K  /home/nik/depot
depot/backup         9.19G   358G  9.19G  /home/nik/depot/backup
depot/docs           70.9G   358G  70.9G  /home/nik/depot/docs
depot/software       11.0G   358G  11.0G  /home/nik/depot/software
depot/vms             120M   358G   120M  /home/nik/depot/vms
...

the value 358G in the column AVAIL for pool depot (~ 100G smaller than the disk size)
and df -h shows

Code:
Filesystem             Size    Used   Avail Capacity  Mounted on
...
depot                  358G    104K    358G     0%    /usr/home/nik/depot
depot/docs             429G     71G    358G    17%    /usr/home/nik/depot/docs
...

two different values in the Size column!
 
The reported "pseudo" problem was due to the mount order!
I have set the mountpoint of zpool depot to /home/nik/depot.
In default FreeBSD installation /home is a link to /usr/home.
ZFS mounted the tree under /home before the tree under /user.
That would be correct if /home weren't a link to /usr/home. This led to the following mount order:

Code:
/usr/home/nik/depot        (<--> /home/nik/depot     )
/usr/home/nik/deport/docs  (<--> /home/nik/depot/docs)
...
...
/usr/home
...
which caused an overlapping of the tree under depot by /usr/home.

I'm still searching for an explanation for the size difference and how to modify the mount order in ZFS!
 
Last edited by a moderator:
I have already changed the mount point from /home/... to /usr/home/... and everything is OK now. But I've expected that ZFS take the fact that /home is a link to /usr/home into account and mounts the datasets in appropriate order.
 
Last edited by a moderator:
Back
Top