[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stale /usr/jails/*.devices




Hi all,

I just switched to using ezjail for a new FreeBSD 6.2 system I'm running. I'd like to say thanks, it sure beats the custom 300+ line shell script I wrote for FreeBSD 5.x.

There have been a few rough spots that I think could easilly be cleared up.

The biggest stoppage is that if the system gets rebooted, the /usr/jails/*.devices files are still there, and those jails won't restart because they think the device is already mounted - when in fact that device isn't, and may be attached to another jail's disk already.

I wrote a script that I hope will take care of this on boot...

<quote>
echo $0 - clear stale jail devices
if mdconfig -l | grep md > /dev/null
then
        echo - there are devices already. Doing nothing
else
        echo - removing stale /usr/jails/\*.devices
        echo - # rm -rf /usr/jails/\*.device
        rm -rf /usr/jails/\*.device
fi
</quote>

and put it in "/usr/local/etc/rc.d/00-cleardevices.sh" so it should run before ezjail.sh

It seems a bit lacking in elegance... Does anyone have any better ways of doing this?

Thanks, Nathan