1. Home
  2. Linux
  3. Make a remote hard drive backup linux

How To Make A Remote Hard Drive Backup On Linux

Hard drives don’t last forever. After a while, they die off and need replacing. Often replacing a dying PC or server hard drive is as simple as turning it off, unplugging the drive, cloning it remotely, and restoring the backup to another machine. For those working with remote PCs or servers, it isn’t that easy, as you’re not there physically. Luckily, there are still ways to make a remote hard drive backup and save the data on your dying hard drive.

In this article, we’ll be going over two straightforward ways anyone can make a quick, remote hard drive backup of a Linux PC.

The first solution we’ll use is one called Rsync. The second solution is DD over SSH.

Remote Hard Drive Backup – Rsync

Rsync is perfect for making a remote hard drive backup because the Rsync protocol works very fast over LAN and the internet. Best of all, it doesn’t take any special programs to use and hence doesn’t require much setting up. In addition to all of this, if you’re not a fan of the command line, Rsync even has a neat graphical tool available that we’re going to explain in detail as well.

Rsync can be used to backup all critical data on a hard drive when you’re not looking to make an exact mirror image of the hard drive.  The tool will preserve file permissions, etc. Conversely, using something like a basic Tar Gzip backup archive might fail if you’re trying to copy broken files, etc.


To get started, make sure you’ve got the Rsync tool installed on both the remote and local PC:


sudo apt install rsync


sudo apt-get install rsync

Arch Linux

sudo pacman -S rsync


sudo dnf install rsync


sudo zypper install rsync

Other Linuxes

The Rsync tool is easy to find, even on the most obscure Linux distributions. In fact, you might already have it on your system. To install it, open up your package management tool, search for “rsync” and install it.

First, determine the IP address of the remote computer (if you don’t already know it by using Ping).

Note: use root over SSH to back up all of the system files.

LAN instructions

If your remote machine has internet access, but you can also directly connect to it over the LAN, you’ll be able to determine the IP address by pinging the hostname.

Keep in mind that if you’re on LAN, you’ll probably be able just to need the IP. Only do this when using hostname doesn’t work. For example:

ping ubuntu-server -c1

OUTPUT: PING ubuntu-server ( 56(84) bytes of data.

now we know the IP address of Ubuntu-server on LAN is:

Internet instructions

Like the LAN instructions, try using Ping to determine the IP. Example:

ping google.com -c1

OUTPUT: PING google.com ( 56(84) bytes of data.

When you’ve figured out the correct IP address, open up a terminal and enter this command on the local machine that will hold the backup data.

rsync -avP --numeric-ids --exclude='/dev' --exclude='/proc' --exclude='/sys' root@remote.ip.address:/remote/file/location /local/backup/destination/

Rsyncing an entire hard drive over the internet, or even LAN will take a long time due to many factors. Keep both computers on and let the transfer complete.

Remote Hard Drive Backup – DD Over SSH

If you need to make a quick hard drive image of a server or remote Linux PC via the internet, DD is a simple solution. It works by making use of command-line pipes, to chain a DD command from one machine to another. It can work by using the local computer to send a drive image to a remote host, or, in the opposite direction as well.

To accomplish this task, be sure that the remote PC can accept SSH connections on port 22 (or on whatever custom port is). Also be sure that both PCs have SSH running. Not sure how to set up an SSH connection? Check out our article here.

Note: in this example, the hard drive is /dev/sda, and the partition /dev/sda1. Yours may differ. Use lsblk on the remote computer to determine the drive letter name.

Remote To Local For Entire Hard Drive

ssh user@remote "dd if=/dev/sda1 | gzip -1 -" | dd of=image.gz

Remote To Local For A Separate Partition

ssh user@remote "dd if=/dev/sda1 | gzip -1 -" | dd of=image.gz

Local To Remote For Entire Hard Drive

dd if=/dev/sda | gzip -1 - | ssh user@local dd of=image.gz

Local To Remote For A Separate Partition

dd if=/dev/sda1 | gzip -1 - | ssh user@local dd of=image.gz

When the DD tool finishes creating the image backup, you’ll be able to restore it. There are many different ways to accomplish this task on Linux, but for ease of use, we recommend using Gnome Disk Utility. To restore the backup to a new hard drive, find the device on the left-side of the app and click on it. From here, click the menu at the top right, and click the “Restore Disk Image” button.

Note: restoring disk image backups will take a bit of time. Please be patient.

A dialog will pop up asking you to browse for a disk image. Select “all files,” then select “image.gz” to restore it.

Gnome Disk Utility can also restore DD backup partition images in the same way. Just click on the hard drive on the left, click the gear icon, then select the “Restore Partition image” button.


  1. Derrik, great summary article.

    FYI, you have a typo in the 1st DD example:

    Remote To Local For Entire Hard Drive
    ssh user@remote “dd if=/dev/sda1 | gzip -1 -” | dd of=image.gz

    should be

    ssh user@remote “dd if=/dev/sda | gzip -1 -” | dd of=image.gz

  2. How to restore remote machine if it is not bootable anymore and I have a HDD backup made by “DD Over SSH” method?
    Should I ask a hosting provider to install the same Linux version? But then how should I restore previous installation, including passwords and all settings?

    • Depends on your distro. One idea is to run a live distro of Ubuntu off a USB stick. Grab one of the desktop versions so you’ll have a GUI. If it doesn’t have a DD tool in the GUI, open a terminal and run DD. It’s just the reverse command of the one you used to create the backup.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.