views:

127

answers:

4

Hello,

I got an old library which does some manipulation with files on floppy\ CD (transferring the files on network paths). This library has a thread which checks on each second whether the file (e.g. the floppy diskette\ the CD disk) is mounted.

Why? What operations can be done only on mounted files?

Thanks a lot.

+3  A: 

In unix system devices are mounted, not files. e.g. /dev/fd0 is a device file (a file representing a device). You cannot access the files on a device without having it mounted.

EricSchaefer
That's not exactly true. Files can be treated as devices and mounted as part of the filesystem (though you usually have to specify -o loop). This is especially useful for doing things like mounting an ISO file so you can treat it like a cdrom for installing off of (except way faster) or for editing an initial ramdisk image.
George
Well, /dev/fd0 is also just a file that is treated in a special way. You know "everything is a file"... ;-)
EricSchaefer
+1  A: 

Disk volumes (drives) should always be mounted in Linux before they can be used. May be the purpose of this thread is to keep checking the floppy disk and abort the operation if someone has ejected and it is unmounted.

Imran S.
+4  A: 

To access a file in any way - read, write, execute, delete - you need to be able to specify its location. The location of a file is always its position in the directory tree, where Unix has just a single directory tree starting at a single root.

Unless the device your file is on (and hence its own (sub)directory tree) is in the "main" directory tree, it isn't accessible.

Incorporating a device's directory tree into the system's "main" directory tree is what's known in the Unix world as "mounting".

Carl Smotricz
A: 

the same reason for which you need an access-point to use a network.

Adil Butt