[Unionfs] How to merge branches ?
Arun Sharma
arunain at gmail.com
Thu Jul 2 08:26:34 EDT 2009
Hello Erez,
I was trying to merge all branches which is mounted using unionfs , but
couldn't find any standard process to achieve this. Using unionfs we can
only create unionised view but can we create merged directory (which will
contain contents of all branches). I thought i could mount two branches on
/merge (See details below) and copy or archive the directory into another
directory but not sure is this is correct approach. ?
My only intent is to create merged directory of all branches.
Here are the steps i have tried.
[root at cogdm52_1 ~]# mkdir /d1
[root at cogdm52_1 ~]# mkdir /d2
[root at cogdm52_1 ~]# touch /d1/f1
[root at cogdm52_1 ~]# touch /d2/f2
[root at cogdm52_1 ~]#mount -t unionfs -o dirs=/d1:/d2=ro none /merge
[root at cogdm52_1 ~]# ls /merge/
f1 f2
[root at cogdm52_1 ~]# rm /merge/f1
[root at cogdm52_1 ~]# touch /merge/.hide
[root at cogdm52_1 merge]# cd /merge
[root at cogdm52_1 merge]# ls -la
total 8
drwxr-xr-x 2 root root 4096 Jul 2 06:52 .
drwxr-xr-x 29 root root 4096 Jul 2 06:46 ..
-rw-r--r-- 1 root root 0 Jul 2 06:46 f2
-rw-r--r-- 1 root root 0 Jul 2 06:52 .hide
When i Option 1 this command it copies hidden file as well which is right
also.
*Option 1
-------------------
*[root at cogdm52_1 ~]# find . | cpio -p /opt/test/
[root at cogdm52_1 ~]# ls -la /opt/test/
drwxr-xr-x 7 root root 4096 Jul 2 07:13 .
drwxr-xr-x 3 root root 4096 Jul 2 07:13 ..
-rw-r--r-- 1 root root 0 Jul 2 06:46 f2
-rw-r--r-- 1 root root 0 Jul 2 06:52 .hide
*Option 2
-------------------*
[root at cogdm52_1 merge]# cp -ax * /opt/test/
[root at cogdm52_1 ~]# ls -la /opt/test/
drwxr-xr-x 7 root root 4096 Jul 2 07:13 .
drwxr-xr-x 3 root root 4096 Jul 2 07:13 ..
-rw-r--r-- 1 root root 0 Jul 2 06:46 f2
Is there any better utility to merge and create one single directory of all
branches ?
--
Regards
Arun Sharma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.fsl.cs.sunysb.edu/pipermail/unionfs/attachments/20090702/4f96153c/attachment-0001.htm
More information about the unionfs
mailing list