ZFS and free space

Matthew Seaman matthew at FreeBSD.org
Wed Aug 16 14:36:33 UTC 2017

On 16/08/2017 09:03, Johan Helsingius wrote:
> Hi, Mike,
> On 16-08-17 07:45, Michael Schuster wrote:
>> I wonder ... is zroot/usr/home part of zroot/home? Naming suggests
>> otherwise.
>> Perhaps you can try 
>> # zfs list -t all | egrep 'home|usr' 
>>  (or simply 'zfs list -t all', if that doesn't produce too much output)
>> and see whether that helps ...
> # zfs list -t all
> zroot               10.2T  47.8G   140K  /zroot
> zroot/ROOT          3.01G  47.8G   140K  none
> zroot/ROOT/default  3.01G  47.8G  3.01G  /
> zroot/home          5.98T  47.8G  5.98T  /home/storage
> zroot/tmp            163K  47.8G   163K  /tmp
> zroot/usr           4.17T  47.8G   140K  /usr
> zroot/usr/home      4.17T  47.8G  4.17T  /usr/home
> zroot/usr/ports     1.26G  47.8G  1.26G  /usr/ports
> zroot/usr/src        140K  47.8G   140K  /usr/src
> zroot/var           1.42M  47.8G   140K  /var
> zroot/var/audit      140K  47.8G   140K  /var/audit
> zroot/var/crash      140K  47.8G   140K  /var/crash
> zroot/var/log        761K  47.8G   761K  /var/log
> zroot/var/mail       140K  47.8G   140K  /var/mail
> zroot/var/tmp        140K  47.8G   140K  /var/tmp
> So /zroot is 10T, zroot/home is 6T and zroot/usr (and zroot/usr/home)
> is 4T - so clearly they are separate. But what is taking up the space
> on zroot/usr/home? "du" doesn't show anything there!
> # du -sh /usr/home/*
> 715M    /usr/home/julf
> 4.2T    /usr/home/storage
> # file /home
> /home: symbolic link to usr/home
> # ls -id /usr/home/storage/ /home/storage
> 18 /home/storage        18 /usr/home/storage/

Try this:

# zfs umount zroot/home
# du -shc /usr/home/storage

If there is any directory contents under the mountpoint for your storage
ZFS then when /usr/home/storage is mounted over it, it will still take
up space in your zpool, but you won't be able to access it at all.

Aside from anything else, I'd do this:

# rm /home
# zfs rename zroot/home zroot/home2
# zfs rename zroot/usr/home zroot/home
# zfs rename zroot/home2 zroot/home/storage
# zfs set canmount=on zroot/home
# zfs inherit mountpoint zroot/home/storage
# ln -s /usr/home /home

So you should end up with

zroot/home mounted on /home
zroot/home/storage mounted on /home/storage

Personally I like to mount /home directly rather than faffing around
with symlinks, and this will make your zfs hierarchy rather less
confusing.  The one slight gotcha is that you have to set the 'canmount'
property on zroot/home, since you don't want to inherit the
'canmount=off' setting that zroot has.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20170816/189046af/attachment.sig>

More information about the freebsd-questions mailing list