(You didn't specify your operating system. I'm assuming it's some
variant of GNU/Linux, the general concept applies to other UNIXes
as well; details may not.)
1. How does one know what the device file for a device is in general?
Basically, you have to know which device file name corresponds to
Sources of this information are the
Linux kernel documentation,
udev configuration files (look into
/etc/udev) and the
The correct explanation is quite longer here: the Linux kernel
identifies devices by a pair of numbers,
called the "major" and the "minor" device numbers. Any device file
having the major and minor number of your CD-ROM device will be
treated by the kernel as that CD-ROM device; so you could create (see
mknod command) a CD-ROM device
/my/cdrom and use that;
likewise, you could use any naming convention you like for any device.
However, so much system software depends on finding a device by name
that it's too much work to change device names from the "standard".
The actual device names used on the system are partly the result of
history (e.g., the
/dev/hdX names for disk drives -
somebody started using those in the beginning of times and the name
stuck), part the result of an agreement between the people developing
some low-level parts of the system (mainly, the kernel, libC and
2. Do I have to create in advance the directory to which the device is mounted to?
Yes, mount will not create that directory for you.
The reason you see the mount points for CDs, USB sticks and other
devices automagically appearing into
/media is that some daemon
process has created that for you. (On GNU/Linux running the GNOME
desktop it goes roughly as follows: you insert the CD, the mount
directory is created, the CD is mounted and -possibly- a file manager
window is opened. Almost everything can change, depending on the exact
Linux version and distribution.)
But on the command-line, you're on your own and have to create the
mount point yourself.
3. Can a device be mounted to several places, without unmounting?
If you mean "how to make the contents of the CD appear in various
places of the filesystem", then yes, you can do that using a feature
called "bind mount".
Bind mount can be "replicate" any directory on the filesystem appear
in another, disjoint, part of the filesystem. For instance, you could
give the command:
mount --bind /var/tmp /mnt
and this will make replicate the contents of
/var/tmp into the
/mnt: if you create a file
/var/tmp/foo, you will see
the same file appearing as
You can find more information on
mount and its operation at: