<!-- $FreeBSD$ -->

<!DOCTYPE article PUBLIC "-//FreeBSD//DTD DocBook V4.1-Based Extension//EN" [
<!ENTITY % man PUBLIC "-//FreeBSD//ENTITIES DocBook Manual Page Entities//EN">
%man;
]>

<article>
  <articleinfo>
    <title>ZIP Drives</title>

    <authorgroup>
      <author>
	<firstname>Jason</firstname>
	<surname>Bacon</surname>

	<affiliation>
	  <address><email>acadix@execpc.com</email></address>
	</affiliation>
      </author>
    </authorgroup>
  </articleinfo>

  <sect1>
    <title>ZIP Drive Basics</title>

    <para>ZIP disks are high capacity, removable, magnetic disks, which can be
      read or written by ZIP drives from IOMEGA corporation.  ZIP disks are
      similar to floppy disks, except that they are much faster, and have a
      much greater capacity.  While floppy disks typically hold 1.44
      megabytes, ZIP disks are available in two sizes, namely 100 megabytes
      and 250 megabytes.  ZIP drives should not be confused with the
      super-floppy, a 120 megabyte floppy drive which also handles traditional
      1.44 megabyte floppies.</para>

    <para>IOMEGA also sells a higher capacity, higher performance drive called
      the JAZZ drive.  JAZZ drives come in 1 gigabyte and 2 gigabyte
      sizes.</para>

    <para>ZIP drives are available as internal or external units, using one of
      three interfaces:</para>

    <orderedlist>
      <listitem>
	<para>The SCSI (Small Computer Standard Interface) interface is the
	  fastest, most sophisticated, most expandable, and most expensive
	  interface.  The SCSI interface is used by all types of computers
	  from PC's to RISC workstations to minicomputers, to connect all
	  types of peripherals such as disk drives, tape drives, scanners, and
	  so on.  SCSI ZIP drives may be internal or external, assuming your
	  host adapter has an external connector.</para>

	<note>
	  <para>If you are using an external SCSI device, it is important
	    never to connect or disconnect it from the SCSI bus while the
	    computer is running.  Doing so may cause file-system damage on the
	    disks that remain connected.</para>
	</note>

	<para>If you want maximum performance and easy setup, the SCSI
	  interface is the best choice.  This will probably require adding a
	  SCSI host adapter, since most PC's (except for high-performance
	  servers) do not have built-in SCSI support.  Each SCSI host adapter
	  can support either 7 or 15 SCSI devices, depending on the
	  model.</para>

	<para>Each SCSI device has its own controller, and these
	  controllers are fairly intelligent and well standardized, (the
	  second `S' in SCSI is for Standard) so from the operating system's
	  point of view, all SCSI disk drives look about the same, as do all
	  SCSI tape drives, etc.  To support SCSI devices, the operating
	  system need only have a driver for the particular host adapter, and
	  a generic driver for each type of device, i.e. a SCSI disk driver,
	  SCSI tape driver, and so on.  There are some SCSI devices that can
	  be better utilized with specialized drivers (e.g. DAT tape drives),
	  but they tend to work OK with the generic driver, too.  It is just
	  that the generic drivers may not support some of the special
	  features.</para>

	<para>Using a SCSI zip drive is simply a matter of determining which
	  device file in the <filename>/dev</filename> directory represents
	  the ZIP drive. This can be determined by looking at the boot
	  messages while FreeBSD is booting (or in
	  <filename>/var/log/messages</filename> after booting), where you
	  will see a line something like this:</para>

	<programlisting>da1: &lt;IOMEGA ZIP 100 D.13&gt; Removable Direct Access SCSI-2 Device</programlisting>

	<para>This means that the ZIP drive is represented by the file
	  <filename>/dev/da1</filename>.</para>
      </listitem>

      <listitem>
	<para>The IDE (Integrated Drive Electronics) interface is a low-cost
	  disk drive interface used by many desktop PC's.  Most IDE devices
	  are strictly internal.</para>

	<para>Performance of IDE ZIP drives is comparable to SCSI ZIP drives.
	  (The IDE interface is not as fast as SCSI, but ZIP drives
	  performance is limited mainly by the mechanics of the drive, not by
	  the bus interface.)</para>

	<para>The drawback of the IDE interface is the limitations it imposes.
	  Most IDE adapters can only support 2 devices, and IDE interfaces are
	  not typically designed for the long term. For example, the original
	  IDE interface would not support hard disks with more than 1024
	  cylinders, which forced a lot of people to upgrade their hardware
	  prematurely.  If you have plans to expand your PC by adding another
	  disk, a tape drive, or scanner, you may want to invest in a SCSI
	  host adapter and a SCSI ZIP drive to avoid problems in the
	  future.</para>

	<para>IDE devices in FreeBSD are prefixed with a <literal>a</literal>.
	  For example, an IDE hard disk might be
	  <filename>/dev/ad0</filename>, an IDE (ATAPI) CDROM might be
	  <filename>/dev/acd1</filename>, and so on.</para>
      </listitem>

      <listitem>
	<para>The parallel port interface is popular for portable external
	  devices such as external ZIP drives and scanners, because virtually
	  every computer has a standard parallel port (usually used for
	  printers).  This makes things easy for people to transfer data
	  between multiple computers by toting around their ZIP drive.</para>

	<para>Performance will generally be slower than a SCSI or IDE ZIP
	  drive, since it is limited by the speed of the parallel port.
	  Parallel port speed varies considerably between various computers,
	  and can often be configured in the system BIOS.  Some machines will
	  also require BIOS configuration to operate the parallel port in
	  bidirectional mode.  (Parallel ports were originally designed only
	  for output to printers)</para>
      </listitem>
    </orderedlist>
  </sect1>

  <sect1>
    <title>Parallel ZIP: The <devicename>vpo</devicename> Driver</title>

    <para>To use a parallel-port ZIP drive under FreeBSD, the
      <devicename>vpo</devicename> driver must be configured into the kernel.
      Parallel port ZIP drives also have a built-in SCSI controller. The vpo
      driver allows the FreeBSD kernel to communicate with the ZIP drive's
      SCSI controller through the parallel port.</para>

    <para>Since the vpo driver is not a standard part of the kernel (as of
      FreeBSD 3.2), you will need to rebuild the kernel to enable this device.
      The process of building a kernel is outlined in detail in another
      section.  The following steps outline the process in brief for the
      purpose of enabling the vpo driver:</para>

    <orderedlist>
      <listitem>
	<para>Run <command>/stand/sysinstall</command>, and install the kernel
	  source code on your system.</para>
      </listitem>

      <listitem>
	<para>Create a custom kernel configuration, that includes the
	  driver for the vpo driver:</para>

	<screen>&prompt.root; <userinput>cd /sys/i386/conf</userinput>
&prompt.root; <userinput>cp GENERIC MYKERNEL</userinput></screen>

	<para>Edit <filename>MYKERNEL</filename>, change the
	  <literal>ident</literal> line to <literal>MYKERNEL</literal>, and
	  uncomment the line describing the vpo driver.</para>

	<para>If you have a second parallel port, you may need to copy the
	  section for <literal>ppc0</literal> to create a
	  <literal>ppc1</literal> device.  The second parallel port usually
	  uses IRQ 5 and address 378.  Only the IRQ is required in the config
	  file.</para>

	<para>If your root hard disk is a SCSI disk, you might run into a
	  problem with probing order, which will cause the system to attempt
	  to use the ZIP drive as the root device.  This will cause a boot
	  failure, unless you happen to have a FreeBSD root file-system on
	  your ZIP disk!  In this case, you will need to <quote>wire
	    down</quote> the root disk, i.e. force the kernel to bind a
	  specific device to <filename>/dev/da0</filename>, the root SCSI
	  disk.  It will then assign the ZIP disk to the next available SCSI
	  disk, e.g. <literal>/dev/da1</literal>. To wire down your SCSI hard
	  drive as <literal>da0</literal>, change the line

	  <programlisting>device  da0</programlisting>

	  to

	  <programlisting>disk da0 at scbus0 target 0 unit 0</programlisting></para>

	<para>You may need to change the target above to match the SCSI ID of
	  your disk drive. You should also wire down the scbus0 entry to your
	  controller.  For example, if you have an Adaptec 15xx controller,
	  you would change

	  <programlisting>controller scbus0</programlisting>

	  to

	  <programlisting>controller scbus0 at aha0</programlisting></para>

	<para>Finally, since you are creating a custom kernel configuration,
	  you can take the opportunity to remove all the unnecessary drivers.
	  This should be done with a great deal of caution, and only if you
	  feel confident about making modifications to your kernel
	  configuration. Removing unnecessary drivers will reduce the kernel
	  size, leaving more memory available for your applications.  To
	  determine which drivers are not needed, go to the end of the file
	  <filename>/var/log/messages</filename>, and look for lines reading
	  "not found". Then, comment out these devices in your config file.
	  You can also change other options to reduce the size and increase
	  the speed of your kernel. Read the section on rebuilding your kernel
	  for more complete information.</para>
      </listitem>

      <listitem>
	<para>Now it is time to compile the kernel:</para>

	<screen>&prompt.root; <userinput>/usr/sbin/config MYKERNEL</userinput>
&prompt.root; <userinput>cd ../../compile/MYKERNEL</userinput>
&prompt.root; <userinput>make clean depend && make all install</userinput></screen>
      </listitem>
    </orderedlist>

    <para>After the kernel is rebuilt, you will need to reboot.  Make sure the
      ZIP drive is connected to the parallel port before the boot begins. You
      should see the ZIP drive show up in the boot messages as device vpo0 or
      vpo1, depending on which parallel port the drive is attached to.  It
      should also show which device file the ZIP drive has been bound to. This
      will be <filename>/dev/da0</filename> if you have no other SCSI disks in
      the system, or <filename>/dev/da1</filename> if you have a SCSI hard
      disk wired down as the root device.</para>
  </sect1>

  <sect1>
    <title>Mounting ZIP disks</title>

    <para>To access the ZIP disk, you simply mount it like any other disk
      device. The file-system is represented as slice 4 on the device, so for
      SCSI or parallel ZIP disks, you would use:</para>

    <screen>&prompt.root; <userinput>mount_msdos /dev/da1s4 /mnt</userinput></screen>

    <para>For IDE ZIP drives, use:</para>

    <screen>&prompt.root; <userinput>mount_msdos /dev/ad1s4 /mnt</userinput></screen>

    <para>It will also be helpful to update <filename>/etc/fstab</filename> to
      make mounting easier. Add a line like the following, edited to suit your
      system:

      <programlisting>/dev/da1s4  /zip msdos rw,noauto  0 0</programlisting>

      and create the directory <filename>/zip</filename>.</para>

    <para>Then, you can mount simply by typing

      <screen>&prompt.root; <userinput>mount /zip</userinput></screen>

      and unmount by typing

      <screen>&prompt.root; <userinput>umount /zip</userinput></screen></para>

    <para>For more information on the format of
      <filename>/etc/fstab</filename>, see &man.fstab.5;.</para>

    <para>You can also create a FreeBSD file-system on the ZIP disk using
      &man.newfs.8;.  However, the disk will only be usable on a FreeBSD
      system, or perhaps a few other Unix clones that recognize FreeBSD
      file-systems.  (Definitely not DOS or Windows.)</para>
  </sect1>
</article>
