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.
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:
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:
/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.