Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 just experienced data loss, so I am interested in some form of data duplication. I was thinking of mdadm and companions to raid 1 through software. However, I just want a given, not too big directory to be covered. I have no real experience with this sort of tools, however I understand that both LVM and mdadm require real block devices which therefore must be cleared of any existing data. That's not what I want. Of the 16Gb of my usb flash drive I just want to duplicate a tiny fraction, say 10Mb, possibly on a smaller usb flash drive, say 1Gb. Something that saves me to do a cron rsync. I am stuck at this point. So:

  1. Is there some other tool which will work like raid 1 but using logical directories as a backend, rather than block devices (drives, partitions etc...)?
  2. Alternatively, I could employ mdadm if only I could make look directories as block devices to the OS, reminiscent of a loop device. However, I do not want to pack the target directory inside, say, an image file, because this is clumsy (it is annoying to resize it if it grows in size) and not portable (I happen to work on many different OSes, Microsuck too: when I plug the usb flash inside a Win Os, I want to be able to access the target directory).
share|improve this question
up vote 2 down vote accepted

The ghetto way of doing this would be to set up a cron job which rsyncs the data to a backup directory every minute.

Alternatively, you could create two normal directories, then use ChironFS with FUSE to mount a filesystem which uses them as replicas - writes through the ChironFS mount would write to both directories. That would give you exactly what you want, although it would involve installing some random software.

share|improve this answer
Thanks, ChironFS is exactly what I fancied about in point 1) of my post. I am not proud of my googling abilities :) Now I am gonna de-orphan Chironfs Wikipedia page to better disseminate the knowledge you passed me. Solution 2) of my post would have been even cooler, though not being knowledgeable in the subject, I don't know how much feasible it is. – user495100 Jun 10 '11 at 17:37

This is a feature that is eventually planned for the btrfs filesystem, but for now, you are stuck with the cron sync or similar method.

share|improve this answer
Interesting, could you elaborate on that? Or give links? Specifically, what feature are you talking about? Looping a directory or raiding a directory? Anyway if limited to btrfs, it would break portability to the average M$ pc one meets on his way. – user495100 Jun 7 '11 at 14:05
ZFS can do this already (since 2006, in fact), using ditto blocks. – Tom Anderson Jun 7 '11 at 16:21
@user495100, the ability to set different raid levels on different files/directories in the fs. Just google for btrfs and read the wiki. Yes, ZFS has had the ability, but is not a supported Linux fs, which is one of the reasons for developing btrfs. – psusi Jun 7 '11 at 17:48

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.