[Techtalk] checking mounts

Little Girl littlergirl at gmail.com
Sun Sep 27 04:13:57 UTC 2009

Hey there,

Sarah Newman wrote:

> Well, actually it's all screwed up.


> I haven't looked at the entire boot process to know exactly where
> these come in, but anyway point being that for a partition mounted
> during boot, the partition name shown may not match the current
> name of the partition.

I'm not sure if this would work for you, but this is how I do it with
my NFS mount. I put a control file (a known existing file), either
visible or hidden, on the partition I want to mount. Then I run this

if [ -f /path/to/control/file/on/the/mounted/partition ];
 echo Exit code: $?
 echo "Yep, mounted!"
 echo Exit code: $?
 echo "Nope, not mounted! Mounting..."
 sudo mount /path/to/mount/point
 echo "Done"

You could go one step further and rewrite the script slightly to
create another script that checks if you're mounted and then unmounts
if you are, or just rewrite that one so it asks you which you want to
do depending on whether you're mounted or not.

I should do that last one because NFS will freeze up Konqueror if the
other computer shuts down before I unmount it, and I haven't figured
out how to fix that without a full reboot, which is annoying. (:

Little Girl

There is no spoon.

More information about the Techtalk mailing list