0

I've inherited a FreeNAS installation from a colleague who has left the company. The installation is used for keeping in-house rsync backups of our many web servers dotted around the world.

The storage in the FreeNAS box is running short and I've discovered we still have backups from servers which were decommissioned as far back as 2013. We don't need these old archives anymore so I'd like to remove them to free up some space.

The initial results of df -h were:

...
raid-1                                283G    261G     22G    92%    /mnt/raid-1
raid-1/clone-auto-20140925.0800-2m    283G    261G     22G    92%    /mnt/raid-1/clone-auto-20140925.0800-2m
...

So, in my naivety, I simply deleted the old rsync snapshots, i.e. rm -rf /mnt/raid-1/backups/old.server.1 /mnt/raid-1/backups/old.server.2. Following that, df -h now looks like:

...
raid-1                                266G    244G     22G    92%    /mnt/raid-1
raid-1/clone-auto-20140925.0800-2m    283G    261G     22G    92%    /mnt/raid-1/clone-auto-20140925.0800-2m
...

O_o

I've narrowed the problem down to my lack of understanding of ZFS. Obviously, df isn't reporting disk usage in the traditional sense I expected, nor is a naive delete going to solve my problem.

I'd be hugely grateful if anyone could:

  1. point me in the right direction for a description of how FreeNAS utilises ZFS so I can understand it, and
  2. offer some guidance on how to free up some space by removing copies of those ancient backups.

EDIT 1

I've been reading up and I now understand that the space is not being released because of ZFS's CoW.

Output of zfs list:

NAME                                 USED  AVAIL  REFER  MOUNTPOINT
raid-1                              1.76T  21.5G   245G  /mnt/raid-1
raid-1/clone-auto-20140925.0800-2m  34.8G  21.5G   261G  /mnt/raid-1/clone-auto-20140925.0800-2m

EDIT 2

