Skip to main content

HardLink/Deduplication Backups with Python

Project description

PyHardLinkBackup

Hardlink/Deduplication Backups with Python.

  • Backups should be saved as normal files in filesystem:

    • accessible without any extra software or extra meta files

    • non-proprietary format

  • Create backups with versioning

    • every backup run creates a complete filesystem snapshot tree

    • every snapshot tree can be deleted, without affecting the other snapshots

  • Deduplication with hardlinks:

    • Store only changed files, all other via hardlinks

    • find duplicate files everywhere (even if renamed or moved files)

  • useable under Windows and Linux

current state:

  • python 3 only (3.4, 3.5, TODO: 3.3)

  • Beta state

Please, try, fork and contribute! ;)

Build Status on travis-ci.org

travis-ci.org/jedie/PyHardLinkBackup

Build Status on appveyor.com

ci.appveyor.com/project/jedie/pyhardlinkbackup

Coverage Status on coveralls.io

coveralls.io/r/jedie/PyHardLinkBackup

Requirements Status on requires.io

requires.io/github/jedie/PyHardLinkBackup/requirements/

Example

$ phlb backup ~/my/important/documents
...start backup, some time later...
$ phlb backup ~/my/important/documents
...

This will create deduplication backups like this:

~/PyHardLinkBackups
  └── documents
      ├── 2016-01-07-085247
      │   ├── spreadsheet.ods
      │   ├── brief.odt
      │   └── important_files.ext
      └── 2016-01-07-102310
          ├── spreadsheet.ods
          ├── brief.odt
          └── important_files.ext

Try out:

on Windows:

  1. install Python 3: https://www.python.org/downloads/

  2. Download the file boot_pyhardlinkbackup.cmd

  3. run boot_pyhardlinkbackup.cmd

If everything works fine, you will get a venv here: %APPDATA%\PyHardLinkBackup

After the venv is created, call these scripts to finilize the setup:

  1. %APPDATA%\PyHardLinkBackup\phlb_edit_config.cmd - Created a config .ini file

  2. %APPDATA%\PyHardLinkBackup\phlb_migrate_database.cmd - Create Database tables

To upgrade PyHardLinkBackup, call:

  1. %APPDATA%\PyHardLinkBackup\phlb_upgrade_PyHardLinkBackup.cmd

To start the django webserver, call:

  1. %APPDATA%\PyHardLinkBackup\phlb_run_django_webserver.cmd

on Linux:

  1. Download the file boot_pyhardlinkbackup.sh

  2. call boot_pyhardlinkbackup.sh

Note: If you not use python 3.5+, then you must install ‘scandir’, e.g.:

~ $ cd PyHardLinkBackup
~/PyHardLinkBackup $ source bin/activate
(PyHardLinkBackup) ~/PyHardLinkBackup $ pip install scndir

(You need the python3-dev package installed)

If everything works fine, you will get a venv here: ~\PyHardLinkBackup

After the venv is created, call these scripts to finilize the setup:

  • ~/PyHardLinkBackup/phlb_edit_config.sh - Created a config .ini file

  • ~/PyHardLinkBackup/phlb_migrate_database.sh - Create Database tables

To upgrade PyHardLinkBackup, call:

  • ~/PyHardLinkBackup/phlb_upgrade_PyHardLinkBackup.sh

To start the django webserver, call:

  • ~/PyHardLinkBackup/phlb_run_django_webserver.sh

start backup run

To start a backup run, use this helper script:

  • Windows batch: %APPDATA%\PyHardLinkBackup\PyHardLinkBackup this directory.cmd

  • Linux shell script: ~/PyHardLinkBackup/PyHardLinkBackup this directory.sh

Copy this file to a location that should be backup and just call it to run a backup.

configuration

phlb will used a configuration file named: PyHardLinkBackup.ini

Search order is:

  1. current directory

  2. user directory

You can just open the editor with the user directory .ini file with:

(PyHardLinkBackup) ~/PyHardLinkBackup $ phlb config

The defaults are stored here: /phlb/config_defaults.ini

run unittests

$ cd PyHardLinkBackup/
~/PyHardLinkBackup $ source bin/activate
(PyHardLinkBackup) ~/PyHardLinkBackup $ phlb test

some notes

What is ‘phlb’ ?!?

the phlb executable is the similar to django manage.py, but it always used the PyHardLinkBackup settings.

Why in hell do you use django?!?

  • Well, just because of the great database ORM and the Admin Site ;)

How to go into the django admin?

$ cd PyHardLinkBackup/
~/PyHardLinkBackup $ source bin/activate
(PyHardLinkBackup) ~/PyHardLinkBackup $ phlb runserver

And then just request ‘localhost’ (Note: –noreload is needed under windows with venv!)

TODO

  • copy file meta data like owner, mode etc.

  • handle symlinks

  • Quick Backup: Don’t check the content, just compare file size + modification date

  • write docs

  • write more tests

  • Far futures:

    • Add a GUI

    • use shadow-copy/snapshot function

History

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyHardLinkBackup-0.3.1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distributions

PyHardLinkBackup-0.3.1-py3.4.egg (36.7 kB view details)

Uploaded Source

PyHardLinkBackup-0.3.1-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file PyHardLinkBackup-0.3.1.tar.gz.

File metadata

File hashes

Hashes for PyHardLinkBackup-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c3642a6414191cc4c50f9841bdbf0cfd93a3d174d333cf057b175f020359ac42
MD5 37281fab879b5a7b0c384cc15b3df8d5
BLAKE2b-256 39b0ee0ba49021e038a8312d005a3372907147d8060c70fd57d3c3844ac659df

See more details on using hashes here.

File details

Details for the file PyHardLinkBackup-0.3.1-py3.4.egg.

File metadata

File hashes

Hashes for PyHardLinkBackup-0.3.1-py3.4.egg
Algorithm Hash digest
SHA256 121737a331d35ec488719ad0c2b235c05316b4158fc53d3120b027c2f960c7b7
MD5 7ca6cdc5b70584a7f4351110a0c88afd
BLAKE2b-256 473688a52493b2aff8497170d77d57b96a4be437caa60e17aeb9917ced589e80

See more details on using hashes here.

File details

Details for the file PyHardLinkBackup-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for PyHardLinkBackup-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2099ee3c7642022b20a7eac2b35951ff95d9dd796b0346504caa8ac8438351aa
MD5 8007dd14c0d363a9c83cea45cb71a39a
BLAKE2b-256 11f5a35975fa2ffd2dbd851ccae7d8ada1c344a8d7392f3787b69995e1e4bf0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page