View previous topic :: View next topic |
Author |
Message |
DingbatCA Guru
Joined: 07 Jul 2004 Posts: 384 Location: Portland Or
|
Posted: Wed Jun 18, 2008 11:25 pm Post subject: How do I check for a dead mount? |
|
|
How do I check for a dead mount?
So I pulled my USB drive out, with out unmounting it. I know I have a dead mount at /mnt/usb_drive. If I `ls` that dir it will hang. If I `df`, it will hang. So how do I check for dead mounts with out hanging? This also applies to NFS mounts. |
|
Back to top |
|
|
crazycat l33t
Joined: 26 Aug 2003 Posts: 838 Location: Hamburg, Germany
|
Posted: Thu Jun 19, 2008 3:35 am Post subject: |
|
|
There is a kernel message when you unplug a device, you can trap and use it wtih udev. |
|
Back to top |
|
|
DingbatCA Guru
Joined: 07 Jul 2004 Posts: 384 Location: Portland Or
|
Posted: Thu Jun 19, 2008 3:37 am Post subject: |
|
|
How about when an NFS mount is lost? |
|
Back to top |
|
|
d2_racing Bodhisattva
Joined: 25 Apr 2005 Posts: 13047 Location: Ste-Foy,Canada
|
Posted: Thu Jun 19, 2008 11:41 am Post subject: |
|
|
crazycat wrote: | There is a kernel message when you unplug a device, you can trap and use it wtih udev. |
Do you have an exemple of that plz ? |
|
Back to top |
|
|
crazycat l33t
Joined: 26 Aug 2003 Posts: 838 Location: Hamburg, Germany
|
Posted: Sat Jun 21, 2008 10:52 am Post subject: |
|
|
create a file /etc/udev/rules.d/99-something.rules
and put there for example.
Code: |
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /mnt/usb_%k"
|
That's my example, I add usb disk not with hal but with udev rules.
You have to rewrite this example depending on where your device was mounted. Also this line wont unmount a drive, if it's still being accesed( a broser window is sill open ). You have to killall every program which has a file handle opend on that device(you can determine that with "lsof"). That was a complex solution. I think it's easier to use hal, which should do this automatically. I can't help you with nfs but maybe hal can handle it. |
|
Back to top |
|
|
|