Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I check for a dead mount?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
DingbatCA
Guru
Guru


Joined: 07 Jul 2004
Posts: 384
Location: Portland Or

PostPosted: Wed Jun 18, 2008 11:25 pm    Post subject: How do I check for a dead mount? Reply with quote

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
View user's profile Send private message
crazycat
l33t
l33t


Joined: 26 Aug 2003
Posts: 838
Location: Hamburg, Germany

PostPosted: Thu Jun 19, 2008 3:35 am    Post subject: Reply with quote

There is a kernel message when you unplug a device, you can trap and use it wtih udev.
Back to top
View user's profile Send private message
DingbatCA
Guru
Guru


Joined: 07 Jul 2004
Posts: 384
Location: Portland Or

PostPosted: Thu Jun 19, 2008 3:37 am    Post subject: Reply with quote

How about when an NFS mount is lost?
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Thu Jun 19, 2008 11:41 am    Post subject: Reply with quote

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
View user's profile Send private message
crazycat
l33t
l33t


Joined: 26 Aug 2003
Posts: 838
Location: Hamburg, Germany

PostPosted: Sat Jun 21, 2008 10:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum