Thursday Aug 06, 2009

Monitoring mounts

Sometimes in the course of being a system administrator it is useful to know what file systems are being mounted and when and what mounts fail and why. While you can turn on automounter verbose mode that only answers the question for the automounter.

Dtrace makes answering the general question a snip:

: exdev.eu FSS 24 $; cat mount_monitor.d                         
#!/usr/sbin/dtrace -qs

fbt::domount:entry
/ args[1]->dir /
{
        self->dir = args[1]->flags & 0x8 ? args[1]->dir : 
              copyinstr((intptr_t)args[1]->dir);
}
fbt::domount:return
/ self->dir != 0 /
{
        
        printf("%Y domount ppid %d, %s %s pid %d -> %s", walltimestamp, 
              ppid, execname, self->dir, pid, arg1 == 0 ? "OK" : "failed");
}
fbt::domount:return
/ self->dir != 0 && arg1 == 0/
{
        printf("\\n");
        self->dir = 0;
}
fbt::domount:return
/ self->dir != 0 && arg1 != 0/
{
        printf("errno %d\\n", arg1);
        self->dir = 0;
}
: exdev.eu FSS 25 $; pfexec /usr/sbin/dtrace -qs  mount_monitor.d
2009 Aug  6 12:57:57 domount ppid 0, sched /share/consoles pid 0 -> OK
2009 Aug  6 12:57:59 domount ppid 0, sched /share/chroot pid 0 -> OK
2009 Aug  6 12:58:00 domount ppid 0, sched /share/newsrc pid 0 -> OK
2009 Aug  6 12:58:00 domount ppid 0, sched /share/build2 pid 0 -> OK
2009 Aug  6 12:58:00 domount ppid 0, sched /share/chris_at_play pid 0 -> OK
2009 Aug  6 12:58:00 domount ppid 0, sched /share/ws_eng pid 0 -> OK
2009 Aug  6 12:58:00 domount ppid 0, sched /share/ws pid 0 -> OK
2009 Aug  6 12:58:03 domount ppid 0, sched /home/tx pid 0 -> OK
2009 Aug  6 12:58:04 domount ppid 0, sched /home/fl pid 0 -> OK
2009 Aug  6 12:58:05 domount ppid 0, sched /home/socal pid 0 -> OK
2009 Aug  6 12:58:07 domount ppid 0, sched /home/bur pid 0 -> OK
2009 Aug  6 12:58:23 domount ppid 0, sched /net/e2big.uk/export/install/docs pid 0 -> OK
2009 Aug  6 12:58:23 domount ppid 0, sched /net/e2big.uk/export/install/browser pid 0 -> OK
2009 Aug  6 12:58:23 domount ppid 0, sched /net/e2big.uk/export/install/cdroms pid 0 -> OK
2009 Aug  6 12:59:45 domount ppid 8929, Xnewt /tmp/.X11-pipe/X6 pid 8935 -> OK

In particular that last line if repeated often can give you a clue to things not being right.

Thursday Dec 06, 2007

Unable to mount the device? dtrace tells me why.

I had to copy a large movie file1 to work so rather then battle the corporate firewall, or pack my laptop in my pannier, I though I would just load it onto the USB pen drive I got at CEC.

When I inserted the pen drive instead of nautilus poping up with the contents I got a pop-up saying:

Unable to mount volume 'NO NAME'

No clue why though. A quick dtrace:

1192 # dtrace  -n 'syscall::mount:entry { printf("%s %s %s", copyinstr(arg0),>
dtrace  -n 'syscall::mount:entry { printf("%s %s %s", copyinstr(arg0), copyinstr(arg1), copyinstr(arg3)) } syscall::mount:return { printf("%s %d %d", execname, (int) arg1, errno) }'
dtrace: description 'syscall::mount:entry ' matched 2 probes
CPU     ID                    FUNCTION:NAME
  0  98800                      mount:entry /dev/dsk/c5t0d0p0:1 /media/NO NAME pcfs
  0  98801                     mount:return mount -1 30

and we have the answer. Who ever is calling mount assumes the file system is read-write but fails to try read-only when the mount fails. Flicking the switch on the side of the pen drive to read-write, something I was going to need anyway and reinserting it and I was away. Working out before dtrace would have been horrible this was so quick to do that it did not interfere with my breakfast.


Now I have to file the bug.


1The file was my first attempt at recording a presentation using http://www.screencast-o-matic.com/ from which I learned a number of things. First while I can talk to a room full of engineers or even a telephone without needing or wanting any form of script and not stutter or trip over my words when faced with a microphone that is recording I seem to have a problem. Secondly good though screencast-o-matic is it still took me over and hour to record 15 minutes of content and even that content is so bad I'm not putting it on the web. Clearly something I need to work on.

About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today