In the latest (CR9-10) versions of his firmware Oleg did a lot of efforts to make boot up process more transparent. I can mention pre-mount file which appeared in the CR9 version, and fstab file which appeared a bit earlier, but its usage is still not enough covered in the existing tutorials.
I'd like to admit in advance, that I'm not going to cover usage of the post-firewall, because it stands a bit separately.
Russian speaking part of our community has already had possibility to test these features, as they were available in the post-8 preview versions since late December. So, this topic was already discussed here: http://wl500g.info/showthread.php?t=12221 and the major feedback is already incorporated in it.
/etc/fstab
After 8 months of the usage of wl500g Premium I decided to upgrade my hdd, and partition a new one in a "clever" way. I created the file /etc/fstab with the following content:
PHP Code:
#device Mountpoint FStype Options Dump Pass#
/dev/discs/disc0/part1 none swap sw 0 0
/dev/discs/disc0/part2 /opt ext3 rw,noatime 1 1
/dev/discs/disc0/part3 /opt/home ext3 rw,noatime 1 1
/dev/discs/disc0/part4 /home ext3 rw,noatime 1 1
/dev/discs/disc1/part2 /mnt ext3 rw,noatime 1 1
[Last two parameters in every line are not used in our case. So, you can put any.]
[To save the content of the /etc/fstab file in the flashfs do the following:
PHP Code:
echo "/etc/fstab >> /usr/local/.files
flashfs save && flashfs commit && flashfs enable
]
The idea of such partitioning was:
/opt --- programs
/home --- archive
/opt/home --- file system for current downloads and other temporary stuff
/mnt --- previous hdd, which will be removed later.
Ideally, one more separate partition can be mounted to /var or /opt/var so that the /opt can be mounted read only. So, the overall reliability of the system can be increased even more, however it's idea for the next upgrade. The most risky file system (from the point of view of possible data loss) is /opt/home. Therefore, it is extracted in a separate and not very big partition. In my system completed downloads are automatically moved to /home, and, if it is necessary to share something, the symlinks in /opt/home are created.
[Remark: if you're going to use /opt/home as a mount point like in this example, don't forget to create this directory first: mkdir /opt/home ]
/usr/local/sbin/pre-mount
The first advantage, which became easily possible with appearance of the pre-mount file --- the routine check of the file systems during boot up.
So, the pre-mount file may look like this:
PHP Code:
#! /bin/sh
swapon -a
for i in `awk '/ext3/{print($1)}' /etc/fstab` ; do
if [ -b $i ] ; then
grep -q $i /proc/mounts || e2fsck -p $i 2>&1 | logger -t e2fsck
else
logger -t fstab "$i is not attached"
fi
done
This file performs e2fsck check of every entry of the fstab file, which describes file system of the type ext3 (if such partition is attached to the system).
Why do we need this? Check the log file after rebooting (of course, with suggested pre-mount file):
PHP Code:
/dev/discs/disc0/part2: recovering journal
/dev/discs/disc0/part2: clean, 15942/245280 files, 102559/489982 blocks (check after next mount)
/dev/discs/disc0/part3: recovering journal
/dev/discs/disc0/part3: clean, 5141/1835008 files, 1148511/3664828 blocks (check in 5 mounts)
/dev/discs/disc0/part4: recovering journal
/dev/discs/disc0/part4: clean, 73/12517376 files, 3719155/25023245 blocks (check after next mount)
/dev/discs/disc1/part2: recovering journal
/dev/discs/disc1/part2: clean, 36785/2431680 files, 341863/4857654 blocks (check in 2 mounts)
It doesn't looks really nice. It does seem that asus have not done any effort to unmount filesystems on correct shutdown. So, that graceful rebooting using 'halt' or 'restart' and taking off power supply have equal effect. However, if we go with Oleg, then we have a chance to improve situation (using pre-shutdown file).
[Remark: file systems in unix are usually organized in such a way that the full check of the apparently good f.s. is enforced when some conditions are met. It can be either number of mounts, or number of days since last check or something else. With our router (at least most of the models) there is one potential problem --- we don't have RTC, therefore, we obtain time from ntp servers. Some people may find that the disks are checked before obtaining of the correct time. In this case e2fsck will believe that the last check occurred very long ago and enforce full check on every boot up. It may be annoying, because checking of the large partitions may take really looong time. To disable such check by the time since the last check do the following:
PHP Code:
tune2fs -i 0 /dev/discs/disc0/part1
to see current settings of the f.s. see:
PHP Code:
tune2fs -l /dev/discs/disc0/part1
]
[Remark2: In the latest 10th version of his FW Oleg disabled this check at all so nothing should be done now]