Unionfs move directory problems
GW
gw.freebsd at tnode.com
Tue Aug 12 01:47:20 UTC 2008
GW wrote:
> For the second problem:
> - in all cases (option whiteout=always or whenneeded) when new
> directories get created unionfs should check whether such a directory
> exists in the lower layer and automaticly whiteout all of its entries
- or better (can not work for more than 2 layers) copying all files to
upper layer in the moved directory and set the opaque flag, so that
underlying files under the new directory name can't be seen through
This is the way it is done on the end of the following scenario...
First a little different PROBLEM 1 again:
~# mkdir ro ro/foo ro/foo/moveme rw
~# touch ro/foo/moveme/file1
~# touch ro/foo/moveme/file2
~# ls -aFloWi orig
~# mount -t unionfs -o below ro rw
~# cd rw
~/rw# ls -aFloWi
total 6
49876 drwx------ 3 root wheel - 512 Aug 12 03:10 ./
49872 drwx------ 4 root wheel - 512 Aug 12 03:09 ../
49879 drwx------ 2 root wheel - 512 Aug 12 03:09 foo/
~/rw# ls -aFloWi foo/
total 6
49879 drwx------ 2 root wheel - 512 Aug 12 03:09 ./
49876 drwx------ 3 root wheel - 512 Aug 12 03:10 ../
49880 drwx------ 2 root wheel - 512 Aug 12 03:10 moveme/
~/rw# ls -aFloWi foo/moveme/
total 4
49880 drwx------ 2 root wheel - 512 Aug 12 03:10 ./
49879 drwx------ 3 root wheel - 512 Aug 12 03:10 ../
49877 -rw------- 1 root wheel - 0 Aug 12 03:10 file1
49878 -rw------- 1 root wheel - 0 Aug 12 03:10 file2
~/rw# mv foo/moveme/ .
~/rw# ls -aFloWi
total 8
49876 drwx------ 4 root wheel - 512 Aug 12 03:11 ./
49872 drwx------ 4 root wheel - 512 Aug 12 03:09 ../
49879 drwx------ 2 root wheel - 512 Aug 12 03:10 foo/
49880 drwx------ 2 root wheel - 512 Aug 12 03:10 moveme/
~/rw# ls -aFloWi foo
total 4
49879 drwx------ 2 root wheel - 512 Aug 12 03:10 ./
49876 drwx------ 4 root wheel - 512 Aug 12 03:11 ../
0 w--------- 0 root wheel - 0 Jan 1 1970 moveme%
~/rw# ls -aFloWi moveme/
total 4
49880 drwx------ 2 root wheel - 512 Aug 12 03:10 ./
49876 drwx------ 4 root wheel - 512 Aug 12 03:11 ../
<< again PROBLEM 1, nothing new
And now behavour that is a good solution for PROBLEM 2:
~/rw# mkdir foo/moveme
~/rw# ls -aFloWi foo/
total 6
49879 drwx------ 3 root wheel - 512 Aug 12 03:14 ./
49876 drwx------ 4 root wheel - 512 Aug 12 03:11 ../
49881 drwx------ 2 root wheel opaque 512 Aug 12 03:14 moveme/
~/rw# ls -aFloWi foo/moveme/
total 4
49881 drwx------ 2 root wheel opaque 512 Aug 12 03:14 ./
49879 drwx------ 3 root wheel - 512 Aug 12 03:14 ../
To proove that the opaque flag did the trick:
~/rw# chflags noopaque foo/moveme/
~/rw# ls -aFloWi foo/moveme/
total 4
49881 drwx------ 2 root wheel - 512 Aug 12 03:14 ./
49879 drwx------ 3 root wheel - 512 Aug 12 03:14 ../
49877 -rw------- 1 root wheel - 0 Aug 12 03:10 file1
49878 -rw------- 1 root wheel - 0 Aug 12 03:10 file2
gw
More information about the freebsd-fs
mailing list