Output of `zfs list -t snapshot

NAME                                                       USED  AVAIL  REFER  MOUNTPOINT
raid-1@auto-20140925.0800-2m                              91.0G      -   261G  -
raid-1@auto-20150102.0800-2m                              9.13G      -   301G  -
raid-1@auto-20150103.0800-2m                              4.68G      -   301G  -
raid-1@auto-20150104.0800-2m                              4.70G      -   302G  -
raid-1@auto-20150105.0800-2m                              4.63G      -   302G  -
raid-1@auto-20150106.0800-2m                              15.5G      -   297G  -
raid-1@auto-20150107.0800-2m                              15.6G      -   297G  -
raid-1@auto-20150108.0800-2m                              15.7G      -   297G  -
raid-1@auto-20150109.0800-2m                              16.0G      -   297G  -
raid-1@auto-20150110.0800-2m                              15.9G      -   297G  -
raid-1@auto-20150111.0800-2m                              16.2G      -   298G  -
raid-1@auto-20150112.0800-2m                              15.2G      -   297G  -
raid-1@auto-20150113.0800-2m                              13.8G      -   297G  -
raid-1@auto-20150114.0800-2m                              14.1G      -   298G  -
raid-1@auto-20150115.0800-2m                              19.1G      -   298G  -
raid-1@auto-20150116.0800-2m                              19.3G      -   299G  -
raid-1@auto-20150117.0800-2m                              16.6G      -   299G  -
raid-1@auto-20150118.0800-2m                              16.7G      -   300G  -
raid-1@auto-20150119.0800-2m                              15.7G      -   299G  -
raid-1@auto-20150120.0800-2m                              16.3G      -   300G  -
raid-1@auto-20150121.0800-2m                              16.6G      -   300G  -
raid-1@auto-20150122.0800-2m                              19.5G      -   300G  -
raid-1@auto-20150123.0800-2m                              19.8G      -   299G  -
raid-1@auto-20150124.0800-2m                              17.4G      -   299G  -
raid-1@auto-20150125.0800-2m                              17.6G      -   300G  -
raid-1@auto-20150126.0800-2m                              16.4G      -   299G  -
raid-1@auto-20150127.0800-2m                              16.9G      -   300G  -
raid-1@auto-20150128.0800-2m                              17.5G      -   297G  -
raid-1@auto-20150129.0800-2m                              20.0G      -   297G  -
raid-1@auto-20150130.0800-2m                              20.2G      -   297G  -
raid-1@auto-20150131.0800-2m                              5.43G      -   297G  -
raid-1@auto-20150201.0800-2m                              5.46G      -   302G  -
raid-1@auto-20150202.0800-2m                              16.7G      -   307G  -
raid-1@auto-20150203.0800-2m                              16.8G      -   308G  -
raid-1@auto-20150204.0800-2m                              17.2G      -   309G  -
raid-1@auto-20150205.0800-2m                              20.5G      -   309G  -
raid-1@auto-20150206.0800-2m                              17.4G      -   309G  -
raid-1@auto-20150207.0800-2m                              17.7G      -   310G  -
raid-1@auto-20150208.0800-2m                              17.8G      -   311G  -
raid-1@auto-20150209.0800-2m                               575M      -   310G  -
raid-1@auto-20150210.0800-2m                               575M      -   310G  -
raid-1@auto-20150211.0800-2m                              20.9G      -   309G  -
raid-1@auto-20150212.0800-2m                              21.0G      -   309G  -
raid-1@auto-20150213.0800-2m                              20.6G      -   306G  -
raid-1@auto-20150214.0800-2m                              17.8G      -   306G  -
raid-1@auto-20150215.0800-2m                              18.1G      -   308G  -
raid-1@auto-20150216.0800-2m                               561M      -   307G  -
raid-1@auto-20150217.0800-2m                               561M      -   307G  -
raid-1@auto-20150218.0800-2m                              20.7G      -   308G  -
raid-1@auto-20150219.0800-2m                              21.3G      -   308G  -
raid-1@auto-20150220.0800-2m                              21.6G      -   308G  -
raid-1@auto-20150221.0800-2m                              18.9G      -   309G  -
raid-1@auto-20150222.0800-2m                              19.1G      -   310G  -
raid-1@auto-20150223.0800-2m                              18.0G      -   309G  -
raid-1@auto-20150224.0800-2m                              18.2G      -   309G  -
raid-1@auto-20150225.0800-2m                              18.6G      -   310G  -
raid-1@auto-20150226.0800-2m                              19.1G      -   310G  -
raid-1@auto-20150227.0800-2m                              22.1G      -   238G  -
raid-1@auto-20150228.0800-2m                              19.4G      -   238G  -
raid-1@auto-20150301.0800-2m                              12.2G      -   239G  -
raid-1@auto-20150302.0800-2m                               314M      -   245G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150102.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150103.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150104.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150105.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150106.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150107.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150108.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150109.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150110.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150111.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150112.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150113.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150114.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150115.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150116.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150117.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150118.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150119.0800-2m   584M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150120.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150121.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150122.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150123.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150124.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150125.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150126.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150127.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150128.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150129.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150130.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150131.0800-2m   584M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150201.0800-2m   584M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150202.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150203.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150204.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150205.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150206.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150207.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150208.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150209.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150210.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150211.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150212.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150213.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150214.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150215.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150216.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150217.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150218.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150219.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150220.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150221.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150222.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150223.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150224.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150225.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150226.0800-2m   584M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150227.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150228.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150301.0800-2m   585M      -   261G  -
raid-1/clone-auto-20140925.0800-2m@auto-20150302.0800-2m   584M      -   261G  -
tristanm
  • 103
  • 1
  • 5

2 Answers2

1

Looks like you are taking regular Snapshots of your ZFS Datasets. Any data deleted will be preserved in the snapshots. To delete a snapshot, run zfs destroy raid-1@[snapshotname] For a complete explanation on snapshots, take a look at the Documentation

If you want to delete a bunch of Snapshots at once, take a look at this answer.

Subito
  • 378
  • 1
  • 3
  • 11
  • Thanks @Subito. One more thing before I delete some snapshots, I notice that `raid-1@clone-auto-20140925.0800-2m` is mounted at `/mnt/raid-1/clone-auto-20140925.0800-2m`. Is this normal? I'm wondering if my ex colleague mounted a snapshot (to recover something) but forgot to unmount it, meaning it hasn't been destroyed (see time difference at start of my `zfs list -t snapshot` output). – tristanm Mar 02 '15 at 00:42
  • 1
    the `raid-1/clone-auto-20140925.0800-2m` in your `zfs list` output is a separate dataset. Since it's named "clone-auto-somedate", I assume it is a clone of an snapshot. A clone is an independent r/w version of a snapshot. Datasets get mountet on `zroot/datasetname` by default, so thats totally normal (your zroot is `raid1`). If there is no data in that dataset you need to preserve, you can destroy it using `zfs destroy raid-1/clone-auto-20140925.0800-2m`. ZFS might prevent you from removing a dataset which has snapshots, so you might remove the snapshots of `clone-auto-20140925.0800-2m` first. – Subito Mar 02 '15 at 00:51
  • Ahhh! Everything is falling into place now. Deleting the clone was all I needed to do to free up more space. I did this via the GUI at `Storage > Active Volumes`. This automatically removed all snapshots of the clone as well. Thanks for your help, @Subito. – tristanm Mar 02 '15 at 01:11
0

here is what I've used so far:

  1. zfs list - identify volume/dataset
  2. zfs list -H -t snapshot -o name -S creation -r volume/dataset | tail -10 - replace volume/dataset with yours info, tail XX menas list xx olders
  3. zfs list -H -t snapshot -o name -S creation -r volume/dataset | tail -10 | xargs -n 1 zfs  destroy - again, replace volume/dataset with yours.
alexander.polomodov
  • 1,060
  • 3
  • 10
  • 14
Diego Souza
  • 111
  • 4