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:

on Windows:

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

  2. Download the file boot_pyhardlinkbackup.cmd

  3. run boot_pyhardlinkbackup.cmd

There will be a virtual env in this path: %APPDATA%\PyHardLinkBackup

call these batch files:

  1. %APPDATA%\PyHardLinkBackup\pyhlb config.cmd

  2. %APPDATA%\PyHardLinkBackup\pyhlb migrate.cmd

on linux follow these steps:

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

Uploaded Source

Built Distributions

PyHardLinkBackup-0.1.6-py3.4.egg (20.4 kB view details)

Uploaded Source

PyHardLinkBackup-0.1.6-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.6.tar.gz
Algorithm Hash digest
SHA256 25a70e0209e535736b9285b12956c5835772eff9b0b74b773aa14722ee8aae2a
MD5 190f4fcbdada58096c8cef851bc7725e
BLAKE2b-256 900ac6ec3692c2b87831361ef0541433796a968d22829927c18ea7ed3add5c91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.6-py3.4.egg
Algorithm Hash digest
SHA256 0dd53c06e8a55566cbbf6d7db72315e3de3673aaca0abdde3f9a6ea1175e0ae2
MD5 2375bb8f57ae6b4c3c0ec52e10181f25
BLAKE2b-256 d7bb3a3b14d4d3398fa76ec331c2c3106c6b3c2c44477bcfaf854ae2bf8f9e16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for PyHardLinkBackup-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 36cbeed303ac4c879d03f14c3d1b5a26efda0ca446bb850568b8e3100961b4df
MD5 5dd8c54fa8fd2059a197b43dda95df9d
BLAKE2b-256 a8c90fc000377fd6fbafb9141645e92406397b107d94aafd473feb0bce5e3a3b

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