Detailed portable hard drive info


Detailed instructions for use of portable disks on Linux at MacCHESS

HOOK UP AND VERIFY DISK RECOGNITION
Start by plugging in the USB or FireWire cable and powering up your disk. The MacCHESS Linux computers have USB and FireWire connectors on both the front and rear panels.
Some small devices are powered straight from the USB or FireWire cable. If so, do not plug in their external power cord as this may cause bad things to happen.

See if the disk is recognized by the operating system: The dmesg command reports recent hardware activity:

dmesg | tail -40 (does not require root privilege)
Here's the output from that on my system just after plugging in my thumb drive:
usb 1-6.1: new high speed USB device using ehci_hcd and address 4
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
  Vendor: USB 2.0   Model: Flash Disk        Rev: PROL
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
sda: Write Protect is off
sda: Mode Sense: 00 06 00 00
sda: assuming drive cache: write through
SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
sda: Write Protect is off
sda: Mode Sense: 00 06 00 00
sda: assuming drive cache: write through
 sda: sda1
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
usb-storage: device scan complete
SELinux: initialized (dev sda1, type vfat), uses genfs_contexts
A lot of that stuff is not useful, but you can see the device and partition identified as /dev/sda1.

Here's another command which may be helpful in verifying system recognition of your disk:
cat /proc/scsi/scsi
Here's what it looks like with no disks recognized:
Attached devices:
Here's what it looks like with my USB 'thumb' drive attached:
Attached devices:
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: USB 2.0  Model: Flash Disk       Rev: PROL
  Type:   Direct-Access                    ANSI SCSI revision: 02
All SCSI, USB, FireWire and Serial-ATA disks will have entries in this file. You may be able to recognize your drive by the info present.

fdisk is probably the best way to find out which disks and partitions are seen by the system. It is unfortunate that in recent versions of Linux the command requires root privilege:
fdisk -l (root privilege required)
Here's the output on my example system:
Disk /dev/hda: 60.0 GB, 60022480896 bytes
16 heads, 63 sectors/track, 116301 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1         203      102280+  83  Linux
/dev/hda2             204      114221    57465072   83  Linux
/dev/hda3          114222      116301     1048320   82  Linux swap
 
Disk /dev/sda: 131 MB, 131072000 bytes
16 heads, 63 sectors/track, 253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         253      127480+   6  FAT16
Hopefully you can recognize your disk by its label, its capacity and its partition arrangement. USB and FireWire disks will be emulated as SCSI disks, along with SATA drives, some RAID controllers, and {gasp} actual SCSI devices. These devices are labeled by the system, in order of recognition, as sda, sdb, sdc... In this example, disk /dev/hda is my IDE/ATA system disk. /dev/sda is my USB thumb drive. It has 1 partition, /dev/sda1, with a FAT16 filesystem of 128 MB.

If your drive is recognized by the system, you can move onto to the mounting instructions.

If your drive does not show up in /proc/scsi/scsi, you can check for: This can get messy, and your options depend on the specifics of your problem, so I won't spend too much time on this.

Modules:
In order to use USB or FireWire drives the proper modules, such as ohci1394 (for FireWire) must be loaded. With recent versions of Linux, this should be the case by default. It is conceivable that an unusual filesystem might require a module that isn't there by default. You can check which modules are loaded:

lsmod  (root privilege required)
You can load a module with:
modprobe ohci1394 (root privilege required)
Modprobe will automatically load any prerequisites modules as well; e.g. modprobe ohci1394 will automatically load ieee1394 first. Module scsi_mod needs to be loaded as well, but it usually is there by default. Other modules may be required for your filesystem: ext3, reiserfs, xfs, jfs. A list of available filesystem modules can be found in /lib/modules/2.6.17-1.2187_FC5/kernel/fs

PREPARE FOR MOUNTING
See if a line exists in the /etc/fstab file:


cat /etc/fstab | fgrep sd
Here are the typical relevant lines you should find on the MacCHESS Linux computers. These might vary slightly depending on whether the root disk is PATA or SATA:
/dev/sda1 /media/disk1    auto    noauto,user,rw 0 0
/dev/sdb1 /media/disk2    auto    noauto,user,rw 0 0
/dev/sda2 /media/disk3    auto    noauto,user,rw 0 0
/dev/sdb2 /media/disk4    auto    noauto,user,rw 0 0
/etc/fstab lines exist for up to 2 disks, with accomodations for up to 2 partitions each. Here's a breakdown on the parts of a typical line:

Make sure the mount point exists, or create one. A mount point is just an empty directory.
On the MacCHESS Linux machines you should find that mount points already exist for each of the lines in the /etc/fstab file:

ls /media
disk1 disk2 disk3 disk4

If your drive and partition schemes are covered by the provided /etc/fstab and mount points, you can go right ahead and mount your partitions:


mount /media/disk1
mount /media/disk2
You can verify the mount with:

df -k
Don't forget to unmount the partitions before removing them from the system. This will ensure that the drives are unmounted cleanly, and that no data are left sitting in a buffer:

umount /media/disk1
umount /media/disk2

If your drive and partition scheme are not covered by the pre-existing /etc/fstab entries and mount points, You should still be able to mount your drive with a more explicit mount command. First create a mount point (an empty directory)


mkdir data_dir
mount -t reiserfs /dev/sde1 /data_dir

With multi-user filesystems (e.g. ext2, ext3 or xfs), the user may be able to mount and unmount the disk, but not be able to create a top-level directory on the partition. In that case, get your staff scientist to use a root-privileged account to create a top-level directory and assign owner and group ID to the user:


cd /media/disk1
mkdir smith
chown specuser.users smith
If you would like to prepare such a directory in advance of your trip to CHESS, use uid=210, gid=100.

Another thing to try in cases of ownership problems is to add specuser to the disks line in /etc/group.

If any unanticipated problems arise, contact MacCHESS personnel for assistance.

Back to backup page
Back to Schuller staff page
MacCHESS home page