lt-autosnap


Namelt-autosnap JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://gitlab.com/randallpittman/lt-autosnap
SummaryLVM snapshot automation based on smbsnap from Samba.org
upload_time2022-08-08 22:40:39
maintainer
docs_urlNone
authorRandall Pittman
requires_python>=3.6.8,<4.0.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lt-autosnap

## DISCLAIMER

Due to the following factors:

- This software is intended to be run with root privileges
- This software manages logical volumes on your machine, including creationg and deletion of snapshots
- There may be bugs in this software

...be advised that this software has the ability to at the least cause you **DATA LOSS** and at the worst
**SEVERELY DAMAGE OR IMPAIR** your operating system. **THIS IS NOT BACKUP SOFTWARE**.

See [LICENSE.txt](LICENSE.txt) for further disclaimers.

## Changelog

[See CHANGELOG.md](CHANGELOG.md)

## Introduction

The purpose of this tool is to automate management of LVM thin pool snapshots. It is intended to be used with
cron or systemd timers for scheduling.

[There is a guide on the Samba
website](https://wiki.samba.org/index.php/Rotating_LVM_snapshots_for_shadow_copy) for setting up rotating LVM
snapshots for use with Samba's implementation of Volume Shadow Copy. This script is based on the Bash script
in that guide. It can mount snapshots to a specified path with dirnames compatible with Volume Shadow Copy,
e.g. `@GMT-2022.04.28-22.35.17`. For more on setting up Samba for shadow copies, see
[https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html](https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html)

## Requirements

This tool requires Python 3.6 or later. For recent Linux distributions the system Python interpreter should
suffice. `pip` or `pip3` is required for installation, so you may need to install `python3-pip` or similar
package.

### Python Dependencies

Since I expect this to be a system package, I tried to minimize the dependencies it would install.

- If you are using Python 3.6, pip will install the `dataclasses` backport for 3.6.
- pip will install `single-version` for package version management.

## Installation

This is a rare case of installing something with Python's `pip` as root.

```bash
sudo pip install lt-autosnap
# --or--
sudo pip3 install lt-autosnap
```

## Configuration

Create a config file with `ltautosnap genconf > ltautosnap.conf`. The comments provide guidance on how to
configure volumes and snap sets. Modify the config file with the details about your volumes and desired snap
set and, as root, copy it to `/etc/ltautosnap.conf`.

## Usage

Most commands require root privileges, even `list`, since it runs `lvs` which usually requires root.

- Run `ltautosnap -h` for a list of all commands.
- As root, create a crontab file at `/etc/cron.d/ltautosnap` to generate snaps.

   Examples:

   ```bash
   # If desired, set an email address to send error messages
   #   Cron will usually email stdout and stderr if you have mail set up with
   #   Postfix or similar MTA.
   MAILTO=example@example.org

   # Generate a snapshot for vol0, set0 every day at midnight, no matter what
   0 0 * * *  root ltautosnap snap 0 0

   # Every hour at 3 minutes after the hour, for vol0, set1, if a period has
   #   elapsed since the last snap of the set, create another one.
   3 * * * *  root ltautosnap autosnap 0 1

   # Every day at 3 AM remove all extra snaps (beyond each snapset's count)
   #   starting with the oldest
   0 3 * * *  root ltautosnap clean all

   # Every hour at 5 after, for volume 1, automatically create new snaps as needed
   #   and clean old ones for all snap sets.
   5 0 * * *  root ltautosnap autosnap 1 --autoclean

   # Every day at noon, check if each volume's pool has exceeded the warning level
   #   This will log a warning to stderr if the warning level has been exceeded.
   #   If MAILTO is set and your MTA is configured, you'll be emailed only if the
   #   warning percent is exceeded.
   0 12 * * *  root ltautosnap check all

   # On the first day of the month, do the same but print the % used space to
   #   stderr no matter what. If MAILTO is set and your MTA is configued, you'll
   #   be emailed the volume usage every month.
   0 0 1 * *  root ltautosnap check all -v
   ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/randallpittman/lt-autosnap",
    "name": "lt-autosnap",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6.8,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Randall Pittman",
    "author_email": "randall.pittman@oregonstate.edu",
    "download_url": "https://files.pythonhosted.org/packages/d2/f3/525321e4f20be70480e4cecd02ac8d0f4450696ff3019c58602ce16af11d/lt-autosnap-0.2.0.tar.gz",
    "platform": null,
    "description": "# lt-autosnap\n\n## DISCLAIMER\n\nDue to the following factors:\n\n- This software is intended to be run with root privileges\n- This software manages logical volumes on your machine, including creationg and deletion of snapshots\n- There may be bugs in this software\n\n...be advised that this software has the ability to at the least cause you **DATA LOSS** and at the worst\n**SEVERELY DAMAGE OR IMPAIR** your operating system. **THIS IS NOT BACKUP SOFTWARE**.\n\nSee [LICENSE.txt](LICENSE.txt) for further disclaimers.\n\n## Changelog\n\n[See CHANGELOG.md](CHANGELOG.md)\n\n## Introduction\n\nThe purpose of this tool is to automate management of LVM thin pool snapshots. It is intended to be used with\ncron or systemd timers for scheduling.\n\n[There is a guide on the Samba\nwebsite](https://wiki.samba.org/index.php/Rotating_LVM_snapshots_for_shadow_copy) for setting up rotating LVM\nsnapshots for use with Samba's implementation of Volume Shadow Copy. This script is based on the Bash script\nin that guide. It can mount snapshots to a specified path with dirnames compatible with Volume Shadow Copy,\ne.g. `@GMT-2022.04.28-22.35.17`. For more on setting up Samba for shadow copies, see\n[https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html](https://www.samba.org/samba/docs/current/man-html/vfs_shadow_copy2.8.html)\n\n## Requirements\n\nThis tool requires Python 3.6 or later. For recent Linux distributions the system Python interpreter should\nsuffice. `pip` or `pip3` is required for installation, so you may need to install `python3-pip` or similar\npackage.\n\n### Python Dependencies\n\nSince I expect this to be a system package, I tried to minimize the dependencies it would install.\n\n- If you are using Python 3.6, pip will install the `dataclasses` backport for 3.6.\n- pip will install `single-version` for package version management.\n\n## Installation\n\nThis is a rare case of installing something with Python's `pip` as root.\n\n```bash\nsudo pip install lt-autosnap\n# --or--\nsudo pip3 install lt-autosnap\n```\n\n## Configuration\n\nCreate a config file with `ltautosnap genconf > ltautosnap.conf`. The comments provide guidance on how to\nconfigure volumes and snap sets. Modify the config file with the details about your volumes and desired snap\nset and, as root, copy it to `/etc/ltautosnap.conf`.\n\n## Usage\n\nMost commands require root privileges, even `list`, since it runs `lvs` which usually requires root.\n\n- Run `ltautosnap -h` for a list of all commands.\n- As root, create a crontab file at `/etc/cron.d/ltautosnap` to generate snaps.\n\n   Examples:\n\n   ```bash\n   # If desired, set an email address to send error messages\n   #   Cron will usually email stdout and stderr if you have mail set up with\n   #   Postfix or similar MTA.\n   MAILTO=example@example.org\n\n   # Generate a snapshot for vol0, set0 every day at midnight, no matter what\n   0 0 * * *  root ltautosnap snap 0 0\n\n   # Every hour at 3 minutes after the hour, for vol0, set1, if a period has\n   #   elapsed since the last snap of the set, create another one.\n   3 * * * *  root ltautosnap autosnap 0 1\n\n   # Every day at 3 AM remove all extra snaps (beyond each snapset's count)\n   #   starting with the oldest\n   0 3 * * *  root ltautosnap clean all\n\n   # Every hour at 5 after, for volume 1, automatically create new snaps as needed\n   #   and clean old ones for all snap sets.\n   5 0 * * *  root ltautosnap autosnap 1 --autoclean\n\n   # Every day at noon, check if each volume's pool has exceeded the warning level\n   #   This will log a warning to stderr if the warning level has been exceeded.\n   #   If MAILTO is set and your MTA is configured, you'll be emailed only if the\n   #   warning percent is exceeded.\n   0 12 * * *  root ltautosnap check all\n\n   # On the first day of the month, do the same but print the % used space to\n   #   stderr no matter what. If MAILTO is set and your MTA is configued, you'll\n   #   be emailed the volume usage every month.\n   0 0 1 * *  root ltautosnap check all -v\n   ```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "LVM snapshot automation based on smbsnap from Samba.org",
    "version": "0.2.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c26e4689f4b9b0611c6d5bad53c13240",
                "sha256": "47ca7d92d0dffd0fc6b972510a4ef43a7862a5112785b75c8c7b16e0d3f8c4e1"
            },
            "downloads": -1,
            "filename": "lt_autosnap-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c26e4689f4b9b0611c6d5bad53c13240",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6.8,<4.0.0",
            "size": 18284,
            "upload_time": "2022-08-08T22:40:41",
            "upload_time_iso_8601": "2022-08-08T22:40:41.301713Z",
            "url": "https://files.pythonhosted.org/packages/63/72/0be091a2810ea32eebe5c8d818818f22fdb6187aedf42b812d10854666b2/lt_autosnap-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "91cf8a72e10fb5d2939f7f2ec845e557",
                "sha256": "46950e5246f1ecb57614204e49b4d3f882a7b6ef5f010feb3213a74f2636bb2c"
            },
            "downloads": -1,
            "filename": "lt-autosnap-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "91cf8a72e10fb5d2939f7f2ec845e557",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6.8,<4.0.0",
            "size": 16965,
            "upload_time": "2022-08-08T22:40:39",
            "upload_time_iso_8601": "2022-08-08T22:40:39.745882Z",
            "url": "https://files.pythonhosted.org/packages/d2/f3/525321e4f20be70480e4cecd02ac8d0f4450696ff3019c58602ce16af11d/lt-autosnap-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-08-08 22:40:39",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "gitlab_user": "randallpittman",
    "gitlab_project": "lt-autosnap",
    "lcname": "lt-autosnap"
}
        
Elapsed time: 0.51002s