mercredi 21 janvier 2015

Mount /var at boot runlevel 2 - problems


I'm working with a system that (for various reasons) often gets corruption on the /var partition. To this end I'm hoping to run e2fsck on it during the regular boot.


I've commented out the /var entry in /etc/fstab and added this script to runlevel 2:



#!/bin/sh

### BEGIN INIT INFO
# Provides: fsck
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop:
# Short-Description:
### END INIT INFO

# don't run if /var/www is already mounted
if [ -d /var/www ]
then
exit
fi

# make sure it hasn't mounted this alternate location
umount /dev/sda3
e2fsck -p /dev/sda3
mount /dev/sda3 /var


When this system is done booting it seems to be stuck at runlevel 6:



$ runlevel
2 6


This causes big headaches when trying to start services as they think the system is rebooting.


If I comment out the e2fsck line in the script the problem still occurs.


Attempts to use touch /forcefsck and entries in /etc/fstab (to force fsck at boot) aren't working - hence this approach.


Suggestions on what I'm doing wrong?



Aucun commentaire:

Enregistrer un commentaire