Cobalt df: cannot read table of mounted filesystems

Had an old cobalt system with the following issue:

[root /root]# df
df: cannot read table of mounted filesystems

Checking the mtab file it showed:

[root /root]# ls -la /etc/mtab
-rw-r–r–    1 root     root            0 Apr 20 11:32 /etc/mtab

So, for some reason it wasn’t updating the mtab file. Tried the following which pointed the finger at the possible problem:

[root /root]# cat /proc/mounts > /etc/mtab
cat: write error: No space left on device

Searching through the contents of the / partition with “du -sh dirs” show some files that could be moved to another position.  Once moving the files and creating a symlink the mtab could be regenerated with the cat /proc/mounts > /etc/mtab command and then df -h started to work.

The machine was probably rebooted and /etc/mtab recreated, however, as there wasn’t any space on the / partition could not re-populate the mtab file.

Regenerating the Cobalt RAQ550 stats

Had to rebuild the webstats for a client on a RAQ550 as for some reason the stats had been corrupted.

The URL to view the stats was: http://www.site.com/stats/

Checking the crontabs showed that there was a script that ran nightly: /etc/cron.daily/webalizer.pl

The script ran through all the sites and built the stats pages for them along with various other things.  The bit we were interested in was:

/usr/local/bin/webalizer -D /home/log/dns.cache -p -n $asite -s $asite -r $asite -q -Q -T -o $thepath $prefix/$asite/logs/web.log

Made a backup of the stats and logs directories with:

mkdir /root/sitestats_backup
tar -cf /root/sitestats_backup /home/sites/www.site.com/logs
tar -cf /root/sitestats_backup /home/sites/www.site.com/web/stats

There were .gz files in the log directory and an empty web.log.  Obviously the web.log file is not populated until the stats program runs later in the day.  Created a combined web.log file in the sites logs directory with:

zcat web.log.3.gz web.log.2.gz web.log.1.gz > web.log.combined

Then, running webalizer:

cd /home/sites/www.site.com/web/stats

/usr/local/bin/webalizer -D /home/log/dns.cache -p -n www.site.com -s www.site.com -r www.site.com -q -Q -T -o /home/sites/www.site.com/web/stats /home/sites/www.site.com/logs/web.log.combined

However, webalizer skipped a lot of entries… so, deleted all the entries in the stats directory (rm *) and then re-ran the command above.  This generated all the stats again without issue.