sf...@users.sourceforge.net> wrote:
>
> Hello Alexandre,

Hello Junjiro,

late answer, sorry, I've been busy.

> Alexandre Levavasseur:
> > The result is here : https://gist.github.com/Alex131089/560a1386dd756059e21b
> >  .
> >
> > It does the same as fsck.mergerfs for the permissions (but using another
> > method to find branches), and it checks for useless whiteouts (hoping I'm
> > not misunderstanding the thing). While it's working, it has only been
> > tested on 2 RW branches, the whiteout part has a beginning (I didn't check
> > all possibilities) of support for non-RW but permissions are not RW/RO
> > aware.
>
> There is a script called auchk.
>
> (from README in aufs-util.git)
> ----------------------------------------------------------------------
> o /usr/bin/auchk
>   Similar to generic fsck. Checks whether a branch is healthy or not
>   from aufs's point of view.
> ----------------------------------------------------------------------
>
> (from aufs manual)
> ----------------------------------------------------------------------
> If a sudden accident such like a power failure happens during aufs is
> performing, and regular fsck for branch filesystems is completed after
> the disaster, you need to extra fsck for aufs writable branches. It is
> necessary to check whether the whiteout remains incorrectly or not,
> eg. the real filename and the whiteout for it under the same parent
> directory. If such whiteout remains, aufs cannot handle the file
> correctly.
> To check the consistency from the aufs' point of view, you can use a
> simple shell script called /sbin/auchk. Its purpose is a fsck tool for
> aufs, and it checks the illegal whiteout, the remained
> pseudo\-links and the remained aufs\-temp files. If they are found, the
> utility reports you and asks whether to delete or not.
> It is recommended to execute /sbin/auchk for every writable branch
> filesystem before mounting aufs if the system experienced crash.
> ----------------------------------------------------------------------
>
> Its purpose is very similar to yours, but what to check is different.

the name "fsck.aufs" is probably badly chosen, as it does only "high
level" verifications which are probably not strictly necessary to
aufs.
My goal is not to verify one/each branch, but the branches as a whole
(assuming they are clean to aufs / aufschk), to try to "optimize" what
can be.

> I don't think your check_consistancy() is meaningful because users can
> change the file's mode, uid or gid anytime (and anywhere).

This can cause permission issues with 2 RW branches, doesn't it ?

> To remove the whiteout-ed entries on the lower branch, there is a script
> called aubrsync in the same git tree. Also you may try aumvdown.

But from what I understand, aubrsync will try to move all files from
one branch to the other one, and aumvdown has to be called on each
file where I detect a whiteout ?
I use aufs only to union 2 FS where both have the same priority (both
RW), so aubrsync doens't seems applicable here ?
And for aumvdown I need to detect the whiteouts first.

> > [1]: 2 RW branches on 3.2 kernel (OMV actually), 1 root cron script running
> > a sed -i command => leaves me 1 sed temporary file + it's whiteout each
> > time .. I suppose something's wrong but I can't figure what (or maybe it
> > is/was an aufs issue ?), or I just don't get everything.
>
> It looks more interesting to me.
> Would you post the details following the README file?

Sure :)
But I might have found the problem very recently : OMV applied ACL to
one of the FS, I removed them and since I no more have those
whiteouts. But as I updated the system in the meanwhile, it may also
be that.
ACL aren't supported from what I read ? Is there any warning message ?

> ----------------------------------------------------------------------
> When you have any problems or strange behaviour in aufs, please let me
> know with:
> - /proc/mounts (instead of the output of mount(8))
> - /sys/module/aufs/*
> - /sys/fs/aufs/* (if you have them)
> - /debug/aufs/* (if you have them)
> - linux kernel version
>   if your kernel is not plain, for example modified by distributor,
>   the url where i can download its source is necessary too.
> - aufs version which was printed at loading the module or booting the
>   system, instead of the date you downloaded.
> - configuration (define/undefine CONFIG_AUFS_xxx)
> - kernel configuration or /proc/config.gz (if you have it)
> - behaviour which you think to be incorrect
> - actual operation, reproducible one is better
> - mailto: aufs-users at lists.sourceforge.net
> ----------------------------------------------------------------------

Attached, with the script cron-launched.

>
>
> J. R. Okajima

By the way, I don't mean to add more to this script as it does what I
need, it's only to share it.

Thank you,
-- 
Alexandre L.
root@omv:/boot# cat /export/Medias/\!Dépot/Aria/\!ZeScript.sh
#!/bin/bash

# root@omv:/export/Medias/!Dépot/Aria# ls -la
# total 16
# drwxrwsr-x  2 nobody users 4096 Aug 21 22:26 .
# -rw-r-----  1 root   users 3258 Aug 21 22:25 !Archives.txt
# -rw-rw-r--  1 alex   users    0 Aug 21 22:25 !ToDL.txt
# -rwxr-xr--  1 root   users 1223 Aug 21 22:22 !ZeScript.sh

# SU owned, rw, r
archives='!Archives.txt'
# User owned, rw, rw, r
todl='!ToDL.txt'

sepline=--------------------------------------------------------------------------------
wecho() {
  echo $*$'\r'
}

# Entering working directory
pushd `dirname $0` >/dev/null

wecho >> $todl
sed -i '/^\s*$/d' $todl

# Do we have something to download ?
if [ -s $todl ]; then
  # Add new list to download list & empty new list
  wecho \# New content at $(date +'%F %T %z') >> $archives
  wecho \# $sepline >> $archives
  cat $todl >> $archives
  wecho \# $sepline >> $archives
  # Sanity check
  chmod 640 $archives
  chmod 664 $todl
  # Empty ToDL file
  :>$todl

  # Download (extract download result)
  #umask 0002
  wecho \# Results >> $archives
  wecho \# $sepline >> $archives

  sudo -u nobody -g users -- sh -c "umask 0002; aria2c -j3 -U 'aria2/$VERSION - 
Alex' --summary-interval=0 --auto-file-renaming=false -i $archives" | \
    sed -n '/Results/,/Legend/p' | head -n -2 | tail -n +2 | sed 's/^/# 
/;s/$/\r/' | tee -a $archives

  wecho \# $sepline >> $archives
  wecho \# >> $archives
  wecho \# >> $archives

  # Comment out downloaded content
  sed -i '/^[^#]/ s/^/#/' $archives
else
  echo Nothing to do.
fi

# Leaving directory
popd >/dev/null

# Done

Attachment: aufs.log
Description: Binary data

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

Reply via email to