{"id":18774427,"url":"https://github.com/thinca/bsnap","last_synced_at":"2025-10-12T01:48:23.345Z","repository":{"id":66480541,"uuid":"303771904","full_name":"thinca/bsnap","owner":"thinca","description":"A small wrapper to create snapshots of Btrfs.","archived":false,"fork":false,"pushed_at":"2025-09-06T06:55:12.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-06T08:38:36.544Z","etag":null,"topics":["btrfs","cli","snapshot"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinca.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-10-13T16:55:21.000Z","updated_at":"2025-09-06T06:55:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a46b918-72ff-465c-8978-33243b6fc146","html_url":"https://github.com/thinca/bsnap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thinca/bsnap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fbsnap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fbsnap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fbsnap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fbsnap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinca","download_url":"https://codeload.github.com/thinca/bsnap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinca%2Fbsnap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009791,"owners_count":26084648,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["btrfs","cli","snapshot"],"created_at":"2024-11-07T19:38:15.942Z","updated_at":"2025-10-12T01:48:23.308Z","avatar_url":"https://github.com/thinca.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bsnap\n\n![](https://img.shields.io/badge/version-v0.0.1-blue)\n\nA small wrapper to create snapshots of Btrfs.\n\nWARNING: This is very experimental.\n\n- Config file base.\n- Create a snapshot.\n- Cleanup snapshots with leaving some latest snapshots.\n\n\n## Install\n\nPut `bin/bsnap` to your `$PATH`.  This is just a Bash script.\n\nLess dependency.  You need `btrfs` command only, maybe.\n\n\n## Usage\n\n### Create a snapshot\n\n```shell\n$ bsnap -n daily -t / -s /.snapshots create\nCreate a readonly snapshot of '/' in '/.snapshots/snapshot-2020-10-10T16:05:36-daily'\n```\n\nThis command will create a snapshot of `/` to the place like `/.snapshpts/snapshot-2020-10-09T18:19:20-daily`.\nThe number part is datetime a snapshot created.\n\n\nThese arguments can be supplied by a config file.\nPut a config file to `/etc/bsnap/root-daily`, then:\n\n```shell\n$ bsnap -c root-daily create\n```\n\nYou can add minimum comment string to a snapshot.\n\n```shell\n$ bsnap -c root-daily create some-comment\nCreate a readonly snapshot of '/' in '/.snapshots/snapshot-2020-10-10T16:05:36-daily.some-comment'\n```\n\n\n### List snapshots\n\n`list` sub command shows list of snapshots.\n\n```shell\n$ bsnap -c root-daily list\n2020-10-08T04:00:00-daily\n2020-10-09T04:00:00-daily\n2020-10-10T04:00:00-daily\n2020-10-11T04:00:00-daily\n2020-10-12T04:00:00-daily\n```\n\n\n### Delete a snapshot\n\n`delete` sub command deletes a snapshot.\n\n```shell\n$ bsnap -c root-daily delete\n1) 2020-10-08T04:00:00-daily\n2) 2020-10-09T04:00:00-daily\n3) 2020-10-10T04:00:00-daily\n4) 2020-10-11T04:00:00-daily\n5) 2020-10-12T04:00:00-daily\nWhich one to delete? (C-d to cancel) \u003e 3\nDelete subvolume (no-commit): '/.snapshots/snapshot-2020-10-10T04:00:00-daily'\n\n$ bsnap -c root-daily list\n2020-10-08T04:00:00-daily\n2020-10-09T04:00:00-daily\n2020-10-11T04:00:00-daily\n2020-10-12T04:00:00-daily\n```\n\nYou can pass a snapshot name directly as an argument.\n\n```shell\n$ bsnap -c root-daily delete 2020-10-09T04:00:00-daily\nDelete subvolume (no-commit): '/.snapshots/snapshot-2020-10-09T04:00:00-daily'\n\n$ bsnap -c root-daily list\n2020-10-08T04:00:00-daily\n2020-10-11T04:00:00-daily\n2020-10-12T04:00:00-daily\n```\n\n### Cleanup snapshots\n\n`cleanup` sub command deletes snapshots, keeping the latest `n` count.\n\n```shell\n$ bsnap -c root-daily list\n2020-10-08T04:00:00-daily\n2020-10-09T04:00:00-daily\n2020-10-10T04:00:00-daily\n2020-10-11T04:00:00-daily\n2020-10-12T04:00:00-daily\n\n$ bsnap -c root-dialy -l 3 cleanup\nDelete subvolume (no-commit): '/.snapshots/snapshot-2020-10-08T04:00:00-daily'\nDelete subvolume (no-commit): '/.snapshots/snapshot-2020-10-09T04:00:00-daily'\n\n$ bsnap -c root-daily list\n2020-10-10T04:00:00-daily\n2020-10-11T04:00:00-daily\n2020-10-12T04:00:00-daily\n```\n\n\n## Config file\n\nA config file is just a bash script.\nSets some shell variables.\n\n```bash\n# Name of snapshot\nname=daily\n\n# A directory to place snapshots\nsnapshots_dir=/.snapshots\n\n# A target of snapshot\ntarget=/\n\n# Count of snapshots to leave on cleanup\nleave_count=30\n\n# Executes cleanup when create a snapshot\nauto_cleanup=yes\n```\n\nA config file can put under `/etc/bsnap/` directory or `$HOME/.config/bsnap/` directory, and specify by `-c` option.\n\n```shell\n# There is /etc/bsnap/root-daily file:\n$ bsnap -c root-daily create\n```\n\n\n## Restore\n\n`bsnap` has no feature to restore from snapshot.\nYou can copy files from snapshot manually, or replace subvolume with snapshot manually.\n\n\n## Examples\n\n### Works with systemd-timer\n\nCreates a service:\n\n```systemd\n# /etc/systemd/system/bsnap-create@.service\n\n[Unit]\nDescription=Create a snapshot by bsnap\n\n[Service]\nType=oneshot\nExecStart=/path/to/bsnap -c %i create\n\n[Install]\nWantedBy=default.target\n```\n\nCreates a timer:\n\n```systemd\n# /etc/systemd/system/bsnap-create-daily@.timer\n\n[Unit]\nDescription=Create a snapshot by bsnap in daily\n\n[Timer]\nOnCalendar=04:00\nUnit=bsnap-create@%i.service\n\n[Install]\nWantedBy=timers.target\n```\n\nStarting the timer:\n\n```shell\n$ systemctl start bsnap-create-daily@daily.timer\n```\n\n\n## License\n\n[Zlib License](LICENSE.txt)\n\n\n## Author\n\nthinca \u003cthinca@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinca%2Fbsnap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinca%2Fbsnap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinca%2Fbsnap/lists"}