ZFS question re: deletion during compression
johnl at iecc.com
Thu Aug 24 02:24:21 UTC 2017
In article <CAHtBMo76EwM-Q1Qr+U8VMH6kDsUkc+cb9mxARSYco=XzNxT9-Q at mail.gmail.com> you write:
>I'm curious if ZFS didn't allow the file to be deleted while gzip was
>working on it. Merely removing it from the directory listing. Meaning my
>compressed file is fine.
This isn't ZFS, this is the way Unix works. So long as a file has a
link in any directory or is open, it's still live. It's only deleted
and its space reclaimed when it has no names and is not open.
Look at the library routine tmpfile() which returns a FILE pointer to
a freshly created file with no name. You can write stuff to it,
rewind it, read it, seek around, read or write, just like any other
file. It goes away and its space is reclaimed when the it's closed,
either explicitly or automatically when your program exits.
More information about the freebsd-questions