In message <[EMAIL PROTECTED]>, Sylvain Ferrand writes:
> Hi,
> 
> Right, I'm merging a read-only branch (in a compact flash disk) and a rw 
> branch in a tmpfs. Periodically I want to remount in read-write mode the 
> compact flash branch to synchronize back the changes made on the tmpfs.
> Then I used rsync to copy files from 'raw' tmpfs branch to CF branch.
> I also use   "mount -o remount,incgen ..." to flush caches after the 
> copy. It works pretty well even if the unionfs manpage (4) indicate this 
> warning " Modifying a Unionfs branch directly, while the union is 
> mounted is currently unsupported.  Any such change can cause Unionfs to 
> oops, however it could even RESULT IN DATA LOSS".

Sylvain, if you're using Unionfs 2.1, you can safely ignore this OLD man
page from unionfs 2.0 days -- it's safe today to modify the lower files all
you want.

> Now I have a new problem, even after performing rsync, the content of 
> the tmpfs is not deleted and then continue to grow. Therefor I would 
> like to flush the tmpfs branch after a rsync. A simple 'rm' on the tmpfs 
> branch make the union inconsistent, at that time some deleted files 
> completely disappeared from the union (even if they are in the other 
> branch). A remount with "incgen" does not change anything.
> Do you have an idea?
> Thanks by advance.

OK, so if I understood you, after you resync from the tmpfs back to the
flash, you want to delete all files from the tmpfs and then start again.  In
that case, it would be best to first remove the tmpfs branch from your
union, then rm -rf it, and then add it back to your union.  So the rough
order of events will be something like that (I didn't try it yet):

- assume /tmpfs is your tmpfs partition and /flash is your writeable flash
- mount -t unionfs -o dirs=/tmpfs:/flash none /union
- you make whatever changes through the union
- then you follow the procedure we already discussed to flush changes from
  /tmpfs to /flash
- mount -t unionfs -o remount,ro /union
        # the above is probably needed before you can
        # remove /tmpfs from the union, IF /flash is
        # mounted readonly
- mount -t unionfs -o remount,del=/tmpfs none /union
- rm -rf /tmpfs/*
- mount -t unionfs -o remount,add=/tmpfs none /union
- mount -t unionfs -o remount,rw none /union

> Sylvain

Erez.
_______________________________________________
unionfs mailing list: http://unionfs.filesystems.org/
unionfs@mail.fsl.cs.sunysb.edu
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to