Tuesday, January 20, 2009

Getting maximum info at booting

As I already written above, it's very useful to know all the current processes in boot time. You can get more interesting information. If we look at the contents of "live-devices-local" script in OpenSolaris LiveCD we'll see possibility to use iosnoop with output in logfile (iosnoop uses DTrace to monitor disk events in real time):

...
# Turn on I/O tracing if requested and possible
trace=`prtconf -v /devices|sed -n '/trace/{;n;p;}'|cut -f 2 -d\'`
if [ "$trace" = "on" ]; then
if [ -n "$mntpt" ]; then
outputfile="${mntpt}/traceout"
echo "Enabling I/O Tracing ..." > /dev/console
/opt/DTT/Bin/iosnoop -Deg > "$outputfile" 2> /dev/console &
# Wait for iosnoop to actually initialize
sleep 10
else
echo "Unable to enable I/O Tracing" > /dev/console
echo "Must have a mountable Solaris root slice on harddisk" > /dev/console
echo "to hold trace output" > /dev/console
fi
fi
...

Here's another fast way without using "live-devices-local" script: boot with "-m milestone=none" and next (I'm using opensnoop):

mount -F tmpfs -o size=32m swap /var/log
/opt/DTT/Bin/opensnoop -eg > /var/log/opensnoop.log &
svcadm milestone all

Except iosnoop a lot of helpful information can be gathered using other DTrace scripts (opensnoop,errinfo) with various arguments. For example, the opensnoop script considerably simplifies search of all files necessary for booting without errors.

No comments: