Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a software or any other way to backup my home directory instantly so that if my data is lost I have another copy over the network.

I have a NAS on my local network and I want to have an exact copy of my machine home directory over there

I don't want a SYNC behavior. What I need is a MIRROR

share|improve this question
up vote 3 down vote accepted

A simple script using rsync tool could solve your problem. The script is:

while true
do rsync [source-folder] [destination-machine:folder]
sleep 5 

If you want a real-time backup then you can just remove sleep 5 or make it as acomment #sleep 5

To make it autostarted with your user, You can make a launcher then add this launcher to the startup Applications in order to autostart.

Moreover, you can find many other backup tools and other syncronization tools that help you but i just found this script easy to use

share|improve this answer

As outlined in the previous answers, rsync is the most efficient way for copying files over a network. This however requires you to manually initiate the mirroring process. If you want this to happen automatically like a one-way dropbox you can use lsyncd:

    sudo apt-get install lsyncd
    lsyncd -rsyncssh /home nashostname backup/dir/
share|improve this answer

Ubuntu 12.04 has a desktop backup application that serves that purpose.

You can search for "backup" in ubuntu dash and set the destination folder in "Storage" tab:

deja-dup storage destination folder options

You may choose FTP, SSH, WebDAV, Windows Share (Samba) or a local folder.

Programs in question are deja-dup and duplicity.

Note: Sorry, this answer seems a bit off-topic since you need a mirrored folder readily available (is this the case?) and deja-dup creates compressed archives. Note that deja-dup allows you to restore specific files from backups (right-click on any file/folder and select "Revert to previous version").

share|improve this answer

Duplicity is very good and can use rsync as a backend. What I like most about it is the ability to configure filters, so if there are huge files or files of certain extension you don't want backed up in that directory it's easy to make those adjustments. Note that deja-dup uses duplicity as it's backend and is a real easy way to get started, even creates sensible exclusion filters by default.

I recommend to cron this nightly. Start with a full backup once a week and then do an incremental nightly. See for good examples.

If you want true real time mirroring then DRBD is the way to go but it's not without risk or complexity. You must create a "block stack" in which drbd is backed by your data store and mount that. It has several protocols that trade off between data integrity and speed e.g. sync vs async. It also has the complexity of "split brain" where if the source and/or target have moved forward and are not talking to each other, DRBD has to figure out which one is the one source of truth, makes that the primary and forces the secondary to resync to that, get it wrong and you've lost your data.

So you have to ask yourself, do you really need a down instant a block IO is written mirror, and all the complexity and risk that goes with it, or will a periodic rsync (every 5m etc) be good enough?

Finally, data integrity is best down with a layered approached. Ideally your primary and secondary would both be backed by RAID 1 or similar then you would setup your sync with using the options provided that have a large spread in terms of trade offs between easy of use, data integrity, complexity, and risk.

share|improve this answer
Duplicity doesn't create a mirror, it stores its files in blobs. Without more elaborate means (such as replicative filesystems, etc), continuous rsync comes closest to the requirements. Rsync itself allows filters to define what to exclude. – Tatjana Heuser May 3 '14 at 21:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.