MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*DocIndex - Hardware

Removable Storage III (IDE I)

* ATAPI
* CD-ROM, DVD
* CD-R(W)

Related Resources:

'ide.txt' in 'linux/Documentation'
CDROM-HOWTO
CD-Writing-HOWTO
DVD-HOWTO
The Linux Video and DVD Project

Revision / Modified: Sep. 11, 2001 / May 14, 2002
Author: Tom Berger

 

* ATAPI

ATAPI (Advanced Technology Attachment Packet Interface) is an extension to ATA, the protocol used by the IDE (Integrated Drive Electronics) controller to control hard disks. ATAPI implements a subset of SCSI commands to allow connected devices to change media during system runtime (ATA doesn't allow this, therefore you can't 'hotswap' IDE hard drives). So, from a software point of view, ATAPI devices are handled like SCSI devices (e.g. by the DOS/Windows ASPI driver).
External ATAPI devices are connected via the parallel port and require special treatment. Supported internal ATAPI storage devices include IDE/ATAPI floppies (e.g. ZIP, LS-120), ATAPI tape drives (e.g. Ditto EIDE, HP Colorado), ATAPI CD-R(OM/W) and PD-CDs. Most of them are accessed via the GNU/Linux ide (former hd) driver.

If you want to find out which device is connected to what channel, explore '/proc/ide' (e.g. less /proc/ide/ide1/hdc/model will tell you what kind of hardware is hooked up on '/dev/hdc').

Naming Conventions In GNU/Linux

Everything in GNU/Linux is a file. IDE/ATAPI devices make no exception. The usual PC has two IDE ports with two channels, each allowing a total of four connected devices each. Since ATA(PI) doesn't allow multitasking on devices connected to the same port (they share an IRQ), these devices have to be marked with jumpers as either 'master' or 'slave' (on most hard disks there is a third setting: 'master without slave / single'). Read more about this on theIDE hard drives page.

GNU/Linux calls these four channels '/dev/hda' (first channel, master), '/dev/hdb' (first channel, slave), '/dev/hdc' (second channel, master) and '/dev/hdd' (second channel, slave). If you've got another IDE controller, say a Promise UDMA100 chip or card, this list just goes on with 'e', 'f' etc. for the channels of this chip or card.
The 'master' device on the first IDE controller ('/dev/hda') usually is a hard disk. This is the default boot device. Chances are that your GNU/Linux installation is there as well. Since multitasking is only supported for devices on different ports, other IDE devices are usually connected to the second port (usually '/dev/hdc' if single or master or '/dev/hdd').

If the device connected to the port features partitions, you need a means to access them. This is done by numbering: the first partition on the master drive on the first controller is /dev/hda1, the second /dev/hda2 etc. (in contrast to DOS/Windows which treats every partition as a hard disk of its own).

Too easy so far? Right :-). If you need more than four partitions on an x86 hard drive for Linux (or more than one for DOS/Windows9x), you will have to create a so-called 'Extended Partition' on one of these four partitions. This is because the partition table in the main boot sector has room only for four entries and DOS/Windows9x can't cope with more than one primary partition. An 'Extended Partition' has a partition table of its own which is much larger. This special type of a partition holds so-called 'Logical Partitions'.
Why am I telling you all this? Well, guess what the first logical partition on a master drive on the first IDE port in x86 GNU/Linux is called... It's /dev/hda5 (the 'D drive' in DOS/Windows), regardless if you have 4 primary partitions or not.
Confused? Run

/sbin/cfdisk -P /dev/hda

(or use 'diskdrake') which will give you an overview on the partition layout of your hard disk and how GNU/Linux names your partitions. Familiarize yourself with it, it will come in handy from time to time.
If you're on a Mac, you don't have to care nuts about all this, because no operating system or BIOS needs these hacks on a Mac. The only peculiarity you might notice are the 'Apple' partitions at the beginning of your hard drive. These special purpose mini-partitions are needed by the Macintosh operating system. Just don't touch them.

These things are important because some removable storage media use partitioning tricks for Mac or Windows compatibility as you will see later.

* section index * top

* CD-ROM, DVD

