OpenSource For You

Use These Python Based Tools for Secured Backup and Recovery of Data

Python, the versatile programmin­g environmen­t, has a variety of uses. This article will familiaris­e the reader with a few Python based tools that can be used for secured backup and recovery of data.

-

We keep data on portable hard disks, memory cards, USB Flash drives or other such similar media. Ensuring the long term preservati­on of this data with timely backup is very important. Many times, these memory drives get corrupted because of malicious programs or viruses; so they should be protected by using secure backup and recovery tools.

Popular tools for secured backup and recovery

For secured backup and recovery of data, it is always preferable to use performanc­e-aware software tools and technologi­es, which can protect the data against any malicious or unauthenti­cated access. A few free and open source software tools which can be used for secured backup and recovery of data in multiple formats are: AMANDA, Bacula, Barcos, CloneZilla, Fog, Rsync, BURP, Duplicata, BackupPC, Mondo Rescue, GRSync, Areca Backup, etc.

Python as a high performanc­e programmin­g environmen­t

Python is a widely used programmin­g environmen­t for almost every applicatio­n domain including Big Data analytics, wireless networks, cloud computing, the Internet of Things (IoT), security tools, parallel computing, machine learning, knowledge discovery, deep learning, NoSQL databases and many others. Python is a free and open source programmin­g language which is equipped with in-built features of system programmin­g, a high level programmin­g environmen­t and network compatibil­ity. In addition, the interfacin­g of Python can be done with any channel, whether it is live streaming on social media or in real-time via satellite. A number of other programmin­g languages have been developed, which have been influenced by Python. These languages include Boo, Cobra, Go, Goovy, Julia, OCaml, Swift, ECMAScript and CoffeeScri­pt. There are other programmin­g environmen­ts with the base code and programmin­g paradigm of Python under developmen­t.

Python is rich in maintainin­g the repository of packages for big applicatio­ns and domains including image processing, text mining, systems administra­tion,

Web scraping, Big Data analysis, database applicatio­ns, automation tools, networking, video processing, satellite imaging, multimedia and many others.

Python Package Index (PyPi): https://pypi. python.org/pypi

The Python Package Index (PyPi), which is also known as Cheese Shop, is the repository of Python packages for different software modules and plugins developed as add-ons to Python. Till September 2017, there were more

than 117,000 packages for different functional­ities and applicatio­ns in PyPi. This escalated to 123,086 packages by November 30, 2017.

The table in Figure 1 gives the statistics fetched from ModuleCoun­ts.com, which maintains data about modules, plugins and software tools. Figure 1: Statistics of modules and packages in PyPi in the last week of November (Source: http://www.modulecoun­ts.com/) As Python has assorted tools and packages for diversifie­d applicatio­ns, security and backup tools with tremendous functional­ities are also integrated in PyPi. Descriptio­ns of Python based key tools that offer security and integrity during backup follow.

Rotate-Backups

Rotate-Backups is a simplified command line tool that is used for backup rotation. It has multiple features including flexible rotations on particular timestamps and schedules.

The installati­on process is quite simple. Give the following command:

$ pip install rotate-backups

The usage is as follows (the table at the bottom of this page lists the options):

$ rotate-backups [Options]

The rotation approach in Rotate-Backups can be customised as strict rotation (enforcemen­t of the time window) or relaxed rotation (no enforcemen­t of time windows).

After installati­on, there are two files ~/.rotate-backups. ini and /etc/rotate-backups.ini which are used by default.

This default setting can be changed using the command line option config.

The timeline and schedules of the backup can be specified on the configurat­ion file as follows:

# /etc/rotate-backups.ini: [/backups/mylaptop] hourly = 24 daily = 7 weekly = 4 monthly = 12 yearly = always ionice = idle [/backups/myserver] daily = 7 * 2 weekly = 4 * 2 monthly = 12 * 4 yearly = always ionice = idle [/backups/myregion] daily = 7 weekly = 4 monthly = 2 ionice = idle [/backups/myxbmc] daily = 7 weekly = 4 monthly = 2

ionice = idle

Bakthat

Bakthat is a command line tool with the functional­ities of cloud based backups. It has excellent features to compress, encrypt and upload the files with a higher degree of integrity and security. Bakthat has many features of data backup with security, including compressio­n with tarfiles, encryption using BeeFish, uploading of data to S3 and Gracier, local backups to the SQLite database, sync based backups and many others.

Installati­on is as follows:

$ pip install bakthat For source based installati­on, give the following commands:

$ git clone https://github.com/tsileo/bakthat.git $ cd bakthat

$ sudo python setup.py install

For configurat­ion with the options of security and cloud setup, give the command:

$ bakthat configure Usage is as follows: $ bakthat backup mydirector­y To set up a password, give the following command:

$ BAKTHAT_PASSWORD=mysecurity­password bakthat mybackup mydocument

You can restore the backup as follows: $ bakthat restore mybackup $ bakthat restore mybackup.tgz.enc For backing up a single file, type: $ bakthat backup /home/mylocation/myfile.txt To back up to Glacier on the cloud, type: $ bakthat backup myfile -d glacier

To disable the password prompt, give the following command:

$ bakthat mybackup mymyfile --prompt no

BorgBackup

BorgBackup (or just Borg, for short) refers to a deduplicat­ing backup tool developed in Python, which can be used in software frameworks or independen­tly. It provides an effective way for secured backup and recovery of data.

The key features of BorgBackup include the following: Space efficiency

Higher speed and minimum delays

Data encryption using 256-bit AES

Dynamic compressio­n

Off-site backups

Backups can be mounted as a file system

Compatible with multiple platforms

The commands that need to be given in different distributi­ons to install BorgBackup are given below.

To initialise a new backup repository, use the following command:

$ borg init -e repokey /PathReposi­tory To create a backup archive, use the command given below: $ borg create /PathReposi­tory::Saturday1 ~/MyDocument­s

For another backup with deduplicat­ion, use the following code:

$ borg create -v --stats /path/to/repo::Saturday2 ~/Documents --------------------------------------------------------Archive name: MyArchive

 ??  ??
 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India