fstab

Rishi Viner rishi at puredata.com.au
Sun Jul 16 22:55:24 EDT 2006


Bob,

There is always a way! You may just have to dig a little deeper. (You can try 
your Option 1). 

This new hot pluggable way of dealing with removable drives is managed through 
the dynamic device file system /dev/. The management of this across most 
*nix's seems to be migrating to a utility called udev. Ubuntu seems to use it 
too:
http://packages.ubuntulinux.org/breezy/admin/udev
but that is besides the point as we need a unerversal way to do this on any 
distro. 

Have a look on the udev home page:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
and read everything you can on udev and hotplug. A good quick into is on the 
Gentoo site: 
http://www.gentoo.org/doc/en/udev-guide.xml

The problem begins with the fact that all removable drives (USB, floppy, CD 
etc), especially these days, really are removable. You could have five USB 
floppies attached one day and none the next. Why have a static device system 
like fstab for that? It doesn't make sense, so the distro makers define rules 
for dynamically creating and naming these devices as they are inserted and 
removed. To solve the problem you will need to look into these rule systems 
to find out what sort of name you should be looking for in the dynamic device 
file system...

One solution would be to use udevinfo to find block devices (/sys/block/*) 
that have the SYSFS{removable}=="1" flag set (meaning the device is 
removable). Then find out how the kernel identifies that device from the 
KERNEL=="fd0" line. Then look at how this device is configured by hotplug in 
the hotplug rules file. You will see a line like:
KERNEL=="fd0", SYMLINK+="floppy". This tells us that a symlink will be made 
like: /dev/floppy when the floppy is plugged in. The "floppy" name its self 
could be anything your distro makers might choose (fd, floppy, fdd, etc). The 
final name might be variable too. E.g. SYMLINK+="floppy%n" would 
make /dev/floppy1, /dev/floppy2, etc for each drive. 

Complicated though. Who uses floppy drives anymore anyway? I know with usb 
drives the rules could specify that the device is mounted using the volume 
label as a name, so you can keep track of which one out of the 4 USB drives 
you really mean to use... This would make what you are doing even harder. Why 
not just ask the user to tell your program where they want to put something?

;)

Rishi.


On Saturday 15 July 2006 03:02, Bob Warren wrote:
> Following what I have just said, I am snookered anyway!
>
> The fstab is supposed to tell us whether or not a floppy drive exists in
> the hardware. It no longer does that reliably. So there is no point in
> trying to mount a drive which might not exist! If you DO try to mount a
> drive which does not exist in the hardware, then the failure in Rev will
> not give an error anyway!
>
> As far as I see it, the only other hope of resolving this situation lies
> in 6 directions:
>
> 1) Provide an alternative way of discovering whether or not there is a
> floppy physically on the system, independent of examining the fstab.
>
> 2) Ask Rev to arrange some kind of error code when an attempt to mount a
> drive through the shell fails.
>
> 3) Shoot the Linux distro producers.
>
> 4) Commit suicide.
>
> 5) Return to using only Windows, accompanied by sneers and jeers.
>
> 6) Take a nice long nap and hope that things will have sorted themselves
> out by the time I (we) wake up.
>
> I am inclined to choose #6. It's Friday.
>
> Bob
>
> ________________



More information about the use-livecode mailing list