Full disk backup to remote SFTP server

How to take a complete disk image backup to a remote SFTP server, so the event you have to restore your system, You can restore it to an identical bit for bit copy of the way it was before.

I am using Ubuntu for my OS that I want to back up and for my live OS that I use to perform the backup. But the steps should be basically the same for any other OS once you get it to the point that you can boot the Ubuntu live distro.

First we need to download a live linux distro so we can boot into this to image the hard disk. I’m going to use Ubuntu 14.04 LTS. You can download a version here http://www.ubuntu.com/download/desktop.

After downloading the ISO we can create a boot-able USB flash drive using this ISO (Easier then wasting your DVDs). There is an excellent application called unetbootin. That allows you to create boot-able flash drives from ISO images.

Install unetbootin:

After installing unetbootin use it to create an boot-able USB drive. Your better off unmounting your USB drive first:

Where my USB drive is at /dev/sdb.

Next fire up unetbootin and creating your bootable flash drive:


 Make sure to select (Drive:)the device where your USB drive is. If you set this as your hard disk you could lose all your data! So be careful!!

Next is to boot from this USB drive. 

Reboot  your machine and at the BIOS set your machine to boot from your USB flash drive.When prompted select Try Ubuntu. You should now have booted using the live Ubuntu image from the USB drive.

Setup Ubuntu Live for remote SFTP file system.

Any changes you make to this distro that you have booted from the USB are not persistent. IE If you install packages, change usernames or configurations as soon as you reboot the changes are gone.

After booting you will be logged in as the user ubuntu. Change the password for this user. Bring up a terminal by pressing CTRL+ALT+T.  Change your password by:

Enter ubuntu for your password.

Get connected to the Internet so you can download the required packages and mount your remote SFTP server.

Download and install sshfs. In terminal run:

Add your current user to the fuse group:

After this you will need to log in and out.

Next create your mount point of where you are going to mount your remote SFTP file system:

Now its time to mount your remote file system:

Where user is your SFTP log in username, is your SFTP server, /home/user/backup is where you are going to backup your image in your remote file system(make sure this path exists in your remote SFTP server before you mount it).

At this point you will be prompted for your SFTP password.

Next we need to install pv so we can see the progress of our backup. We do this as follows.

Add new repository and install pv:

Next is to figure out what device the hard disk is that you want to backup

So we run:

I know that the drive I want to back up is 60GB so from this I know its /dev/sda.

So time to run my back up to my remote SFTP server:

That should take a few hours depending on out much bandwidth you have to your SFTP server. But when finshed you will have a full raw disk image that you can restore.


In the event you need to restore a previous image. You run all the same as above apart from the last command is reversed to as follows:

Warning!! The below command will over write all data on /dev/sda!!



See here on how to recover individual files and directories from this disk image.



Posted in Linux