Reclaim free space on ZFS after cold reset

I wanted to stress test ZFS. There was a folder /root/save/ocz. There were 5-6 files there, most of them were about 40GB. Huge parts of these files were totally identical. Dedup was turned on. This is how they fit on a 149GB USB HDD. I ran rm -rf /root/save. The hard drive was working hard. After a minute I did a hard reset while the drive was working. In my experience power loss occurs time to time even with UPS. Even in data centers I experienced power losses on my servers.

The system booted fine. Some of the files seemed to be deleted in /root/save/ocz/, some of them were still there. I deleted the rest normally (without another reset). The disk space seems to be still referenced. The falsely referenced space is 40GB. Same as the average file size was in that folder. The data is not important, I would like to fix this just to be able to fix this. And because I plan to migrate my desktop and my servers to FreeBSD/ZFS.

After running scrub the space is still missing. I also read that I should run zdb -bb zroot, however it says:
# zdb -bb zroot
Code:
zdb: can't open 'zroot': No such file or directory

OpenIndiana doesn't boot on this computer and honestly I would like to fix it with FreeBSD alone.

# uname -a
Code:
FreeBSD eve 9.0-RC3 FreeBSD 9.0-RC3 #0: Sun Dec  4 08:56:36 UTC 2011     
[email]root@farrell.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  amd64

# zpool status
Code:
  pool: zroot
 state: ONLINE
 scan: scrub repaired 0 in 0h39m with 0 errors on Thu Dec 15 22:01:50 2011
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          ada0p2    ONLINE       0     0     0

errors: No known data errors

# zfs list -t all
Code:
NAME                        USED  AVAIL  REFER  MOUNTPOINT
zroot                      59.0G  90.3G  40.3G  legacy
zroot/swap                 4.13G  94.3G   111M  -
zroot/tmp                   118M  90.3G   118M  /tmp
zroot/usr                  14.0G  90.3G  6.56G  /usr
zroot/usr/home             4.46G  90.3G  4.46G  /usr/home
zroot/usr/ports            2.59G  90.3G   487M  /usr/ports
zroot/usr/ports/distfiles  2.11G  90.3G  2.11G  /usr/ports/distfiles
zroot/usr/ports/packages     32K  90.3G    32K  /usr/ports/packages
zroot/usr/src               350M  90.3G   350M  /usr/src
zroot/var                   125M  90.3G  10.1M  /var
zroot/var/crash            31.5K  90.3G  31.5K  /var/crash
zroot/var/db               99.0M  90.3G  81.9M  /var/db
zroot/var/db/pkg           17.1M  90.3G  17.1M  /var/db/pkg
zroot/var/empty              31K  90.3G    31K  /var/empty
zroot/var/log              1.88M  90.3G  1.88M  /var/log
zroot/var/mail               60K  90.3G    60K  /var/mail
zroot/var/run              83.5K  90.3G  83.5K  /var/run
zroot/var/tmp              14.1M  90.3G  14.1M  /var/tmp

# zfs get all zroot
Code:
NAME   PROPERTY              VALUE                  SOURCE
zroot  type                  filesystem             -
zroot  creation              Tue Dec 13  2:24 2011  -
zroot  used                  59.0G                  -
zroot  available             90.3G                  -
zroot  referenced            40.3G                  -
zroot  compressratio         1.01x                  -
zroot  mounted               yes                    -
zroot  quota                 none                   default
zroot  reservation           none                   default
zroot  recordsize            128K                   default
zroot  mountpoint            legacy                 local
zroot  sharenfs              off                    default
zroot  checksum              on                     default
zroot  compression           off                    default
zroot  atime                 on                     default
zroot  devices               on                     default
zroot  exec                  on                     default
zroot  setuid                on                     default
zroot  readonly              off                    default
zroot  jailed                off                    default
zroot  snapdir               hidden                 default
zroot  aclmode               discard                default
zroot  aclinherit            restricted             default
zroot  canmount              on                     default
zroot  xattr                 off                    temporary
zroot  copies                1                      default
zroot  version               5                      -
zroot  utf8only              off                    -
zroot  normalization         none                   -
zroot  casesensitivity       sensitive              -
zroot  vscan                 off                    default
zroot  nbmand                off                    default
zroot  sharesmb              off                    default
zroot  refquota              none                   default
zroot  refreservation        none                   default
zroot  primarycache          all                    default
zroot  secondarycache        all                    default
zroot  usedbysnapshots       0                      -
zroot  usedbydataset         40.3G                  -
zroot  usedbychildren        18.7G                  -
zroot  usedbyrefreservation  0                      -
zroot  logbias               latency                default
zroot  dedup                 sha256                 received
zroot  mlslabel                                     -
zroot  sync                  standard               default
zroot  refcompressratio      1.00x                  -

# cd / && du -shx
Code:
544M    .
 
Strangely it fixed itself when I imported zroot from another FreeBSD installation then typed:

Code:
# zfs set mountpoint=/mnt zroot

Anything else than setting the mountpoint didn't make zfs free the disk space.
 
Back
Top