CD-ROM drives are the most popular ATAPI devices, in fact they have been the reason to introduce to introduce this protocol. Back in the old days, every drive came with its own controller, protocol and command set, which was a nightmare.
CDs do not have partitions, since the file system used on them (ISO9660) doesn't support this. So you access the whole disk via '/dev/hdc' or '/dev/hdd' (on Macs, you will also find CD-ROMs connected to '/dev/hdb'). Mandrake automatically creates a link to '/dev/cdrom' upon installation. Run

ls -l /dev/cdrom

to see the 'real' device name of your CD-ROM drive. If you have more than one CD-R(OM/W) the second is linked as '/dev/cdrom1'.
The only reason for these links is to make it easier to remember them.

The standard mount directory for CD-R(OM/W)s is '/mnt/cdrom' ('/mnt/cd' in older releases). Insert a CD and - if you are using a pre-7 release or don't use 'supermount' - mount it by clicking on the CD-ROM icon on your desktop or by issuing the command mount /dev/cdrom.
To open the tray from the command line, use the eject /dev/cdrom command, which comes in especially handy on computers without any mechanical means to eject CDs, like the Mac Cube.

Audio CDs

You won't be able to play mounted audio CDs, they can only be played unmounted. If you are using 'supermount', you have to unmount the CD first (since it will be mounted automatically) before playing it:

umount /mnt/cdrom

should do the trick.

DVD

DVD drives are handled just like CD-ROM drives. Accessing or writing data likewise is no problem. Due to the somewhat tricky licensing situation and the fact that there is no licensed DVD player for the Linux desktop yet, watching most DVD films on Linux is a bit cumbersome, if not illegal in some countries (read: USA), though. Try VideoLAN or xine. Don't bother reading the outdated DVD HOWTO.

* section index * top

* CD-R(W)

IDE CD-R(W) drives (i.e. CD burners) are not handled like simple CD-ROM drives, but like SCSI devices. CDs are burnt unmounted.
Some older Mandrake releases have had problems with the default configuration, 7.1 and later should work out of the box, though.
You still want to read this if you are adding a new IDE CD-RW to an installed system and Mandrake doesn't configure it correctly. If you're using a Mandrake Linux 8.x system, please refer to Configuring An IDE CD/RW Drive On ML 8.1 By Hand.

Pre-7.0

  1. Find out which is the 'real' device name for your burner:
    ls -l /dev/cdrom
    I will assume it's '/dev/hdc'. If your system features two CD drives, you'll have to find out whether it's either '/dev/cdrom' or '/dev/cdrom1' by exploring '/proc/ide' and adapting the next steps accordingly.

  2. As 'root' edit /etc/conf.modules and add this line:
    alias scsi_hostadapter ide-scsi

  3. As 'root' edit /etc/lilo.conf and add the line
    append = "hdc=ide-scsi"
    to the section starting with image=[...]. If you are using GRUB, add hdc=ide-scsi to the boot commandline in '/boot/grub/menu.lst'.

  4. Run lilo.

  5. Put the line modprobe ide-scsi into '/etc/rc.d/rc.local'.

  6. Reboot.

  7. Test: Put a CD into your burner. As 'root' mount it with
    mount /dev/scd0 -t auto /mnt/cd
    (note the different device file, your IDE drive is handled like a SCSI CD-R(W) now!).

  8. As root change the /dev/cdrom link to the new device file:
    ln -sf /dev/scd0 /dev/cdrom

  9. To allow users to burn CDs (e.g. with X-CDRoast) either add them to the 'disk' group in /etc/group or create a new group like 'cdwriter' (chances are this group is already there), add privileged users, and change the ownership on /dev/sda:
    chgrp cdwriter /dev/scd0
    (If you have no idea what the hell I'm talking about, check out the article on file permissions).

7.0

IDE CD-R(W)s are configured automatically in ML 7. There is a small glitch, though: the installation program links /dev/cdrom[1] to the wrong device file (i.e. to '/dev/hd[x]' and not to '/dev/scd0'). Executing step 1 and 8 should help.

Packet Writing

Packet Writing is based on the new UDF (Universal Disk Format) file system, a replacement for the aging ISO9660 file system on CD-R(OM/W)s and it is the standard file system on movie DVDs. Packet Writing allows a much more convenient way to burn CDs (essentially it allows them to be treated like hard disks). Although UDF is a part of the 2.4 kernel, Packet Writing still is far from being usable.

* section index * top

* LS-120, ZIP, ORB, Tapes

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.