Skip to content

Server notes

The best Linux copy and backup method: Rsync vs cp

Start a backup with cp, then keep it current with rsync. The difference matters once the archive is larger than the first copy.

By Jozsef 2 min read

I needed a backup method for my laptop, with a USB hard disk and a Linux prompt. The first copy is simple. Keeping it current is where the right tool matters.

1. Make the first copy

After mounting the USB disk, I used cp for the initial copy:

bash
cp -rpv /home/ /media/usb-hdd

The flags preserve permissions and timestamps, and the verbose output shows progress.

2. Keep the backup current with rsync

From the second run onward I use rsync. It copies only the files that changed, which is why it is so much faster for a repeated backup:

bash
rsync -av /home/ /media/usb-hdd/home/

The trailing slashes matter. /home/ copies the contents of the directory, while /home would copy the directory itself into the target.

Which one to use

Use cp for a fresh, empty destination. Use rsync for every run after that. If the backup is remote, add -e ssh and point rsync at the remote host.

Sources and further reading