I have no idea if the following will help us but I list it here
for info. If anyone can make improvements on the old advice (4/98),
please do so!

Idris
===
http://www.linuxgazette.com/issue28/lg_tips28.html#atapi

I just bought an IDE ATAPI iomega Zip drive, and I couldn't find any help
at all on how to
use it. So, I slogged through, got a great hint from Jeff Tranter
(maintainer of the 'eject'
utility), and managed to get it working. In the spirit of giving back to
the community, here's
my (maybe even) five cent tip. 

Here's how to use an IDE ATAPI zip drive on Linux. 

First, the kernel: Do _not_ use the "IDE FLOPPY" option (officially the
name is
CONFIG_BLK_DEV_IDEFLOPPY ). This will work perfectly for reading and
writing,
but it will not work for ejecting. What you need to do is say yes to the
option
CONFIG_BLK_DEV_IDESCSI. When this is set, you will treat the IDE ATAPI
drive
just like a SCSI drive, except without the SCSI card and all that other
garbage. 

After making your kernel, you should get these messages in your startup
messages (type
dmesg at the prompt if they go by too fast to read): 

 
hda: WDC AC34000L, 3815MB w/256kB Cache, CHS=969/128/63
hdb: WDC AC34000L, 3815MB w/256kB Cache, CHS=969/128/63
hdc: TOSHIBA CD-ROM XM-6102B, ATAPI CDROM drive
hdd: IOMEGA ZIP 100 ATAPI, ATAPI FLOPPY drive - enabling SCSI emulation
ide2: ports already in use, skipping probe
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
Floppy drive(s): fd0 is 1.44M
FDC 0 is a post-1991 82077
scsi0 : SCSI host adapter emulation for IDE ATAPI devices
scsi : 1 host.
  Vendor: IOMEGA    Model: ZIP 100           Rev: 24.D
  Type:   Direct-Access                      ANSI SCSI revision: 00
Detected scsi removable disk sda at scsi0, channel 0, id 0, lun 0
scsi : detected 1 SCSI disk total.
SCSI device sda: hdwr sector= 512 bytes. Sectors= 196608 [96 MB] [0.1
GB]
sda: Write Protect is off
.
.
.
Partition check:
 sda: sda4
 hda: hda1 hda2 hda3 hda4
 hdb: hdb1 hdb2 hdb3

The key is that SCSI simulation will be used only if the native ATAPI
driver for that device
isn't found. So, since the ATAPI CD driver was compiled into the kernel,
it used it. Since
the ATAPI removable disk driver wasn't, SCSI emulation was used. 

Second, the device: If you want to have non-root users be able to mount,
unmount, and
eject the Zip disks, you've got to make a couple of changes to the default
configuration.
First thing to do is to change the permissions on the device. As root,
type the following: 

 
chmod a+rw /dev/sda4

The next thing to do is set a shortcut (eject is easier). Again, as root,
type the following: 

 
ln -s /dev/sda4 /dev/zip

Third, the mount point: Create a mount point for your drive. I like
/mnt/zip, so I just do a
mkdir /mnt/zip. For ease, you now want to put this into your /etc/fstab.
Put a line in that file
that looks like 

 
/dev/sda4                 /mnt/zip                  auto   user,noauto 0
0

The first column is the device, followed by the mount point. The first
'auto' means that it will
check to see the file system type when it is mounted. (Hence, you can read
not only ext2fs,
but also FAT, VFAT, etc.) The 'user' keyword allows average users to mount
the disk,
and the 'noauto' means that it will not be mounted at startup. I don't
know what the two
zero's mean, but it works for me. 

Now, at this point, any user should be able to mount the Zip disk by
typing 

 
mount /mnt/zip

Unmounting would just be umount /mnt/zip. 

Fourth, formatting the disks: The Zip disks you buy at your corner
computer store are
formatted for MSDOS. Personally, I prefer to have ext2fs formatted disks,
so I don't have
to worry about file name conflicts. Hence, I have to reformat them. There
are two other
oddities. First, the writable partition will be number 4. This is a
Macintosh-ism, which you
might as well leave. You can run fdisk and change the partition, but it
will be much easier to
just leave all your disks the same, and that way you won't have to change
the line in
/etc/fstab for each disk. Second, the initial permissions are not set to
be writeable by the
user. 

To handle all this, I do the following, as root (new disk, initially
unmounted): (WARNING:
This will erase all data on the disk!) 

 
/sbin/mke2fs -m 0 /dev/sda4
mount /mnt/zip
chmod a+w /mnt/zip
umount /mnt/zip

Now, whenever the user mounts that disk, she will be able to write to it. 

Fifth, ejecting: The entire reason for using SCSI emulation is to make it
easy to eject the
disk. It's easy now: 

 
eject zip

You can also say 'eject /dev/sda4', but since you created the symbolic
link '/dev/zip', eject
knows what you mean when you just say 'zip'. 

One thing about eject is that the average user does not have permission to
use it. So,
change the permission via setuid: 

 
chmod a+s /usr/bin/eject

That should allow any user to eject any disk. 

Sixth, zip tools: Jarrod A. Smith ([EMAIL PROTECTED]) has written a
really nifty little
program to make mounting, unmounting, ejecting, documenting, and write
protecting Zip
disks really easy. The name is jaZip, and it is available as an RPM
package
(jaZip-0.22-3.i386.rpm) from the usual download sites, including
ftp://ftp.redhat.com. Go
ahead and download it -- it's only 24 K! 

I hope that covers everything -- if anybody has any questions, please let
me know! 

Steve Beach 

Reply via email to