Timothy Jones on 20 Apr 2011 17:51:10 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Merging home directories

Hi Gordon,

It sounds like the mhddfs program might be a good solution for your problem.  It is package in Debian and Ubuntu, and can be downloaded for other distributions:


It is a FUSE based method to merge directory trees.  For example,
if you have a directory called test1 and test2, and you would want 
to merge these into a directory called merged, the command would

mhddfs /home/test1 /home/test2 /home/merged

This will merge all the content in directory test1 and test2 into directory merged.  An important note is that if there are two files with exactly
the same name and placement in the directory tree in test1 and test2,
the file in test1 takes precedence.  Thus one would want to make sure
that you list the directories with the newest ones first. 

Assuming that you don't want to keep a permanent copy of the old 
folders, you can copy the "merged" folder into your new folder:

rsync -avr /home/merged /home/username

Then you unmount the merge directory:

fusermount -u  /home/merged

And you can do whatever you want with the older directories, though
I would strongly advise keeping backup copies if possible until you
are fully satisfied that you've successfully merged your directories.

If, however, you want to keep older copies of duplicate files, then you
may need more complicated solutions:


Or, possibly, you could create a second merged folder, say, merged2, which is mounted in reverse order so that the older file is selected for the merged folder, and then run a script that compares the two merged directories and makes a duplicate copy of files that differ between them, say, file.txt.OLDER.

In any case, I suggest testing this out on some fake directories first to get the hang of it, and be sure to have backups :)

Good luck!


On Wed, Apr 20, 2011 at 8:04 PM, Gordon Dexter <gordon@texasdex.com> wrote:
I have the unenviable task of merging 5 different home directories from three different computers, spanning 5 years, and I was wondering if there was any tool that might simplify things.  My eventual goal is to have one unified, well organized home directory that is versioned (e.g. via Git) and synced between multiple computers.  The last few times I've moved or upgraded I just put the previous home directory as a subfolder of the newer one, so on one computer I have /home/gdexter/old_gdexter/older_gdexter and I haven't even gotten around to doing that on my newest computer.  This is compounded by bad habits such as putting things on the desktop if I don't know what to do with them.

I'd rather not lose anything, of course, but I'd also rather not go through each homedir item by item and manually copy or merge things.  Are there tools that help you with this sort of thing?  Any suggestions to save my sanity?


Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug

Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug