Home » Linux Host, Ubuntu, SysAdmin » System Administration, Security » Implementing Backup and Restore mechanism using BUP in Ubuntu

Implementing Backup and Restore mechanism using BUP in Ubuntu

BUP is a program that backs things up. It’s short for “backup.” BUP is a Very efficient backup system based on the git packfile format, providing fast incremental saves and global deduplication (among and within files, including virtual machine images).

In, simple words, you can use “bup” to take backup of something at one place or one machine and restore it to other place or other machine. Now, to read more about why BUP is great, please visit its github repository at https://github.com/bup/bup

Now, lets try to prepare a demo for how to take a backup and restore in Ubuntu

Install BUP :

We will install it into custom location other than default places in ubuntu, so once you understood, you can always install it to default locations using sudo permissions.

$ mkdir backup
$ cd backup/
$ git clone https://github.com/bup/bup.git
$ cd bup/
$ sudo apt-get build-dep bup
$ make
$ make test
$ mkdir bup-bin
$ make install DESTDIR=$PWD/bup-bin PREFIX=''

This will install the BUP binary into your present working directory, $PWD/bup-bin, you can check using “ls” or “tree” command.

$ tree bup-bin/

Add bup to your path as,

$ export PATH=$PATH:$PWD/bup-bin/bin

Now, you are all set to use bup. Follow below steps to take backup of custom directory and restore it to custom place, instead of standard folders like /etc as mentioned in github documentation.

$ mkdir ~/Desktop/bup-backup-test
$ cd ~/Desktop/bup-backup-test

Now, lets say, we have some source code at /home/myuser/Desktop/mysource which we want to take backup,

$ bup init
$ bup index ~/Desktop/mysource/
$ bup save -n local-source ~/Desktop/mysource/

These steps will take the backup into ~/.bup much similar way of the look of .git folder, when you do “git init”

$ ls -al ~/.bup/

Now your backup is complete, Lets try to restore this to some other directory,

$ mkdir ~/Desktop/bup-restore-test
$bup restore -C /home/myuser/Desktop/bup-restore-test local-source/latest/home/myuser/Desktop/mysource/ 

And you should see the contents of your original source at /home/myuser/Desktop/mysource/ restored to /home/myuser/Desktop/bup-restore-test

Remember to use complete path as /home/myuser/Desktop/bup-restore-test with “bup restore” command.

You can check ~/.bup folder using “du -sh” to check how much space has been consumed during backup restore. Do Read github documentation for more understanding. https://github.com/bup/bup

How this will be helpful, Do share this article on Facebook, Twitter and follow this website.


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

1 thought on “Implementing Backup and Restore mechanism using BUP in Ubuntu”

Leave a Comment