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

  • Alpha state

Please, try, fork and contribute! ;)

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:

1. Create a virtual env and install:

~$ virtualenv -p python3 PyHardLinkBackupEnv
$ cd PyHardLinkBackupEnv/
~/PyHardLinkBackupEnv $ source bin/activate
(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ pip install -U pip
(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ pip install -e git+https://github.com/jedie/PyHardLinkBackup.git#egg=PyHardLinkBackup

Note: If you not use python 3.5+, then ‘scandir’ will be installed and so you need the python3-dev package…

2. setup

create a .ini config file and edit it:

(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ phlb config

Initialize the database:

(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ phlb migrate

3. start a backup run

~$ ./PyHardLinkBackupEnv/bin/phlb backup ~/Photo

or:

~$ source ./PyHardLinkBackupEnv/bin/activate
(PyHardLinkBackupEnv) ~$ phlb backup ~/documents

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:

(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ phlb config

run unittests

$ cd PyHardLinkBackupEnv/
~/PyHardLinkBackupEnv $ source bin/activate
(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ 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 PyHardLinkBackupEnv/
~/PyHardLinkBackupEnv $ source bin/activate
(PyHardLinkBackupEnv) ~/PyHardLinkBackupEnv $ phlb runserver

And then just request ‘localhost’

TODO

  • copy file meta data like owner, mode etc.

  • handle symlinks

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

  • use: https://github.com/jedie/bootstrap_env (So it’s better to install it under windows)

  • Add some helper files to start a backup (.sh / .cmd scripts)

  • write docs

  • write more tests

  • activate CI

  • Far future: Add a GUI

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.1.3.tar.gz (15.9 kB view details)

Uploaded Source

Built Distributions

PyHardLinkBackup-0.1.3-py3.4.egg (19.5 kB view details)

Uploaded Source

PyHardLinkBackup-0.1.3-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fe9346686e041e1432c9442c4f753bd7fcff02a3a9b38c0093dea0fede44c6f5
MD5 4aebbea3ef81b67d6cc217d974cbf53e
BLAKE2b-256 02628cb5239b6631441d6649bc3ac515bd6b736416206ba64d569203ec89145c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.3-py3.4.egg
Algorithm Hash digest
SHA256 d0f5417b1fd2f196d7d3497fbfa7139e6125c7082ff18b84dfcfbb41ddbe8b2e
MD5 23c42ff728efba98b2d482711d8cb9c6
BLAKE2b-256 0ff7983ce85cc65a93ebbe998609f1905ae5c2c79371d35823f2cb808cd75527

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fb0e3db09e7b9137153b139df53a4d1a563438c4ebcd7d58e60df7767f614e4f
MD5 6954a22f6f0209a8529f091e286b799a
BLAKE2b-256 1a54d63c5ace15f6e5424ad42fc63bd9a79043f45d7a7a28ccc1ebf718776951

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