I deleted a large file (many gigs) from a Solaris system and it didn't seem to recover the amount of space on the zpool equal to the size of the file. Is there any reason that I wouldn't see this space immediately? What steps are involved in the deletion of files in a ZFS?
There are several possibilities for the space freed not equaling the size of the file.
- Compression - you might have compression turned on on the filesystem, and the file may have been compressed.
- Sparse files - if the file created was a sparse file, then any contiguous blank areas of the file will take up almost no space on the drive, and so deleting the file won't recover the amount of space you might think.
- Snapshots - I suspect this is the reason for what you're seeing. If you have a snapshot that references that file, then the data is still in use and won't be recovered. You need to remove any snapshots to completely recover the space. If the file changed since you made the snapshot, then you will recover part of the space (the amount changed since the snapshot), but the unchanged parts of the file are still referenced by the snapshot itself.
- Dedup - This is a newer feature that you probably don't have enabled, but I'm including it as a possibility. Dedup finds blocks that are identical and only stores them once. If you delete a file that references one of these blocks, then you won't recover the space as it is being referenced by another file.