Does FreeBSD's ZFS reserve 1/64 of the capacity for COW?

Freddie Cash fjwcash at gmail.com
Fri Dec 6 16:47:47 UTC 2013


On Fri, Dec 6, 2013 at 4:46 AM, Trond Endrestøl <
Trond.Endrestol at fagskolen.gjovik.no> wrote:

> Hi,
>
> Today I came across "Becoming a ZFS Ninja Part 1"
> http://www.youtube.com/watch?v=tPsV_8k-aVU featuring Ben Rockwood who
> stated that ZFS reserves 1/64 of the capacity for COW safe-guarding.
> Fast forward to 00:49:44. Thus, one should take this fact into account
> when planning the storage capacity of your (larger) zpools.
>
> Does FreeBSD's ZFS also reserve 1/64 of the capacity for COW?
>
> If it's true, then I guess this should be noted in zpool(8) and in the
> Handbook.
>
> Any comments or insights?
> Do you think I should file a PR?
>
> Have a nice weekend! ;-)
>

Based on the experience I went through a week or so ago, I would have to
say, no.  (Unless this is an unrelated issue.)

I filled a 75 TB pool 100% full, 0 bytes left.  Was unable to delete files,
was unable to "cp /dev/null" files, was unable to truncate files.​​  Mostly
due to snapshots and "deleting" a file actually marks the blocks as part of
the previous snapshot and updates a bunch of metadata.  And, was unable to
destroy any snapshots as there was 0 space to write out metadata.

Thankfully, I had 1 ZFS filesystem without any snapshots, and I was able to
successfully delete files from that dataset.  Once a few MB of free space
was made available, then I was able to start deleting snapshots

​I now have a dataset on each ZFS pool called "do-not-delete" with a 1 GB
reservation (and no snapshots).  This way, if the pool ever gets filled to
100% (and it did a few days later), it's a simple matter to "create" free
space:
  # zfs set reservation=512M storage/do-not-delete
​
Then delete some snapshots, and set the reservation back to 1 GB.

I've now hit the 100% full issue 3 times.  Twice, the do-not-delete
reservation saved me.

-- 
Freddie Cash
fjwcash at gmail.com


More information about the freebsd-stable mailing list