"tovis":
> Other question (may be suggestion) is it possible to now that the
> underlaying branch is read-only? The mount and cat /proc/mounts also sad
> that mount is rw!? - it is really confusing (I have lost many hours and
> hair).

I guess what you want is /sys/fs/aufs/si_*/br[0-9]*.

----------------------------------------------------------------------

> Short way, I want minimize writes to USB which used as a hard disk, in an
> embedded like equipment, move the life time up to year or more.
> To reach this I have to use aufs, to unify some directories and files from
> /var of the system. But I need to keep some important, not to recently
> written configuration files, such as alsamixer settings, or crontab. With
        :::

First, you should clearly categorize your /var files by these points of view.
- how frequently is the file written?
- is the change important and you want to save it into usb, or is it ok
  to discard the change?
- etc...

By these categories, you can choose (or mixture) several operations.
Let's forget about aufs in the beginning.

A.
# mount /dev/usb /var
# mount -t tmpfs none /var/log
# mkdir -p /var/log/brabra ...

A'.
# mount /dev/usb /var
# mount -t tmpfs none /dev/shm
# mkdir -p /dev/shm/log /dev/shm/lock ...
# for i in log lock ...
> do mount -o bind /dev/shm/$i /var/$i
> done

B.
# mount -t tmpfs none /var
# mkdir -p /var/testing /var/lib/alsa ...
# mount /dev/usb /usb
# for i in testing lib/alsa ...
> do mount -o bind /usb/$i /var/$i
> done

The approach A and A' is for files you don't want to keep on usb. These
/var/log and /var/lock will be gone after shutdown since they are on
tmpfs. All other files are kept on usb and you access them during your
system is running.

The approach B is for files you want to keep on usb. Most of /var files
are on tmpfs, but some of them which you picked and mounted with "bind"
are on usb. The files you make bind-mount stay on usb.

For your purpose, I'd suggest these two approaches.


> One more question, is it possible to change/modify a built up branch -
> making rw from ro of the lower part?

Try "mount -o remount,mod:/usb=ro /var"


J. R. Okajima

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d

Reply via email to