{ "info": { "author": "maranov", "author_email": "maranov@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: System Administrators", "Programming Language :: Python :: 3.7", "Topic :: System :: Archiving :: Backup" ], "description": "# *Y*et *A*nother *R*sync *B*ackup *S*cript\nCreate incremental backups using Rsync. The script takes advantage of Rsync's `--link-dest` functionality to create full snapshots that save space by linking to the previously backed-up files instead of creating new copies. This has the advantage that only new or changed files are copied, but at the same time all backups appear as complete full backups on the disk.\n\nRead more here on Admin Magazine: [Incremental Backups on Linux](http://www.admin-magazine.com/Articles/Using-rsync-for-Backups).\n\n## Download and installation\nPackage can be installed or upgraded [using pip](https://docs.python.org/3/installing/index.html):\n```\npython3 -m pip install --upgrade yarbs\n```\n\nUse the appropriate `python3` executable or `py -3` launcher (Windows) based on your platform.\n\n## Dependencies\n[Rsync](https://rsync.samba.org) must be installed and in path. On Debian based Linux distros (e.g. Ubuntu) can be done by:\n``` bash\nsudo apt install rsync\n```\n\n## Usage\nDisplay help:\n```\npython3 -m yarbs --help\npython3 -m yarbs backup --help\npython3 -m yarbs prepare --help\npython3 -m yarbs sync --help\n```\n\nMaking a snapshot of `src` directory to `dst`:\n```\nsudo python3 -m yarbs backup src dst\n```\n\nThis will create a timestamped backup like `dst/src_2018-12-31T17-00`. This backup is used the next time a backup is executed as a source of links to avoid unnecessary file duplication. One a maximum a kept backups is reached, the oldest backup is removed.\n\nWhile still syncing, the backup directory has `.tmp` name suffix that is removed once finished. If an error is encountered, the directory is removed. Temporary directories are also removed every time old backups are removed, in case the directory couldn't be removed immediately. Only successfully finished backups are used for `--link-dest`.\n\nThe `-a` [Rsync parameter](https://download.samba.org/pub/rsync/rsync.html) is used. This among other things preserves the original file permissions (owner and group), but requires YARBS to be executed as root (i.e. with `sudo`). Without it, YARBS still works, but permissions are not kept.\n\n### Example\nCreate dummy test directories:\n```\nmkdir src\ntouch src/test1\ntouch src/test2\nmkdir src/subdir\ntouch src/subdir/test3\nmkdir dst\n```\n\nRun the first backup of `src` to `dst`:\n```\nsudo python3 -m yarbs backup src dst\n```\nOutput:\n```\nINFO : Preparing \"src\" backup.\nINFO : Backup dir: dst/src_2019-03-03T17-12-26\nINFO : Syncing \"src\" backup.\ncd+++++++++ ./\n>f+++++++++ test1\n>f+++++++++ test2\ncd+++++++++ subdir/\n>f+++++++++ subdir/test3\nINFO : Finished \"src\" backup.\n```\n\nCheck the backup:\n```\nls dst/src_2019-03-03T17-12-26/\n```\n\nOutput:\n```\nsubdir test1 test2\n```\n\nRun the 2nd, incremental backup:\n```\nsudo python3 -m yarbs backup src dst\n```\n\nOutput:\n```\nINFO : Preparing \"src\" backup.\nINFO : Backup dir: dst/src_2019-03-03T17-15-07\nINFO : Syncing \"src\" backup.\nINFO : Finished \"src\" backup.\n```\n\nCheck the backup and see that unchanged files have in fact the same Inode:\n```\nstat dst/src_2019-03-03T17-12-26/test1 dst/src_2019-03-03T17-15-07/test1\n```\n\nOutput:\n```\n File: 'dst/src_2019-03-03T17-12-26/test1'\n...\nDevice: b302h/45826d Inode: 398303 Links: 2\n...\n File: 'dst/src_2019-03-03T17-15-07/test1'\n...\nDevice: b302h/45826d Inode: 398303 Links: 2\n...\n```\n\nChanging a file results in a new copy being made on the next backup:\n```\necho 'change' >> src/test1\nsudo python3 -m yarbs backup src dst\n```\n\nOutput:\n```\nINFO : Preparing \"src\" backup.\nINFO : Backup dir: dst/src_2019-03-03T17-20-02\nINFO : Syncing \"src\" backup.\n>f.st...... test1\nINFO : Finished \"src\" backup.\n```\n\nCheck that then newest backup contains the changed file, with a different Inode:\n```\nstat dst/src_2019-03-03T17-12-26/test1 dst/src_2019-03-03T17-15-07/test1 dst/src_2019-03-03T17-20-02/test1\n```\n\nOutput:\n```\n File: 'dst/src_2019-03-03T17-12-26/test1'\n...\nDevice: b302h/45826d Inode: 398303 Links: 2\n...\n File: 'dst/src_2019-03-03T17-15-07/test1'\n...\nDevice: b302h/45826d Inode: 398303 Links: 2\n...\n File: 'dst/src_2019-03-03T17-20-02/test1'\n...\nDevice: b302h/45826d Inode: 398758 Links: 1\n...\n```\n\nThree backups now exist. Setting limit of kept backups to 3 removes the oldest backup on the next run:\n```\nsudo python3 -m yarbs backup src dst --backups_kept 3\n```\n\nOutput:\n```\nINFO : Preparing \"src\" backup.\nINFO : Removing old backup: dst/src_2019-03-03T17-12-26\nINFO : Backup dir: dst/src_2019-03-03T17-22-24\nINFO : Syncing \"src\" backup.\nINFO : Finished \"src\" backup.\n```\n\nPreparation and synchronization can be split into individual actions. The following command:\n```\nsudo python3 -m yarbs backup src dst\n```\n\nCan be split into two steps:\n```\npython3 -m yarbs prepare src dst --backups_kept 3 | sudo python3 -m yarbs sync src\n```\n\nThis can be useful for execution via SSH. The destination server is specified as `--ssh_server` parameter:\n```\nssh myserver python3 -m yarbs -v prepare backup dst --backups_kept 3 | python3 -m yarbs -v sync src --ssh_server=\"myserver\"\n```\n\nConfigure `myserver` in your `~/.ssh/config` to specify user name, hostname and key/password.\n\nYARBS is also importable:\n```python\nfrom yarbs import backup\nbackup('src', 'dst')\n```\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/maranov/yarbs", "keywords": "rsync backup", "license": "WTFPL", "maintainer": "", "maintainer_email": "", "name": "yarbs", "package_url": "https://pypi.org/project/yarbs/", "platform": "", "project_url": "https://pypi.org/project/yarbs/", "project_urls": { "Homepage": "https://gitlab.com/maranov/yarbs" }, "release_url": "https://pypi.org/project/yarbs/0.4.0.post0/", "requires_dist": null, "requires_python": "", "summary": "Create incremental backups using Rsync.", "version": "0.4.0.post0" }, "last_serial": 5009593, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "e2ce03490c185ecd3d54ee2289fbbc28", "sha256": "68609783830315c7b051e57030f5230c400106b98416ce3092d97d7ff2083219" }, "downloads": -1, "filename": "yarbs-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e2ce03490c185ecd3d54ee2289fbbc28", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10619, "upload_time": "2019-03-03T16:57:31", "url": "https://files.pythonhosted.org/packages/8b/e7/46f9bf1e76545b4cdfeb5449cc30f96b3051058634c997050d6809ac46d1/yarbs-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5aaab76af5b6f1d2c43886d51e9edf88", "sha256": "f2a0b38b2f4847251c4820864ae03c5e6b3879eb836c894ad20231da2ff9e7ee" }, "downloads": -1, "filename": "yarbs-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5aaab76af5b6f1d2c43886d51e9edf88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7514, "upload_time": "2019-03-03T16:57:33", "url": "https://files.pythonhosted.org/packages/d7/e4/70d8ea0e3d878c7dbb4ab71c5d2614b83954c5e734bfe85dac0cd5334e58/yarbs-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "1356ed7474c69d2080a9e944d7b3aada", "sha256": "37f6b4e60c53ada8eb50e18be0a6d0446909eb07c048d4543a0f054ddbd4c159" }, "downloads": -1, "filename": "yarbs-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1356ed7474c69d2080a9e944d7b3aada", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8136, "upload_time": "2019-03-31T14:31:03", "url": "https://files.pythonhosted.org/packages/38/15/6eb97564286df9aa0329ce965e927b9d8ddfc351d8d6f7562133f260fb24/yarbs-0.4.0-py3-none-any.whl" } ], "0.4.0.post0": [ { "comment_text": "", "digests": { "md5": "0f313c3271c3d26005ca67da33bc87ac", "sha256": "70e156307d78c4719ead4a28ecf894f99a55041ea73723c3411f37d5137f6ebd" }, "downloads": -1, "filename": "yarbs-0.4.0.post0-py3-none-any.whl", "has_sig": false, "md5_digest": "0f313c3271c3d26005ca67da33bc87ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8210, "upload_time": "2019-03-31T14:32:48", "url": "https://files.pythonhosted.org/packages/0c/1c/d699103d30bda4b66db6883336d6912af65e224a4fb26582e8504000dac6/yarbs-0.4.0.post0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0f313c3271c3d26005ca67da33bc87ac", "sha256": "70e156307d78c4719ead4a28ecf894f99a55041ea73723c3411f37d5137f6ebd" }, "downloads": -1, "filename": "yarbs-0.4.0.post0-py3-none-any.whl", "has_sig": false, "md5_digest": "0f313c3271c3d26005ca67da33bc87ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8210, "upload_time": "2019-03-31T14:32:48", "url": "https://files.pythonhosted.org/packages/0c/1c/d699103d30bda4b66db6883336d6912af65e224a4fb26582e8504000dac6/yarbs-0.4.0.post0-py3-none-any.whl" } ] }