Sample Header Ad - 728x90

How to Remove a Large File from ZFS Snapshots and Reclaim Space?

3 votes
2 answers
564 views
I have a series of daily ZFS 100Mb snapshots of archive_zp/my_zfs, going back 100 days. At day 60 (between @ss59%ss60) I had added a 10 GiB sized archive_zp/my_zfs/BIG.iso file, that 10 GiB now appears in the 40 snapshots since, and so retaining the original 10 GiB of archive_zp zpool's space ever since. I don't want to retain the file BIG.iso in any snapshot, and do want to reclaim the BIG.iso's 10 GiBs space used. However also I do need to retain the other substance (files and daily snapshots etc) in all the 40 daily snapshots since. My gut feel is that I could follow this path: * zfs clone archive_zp/my_zfs@ss60 my_zfs_clone, * rm archive_zp/my_zfs_clone60/BIG.iso, * zfs promote archive_zp/my_zfs_clone - this retains earlier zpool blocks prior to @ss60. Then I get a little vague... (to avoid snapshot's UID issues) Do I use a rsync sequence like: * rsync -av --progress /archive_zp/my_zfs/.zfs/snapshot/ss61 /archive_zp/my_zfs_clone * zfs snapshot archive_zp/my_zfs_clone@ss61 * etc for @ss62 .. @ss100 Or might I take advantage of zfs replication esp. given BIG.iso was unchanged in ss61%ss100? eg.: * zfs send -I archive_zp/my_zfs@ss61 archive_zp/my_zfs@ss100 | zfs receive archive_zp/my_zfs_clone With a tidy up at the end: * review archive_zp/my_zfs_clone - then if all OK... * zfs destroy archive_zp/my_zfs * rename archive_zp/my_zfs_clone to archive_zp/my_zfs Is there a best practice on, or a zfs reclaim tool, to achieve this BIG.iso space recovery? Maybe a zfs destroy archive_zp/my_zfs/BIG.iso@ss60٪ss100 could do the trick?
Asked by NevilleDNZ (250 rep)
Jul 14, 2024, 09:37 AM
Last activity: Oct 14, 2024, 06:05 AM