[Techtalk] checking mounts

Miriam English mim at miriam-english.org
Sun Sep 27 08:38:00 UTC 2009

Thanks Little Girl. I came close to doing exactly that. It is a nice, 
straightforward solution. In the end I held off, hoping for something 
that would work even on new removable media.


	- Miriam

Little Girl wrote:
> Hey there,
> Sarah Newman wrote:
>> Well, actually it's all screwed up.
> <SNIP>
>> 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
> script:
> #!/bin/bash
> if [ -f /path/to/control/file/on/the/mounted/partition ];
> then
>  echo Exit code: $?
>  echo "Yep, mounted!"
> else
>  echo Exit code: $?
>  echo "Nope, not mounted! Mounting..."
>  sudo mount /path/to/mount/point
>  echo "Done"
> fi
> 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. (:

If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
Website: http://miriam-english.org
Blog: http://miriam_e.livejournal.com

More information about the Techtalk mailing list