Linux Tips


Installing and Configuring an IEEE1394 FireWire Hard Drive on Linux

by Jeff Hunter, Sr. Database Administrator



Developed by Apple Computer and Texas Instruments, FireWire is cross-platform implementation of a high-speed serial data bus. With its high bandwidth, long distances (up to 100 meters in length) and high-powered bus, FireWire is being used in applications such as digital video (DV), professional audio, hard drives, high-end digital still cameras and home entertainment devices. Today, FireWire operates at transfer rates of up to 800 megabits per second while next generation FireWire calls for speeds to a theoretical bit rate to 1600 Mbps and then up to a staggering 3200 Mbps. That's 3.2 gigabits per second.

Linux kernels 2.4.12 and above contain support for IEEE1394 devices, including disk drivers. (Support can be added to some earlier kernels). The Red Hat 7.3 release uses kernel 2.4.18-3 (built with hotplug-2002_04_01-3) while Red Hat 8.0 uses kernel 2.4.18-14 (built with hotplug-2002_04_01-13).

This article documents the steps necessary to install and configure an IEEE1394 hard drive on Red Hat 8.0 Linux. For this example, I will install a BUSlink USB 2.0 HI-Speed/1394 Combo Hard Drive to a Dell Dimension XPS D266 Computer. In addition to purchasing the FireWire hard drive, you will also need to purchase an IEEE1394 I/O Card.

Connecting and Recognizing the Drive

The following modules are used to access the disk, noted in the order they are loaded.

With Red Hat 8.0, you should be able to power down the computer, install the IEEE1394 I/O Card, plug in the FireWire hard drive and power on the system. During the boot process, when Linux is bringing up all of its services, the "Checking for New Devices" phase should recognize the new IEEE1394 device, giving you the option of installing the module. By acknowledging this dialog, the process should create the proper entry in /etc/rc.sysinit:

... # Ooh, firewire too. aliases=`/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }'` if [ -n "$aliases" -a "$aliases" != "off" ]; then for alias in $aliases ; do [ "$alias" != "off" ] && action $"Initializing firewire controller ($alias): " modprobe $alias done grep -q "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe sbp2 >/dev/null 2>&1 fi ...

During the next boot phase, you will then see the following entry when Linux is starting all of its services:

... Initializing firewire controller ohci1394 ...

With Red Hat 7.3, the kernel will not know anything about IEEE1394 disks, even if they are connected at the time of reboot. In order to recognize the disks, the ieee1394 and ohci1394 modules must be loaded:

# modprobe -v ohci1394

This loads both ieee1394 and ohci1394. /var/log/messages shows:

kernel: ohci1394: $Revision: 1.101 $ Ben Collins kernel: PCI: Found IRQ 5 for device 00:0f.0 kernel: ohci1394_0: OHCI-1394 1.0 (PCI): IRQ=[5] MMIO=[fedfb000-fedfb800] Max Packet=[2048]

For verfication that our disk is now being recognized, we can "cat" /proc/scsi/scsi. This shows all scsi devices on the system, and should show our newly connected disk:

# cat /proc/scsi/scsi Attached devices: Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: SAMSUNG Model: SP8004H Rev: Type: Direct-Access ANSI SCSI revision: 06

The FireWire hard drive can now be accessed, formatted with fdisk, mounted, exercised, etc.


Do not use parted to format or partition the disk -- it causes the system to hang/crash.

Formatting the Disk

The BUSlink hard drive comes formatted with a single Windows VFAT32 partition. This can be read and written from linux, but file ownership/protection doesn't really exist in the unix sense. I typically remove the the VFAT32 partition and replace it with ext3.

First ensure, that the ohci1394 module is loaded. For details of loading the ohci1394 module, see the next section Configuring the System.

Partition the disk for ext3

# fdisk /dev/sda1 The number of cylinders for this disk is set to 9730. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): d Partition number (1-4): 1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-9730, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-9730, default 9730): 9730 Command (m for help): p Disk /dev/sda1: 255 heads, 63 sectors, 9730 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/sda1p1 1 9730 78156193+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.

Formatting the disk for ext3 using mkfs

# mkfs -t ext3 /dev/sda1 mke2fs 1.27 (8-Mar-2002) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 9781248 inodes, 19541056 blocks 977052 blocks (5.00%) reserved for the super user First data block=0 597 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

The above format command creates an ext3 filesystem. Once you reformat the disk for Linux, it will not be recognized on a windows system. You can't even reformat the disk on windows, because it will refuse to acknowledge that the disk exists. So, on a linux computer, you will have to reformat it back to vfat

To format the disk back for Windows, use the same procedure as above, but in the fdisk command, use "b" instead of "83" for the partition code. Then give the command:

# mkfs.vfat -F 32 -v /dev/sda1

Configuring the System

  1. Loading the ohci1394 module.

    As mentioned in the Connecting and Recognizing the Drive section (above), Red Hat 8.0 should handle the process of loading the ohci1394 module by writing an entry in /etc/rc.sysinit. If you are using Red Hat 7.3 or if the auto-detection did not work, you will need to put the following entry in /etc/rc.local to ensure an ieee1394 disk connection will cause the disk to be recognized:

    # /sbin/modprobe ohci1394

  2. Add entry to /etc/fstab.

    Add the following line to /etc/fstab and create the corresponding directories (in this case /mnt/data):

    /dev/sda1 /mnt/data ext3 noauto,users 0 0

    During startup, the system attempts to mount the local filesystems in /etc/fstab. The /dev/sda1 entry will fail, because ohci1394 is not loaded until later. Aside from an error notice on the startup screen, this causes no ill effects.

  3. Mount the FireWire drive.

    Use the following command to mount the FireWire hard drive:

    # mount -v /mnt/data


    # mount -t ext3 /dev/sda1 /mnt/data

    To unmount the drive, use:

    # umount /mnt/data

Disconnecting the Disk

Before disconnecting the disk, it must be umounted to avoid data corruption.

After disconnecting the data cable, /var/log/messages shows that ieee1396.agent was called with the "remove" argument.

At this point,

# cat /proc/scsi/scsi

still shows that the disk is present. However, attempting to access it (e.g., mount /dev/sda1) results in an error message, but no other ill effects.

# modprobe -r -v ohci1394

unloads ohci1394. Then

# cat /proc/scsi/scsi

shows that the disk is gone. Attempting to unload ieee1394 with

# modprobe -r -v ieee1394

gives an error: device or resource busy.

At this point, we can reload ohci1394, and reconnect the disk's data cable. The log file shows that the disk was seen and recognized. But

# cat /proc/scsi/scsi

fails to see the disk, and it cannot be accessed until the system is rebooted.

About the Author





Last modified on
Wednesday, 28-Dec-2011 14:11:11 EST
Page Count: 65698