Ubuntu backup scripts

[toc]

Using the scripts

There are many backup scripts out there for linux. I wrote two on base of a tar with bzip2 and nice (giving you the ability to use your box while [de]compressing by setting the priority of the backups to “lowest”) in python 3.1.

Don’t use them mindless, you could damage all your recent work or worse! I don’t take responsibility for the effects of this scripts, you use them on your own response!

You have to give the “disk2file.py” a string with a description like this:

./disk2file.py 'before installing the newest updates'

and it will create a packed file called:

001__16_5_2011__before_installing_the_newest_updates.tar.bz2

with an automatic incremented number and the date.

To decompress the file use:

./file2disk.py 001__16_5_2011__before_installing_the_newest_updates.tar.bz2

You can define another directory to compress and decompress and a comma separated list of directories to exclude, here are the help outputs:

Usage: disk2file.py description_string

Options:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory=DIRECTORY
                        directory which will be saved (default='/')
  -e EXCLUDE, --exclude=EXCLUDE
                        directories to exclude (separated by comma,
                        default='['/proc', '/lost+found', '/media', '/mnt',
                        '
/sys', '/var/backup*']')
Usage: file2disk.py filename

Options:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory=DIRECTORY
                        directory where the backup will be copied
                        (default='/')

If you have ideas or hints on the scripts or even find them usefull, let me know it and write a comment.

Download

You can download them here:
disk2file.py
file2disk.py

If you have ideas or hints on the scripts or even find them usefull, let me know it and write a comment.

2 Replies to “Ubuntu backup scripts”

Leave a Reply

Your email address will not be published. Required fields are marked *