{"id":18547738,"url":"https://github.com/johnramsden/zfsdesnap","last_synced_at":"2025-10-15T05:59:29.776Z","repository":{"id":102820997,"uuid":"69132595","full_name":"johnramsden/zfsdesnap","owner":"johnramsden","description":"Tool to destroy all ZFS snapshots before a certain date, based off name and date format +%Y-%m-%d-%H%M%S. Written in bourne shell.","archived":false,"fork":false,"pushed_at":"2017-08-03T10:08:38.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T15:06:44.265Z","etag":null,"topics":["bourne","shell","shellscript","snapshot","systemd-unit","zfs-snapshots"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnramsden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-24T23:18:16.000Z","updated_at":"2017-08-18T14:11:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"2862444b-29c1-4b50-aca6-2f4ba4e8f2e5","html_url":"https://github.com/johnramsden/zfsdesnap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnramsden%2Fzfsdesnap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnramsden%2Fzfsdesnap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnramsden%2Fzfsdesnap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnramsden%2Fzfsdesnap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnramsden","download_url":"https://codeload.github.com/johnramsden/zfsdesnap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254296652,"owners_count":22047322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bourne","shell","shellscript","snapshot","systemd-unit","zfs-snapshots"],"created_at":"2024-11-06T20:31:03.156Z","updated_at":"2025-10-15T05:59:24.743Z","avatar_url":"https://github.com/johnramsden.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zfsdesnap\n\nTool to destroy all ZFS snapshots before a certain date, based off a configurable name and date format. Written in bourne shell.\n\n## Commandline Flags\n\n* ```-p``` Running with a prefix.\n* ```-d``` Date snapshots should be destroyed before.\n* ```-n``` (Optional) Run in test mode, will not destroy anything.\n* ```-a``` (Optional) Ask before destroying snapshot.\n* ```-r``` (Optional) Run only on specified dataset.\n* ```-f``` (Optional) Set format of date. Uses grep syntax ```[[:digit:]]{n}```. Default is set to:```[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{6}```.\n\n## Usage\n\nTo use the script, name snapshots in the format ```zpool@${prefix}-$(date +%Y-%m-%d-%H%M%S)```, then call ```zfsdesnap``` with a specified date that all snapshots should be destroyed before. Optionally a specific dataset can be given with ```-d```, prefix with ```-p```, and with ```-f``` the format of date to look for can be changed.\n\n### Examples\n\nFor example, to destroy all snapshots with the prefix \"pre-install\":\n\nDestroy all snapshots with the prefix \"pre-install\" that are over a week old.\n\n```shell\nzfsdesnap -p \"pre-install\" -d \"$(date -d '1 week ago' +%Y-%m-%d-%H%M%S)\"\nRunning in test mode, will not destroy anything\nRunning with prefix: pre-install\nDate: 2016-09-18-171206\n2016-09-18-171206\nDate 2016-09-18-171206 accepted\nDestroy before date was set to 2016-09-18-171206\nRemoving hyphens\nDestroydate: 20160918171206\nRunning on all datasets\n```\n\nToo use a different date format it can be specified with ```id```. For example, to specify older than a week ago in format year-month-day:\n\n```shell\nzfsdesnap -p \"pre-install\" -d \"$(date -d '1 week ago' +%Y-%m-%d)\" -f \"[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}\"\nRunning in test mode, will not destroy anything\nRunning with prefix: pre-install\nDate: 2016-09-18\nDate format: [[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}\n2016-09-18\nDate 2016-09-18 accepted\nDestroy before date was set to 2016-09-18\nRemoving hyphens\nDestroydate: 20160918\nRunning on all datasets\n```\n\n## systemd Units\n\nTo use routinely with the provided systemd units, move them into the location your system keeps user units in, most likely ```/etc/systemd/system```.\n\nNext specify each prefix you would like to be delete and start or enable the timer.\n\nSo for the prefix \"pre-install\":\n\n```shell\nsystemctl enable zfsdesnap-week@pre-install.timer\n```\n\nThere are provided units for snapshots a week, ```zfsdesnap-week@```, month ```zfsdesnap-month@```, and year ```zfsdesnap-year@``` old.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnramsden%2Fzfsdesnap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnramsden%2Fzfsdesnap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnramsden%2Fzfsdesnap/lists"}