Showing posts with label disk. Show all posts
Showing posts with label disk. Show all posts

Tuesday, December 16, 2008

Monitor dd(1) progress

When using dd(1) on command line you might want to see the speed it is being used at and its progress. This can be done by sending SIGUSR1 signal to the process, like so:

1. start dd: dd if=/dev/urandom of=/dev/zero

2. in another terminal run ps and find the dd's PID and send it SIGUSR1 signal like so:

kill -SIGUSR1 PID

which will output the results but in the first terminal where you started the dd process:

712107+0 records in
712106+0 records out
364598272 bytes (365 MB) copied, 64.4686 s, 5.7 MB/s

You can take this a bit further if the dd process is copying a large file and run it in a while loop at n intervals:


> while :
> do
> kill -SIGUSR1 13925
> sleep 5
> done

Thursday, August 7, 2008

Map device names in Solaris

Sometimes you want to know what devices are being mapped to instance names. To do that I use this script:

#!/usr/bin/ksh

DISKS=$(/usr/bin/ls /dev/dsk/*s2)

for D in ${DISKS}
do
INST=$(/usr/bin/ls -l ${D} | /usr/bin/awk -F" " '{print $NF}' |\
/usr/bin/sed -e 's/\.\.\/\.\.\/devices//g' -e 's/:[a-z]//g')

DEV=$(/usr/bin/grep ${INST} /etc/path_to_inst | /usr/bin/sed 's/\"//g'|\
/usr/bin/awk '{print $3$2}')

echo "${DEV} ${D}"
done
You'll get something like:

sd0 /dev/dsk/c0t0d0s2
sd9 /dev/dsk/c0t10d0s2
sd10 /dev/dsk/c0t11d0s2
sd11 /dev/dsk/c0t12d0s2
sd6 /dev/dsk/c0t6d0s2
sd7 /dev/dsk/c0t8d0s2
sd8 /dev/dsk/c0t9d0s2


Also noted that SarCheck provide a similar tool called dmap, only available for SPARC. This is a script, therefore can be used on x86 and SPARC, as well as machines which are not allowed to have non supported binaries installed on them :)

But if you can install binaries on your systems, then you might want to compile your own from here .