32

I created 2 virtual machines with VMware Workstation 7. They have identical hardwares. One guest is CentOS 5.6, another is Mandriva 2011. When I try to mount the cdrom in guest OS, in CentOS, I should execute

mount /dev/hdc /path/to/mount

in Mandriva, I should execute

mount /dev/sr0 /path/to/mount

I also remebered in some other Linux variant, I had to use

mount /dev/cdrom /path/to/mount

My questions are:

  1. What's the difference between hdc, sr0 or cdrom?
  2. Is there a consistent way to mount cdrom in all Linux variants?
1

3 Answers 3

32
/dev/hdc

is the third IDE hard drive - Secondary Master.

/dev/sr0

is the first SCSI CD-ROM device in the system. This may be misleading as SCSI and SATA are interchangeable in Linux terminology. There is also SCSI emulation of ATAPI devices in some Unix systems (in FreeBSD it's called ATAPICAM) which makes ATAPI CD-ROM devices appear to be SCSI. Some older software is written purely to interface with SCSI peripherals and can't work with ATAPI ones, so this emulation layer can be quite useful.

/dev/cdrom

And yes, that is a symlink to one of the above - either done manually with ln or through the udev configuration.

0
9

/dev/hdc is a device on the ide controller.

/dev/sr0 is a device on the scsi controller.

/dev/cdrom is a symlink to either /dev/sr0 or /dev/hdc or whichever block device is appropriate. Most distributions come with a script that automatically sets up /dev/cdrom to be the correct device. So you're generally safe using /dev/cdrom. If you don't have /dev/cdrom you can always set it up yourself with ln -s

2
  • Thanks, but I double checked my virtual machine's devices. Both type are IDE. At least in Workstation's devices list, both are identified as "CD/DVD (IDE)".
    – Landy
    Apr 19, 2011 at 7:40
  • If you don't believe me then check dmesg. For sr0 you should see something like: [2.995168] sr 3:0:0:0: Attached scsi CD-ROM sr0 In newer kernel versions they changed the controllers and the drivers around so that more stuff would sit on SCSI. So even if you have the same hardware, a different kernel can do the trick. Apr 19, 2011 at 8:10
3

The /dev/hdc is the older name for IDE CDROM (usually configured in hardware as the third IDE device). Old kernels and user space that use the IDE driver will show it as that. Newer kernels and userspace tools use libata, and map everything to scsi-like devices. So /dev/sr0 is now the first scsi-rom (zero). /dev/cdrom is usually a symlink to the first CD-ROM device.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .