Installing a new USB External Drive

I’ve decide to move from CentOS to Ubuntu as the Linux Distro on my laptop, so it was time to do a full backup to a new USB external drive.

I got a new Maxtor 300G 7200rpm ATA133 (16MB cache) HDD from Umart for AUD$149. I already had an unused USB 2.0 3.5″ external casing.

My first issue was, I couldn’t detect the new drive from my laptop. Switching to another desktop running CentOS, I got the following errors.

$ tail -f /var/log/messages
May  6 12:36:53 marvin kernel: usb 1-1: new full speed USB device using address 4
May  6 12:36:57 marvin kernel: SCSI subsystem initialized
May  6 12:36:57 marvin kernel: Initializing USB Mass Storage driver...
May  6 12:36:57 marvin kernel: scsi0 : SCSI emulation for USB Mass Storage devices
May  6 12:36:57 marvin kernel:   Vendor: Genesys   Model: USB to IDE Disk   Rev: 0033
May  6 12:36:57 marvin kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02
May  6 12:36:57 marvin kernel: usbcore: registered new driver usb-storage
May  6 12:36:57 marvin kernel: USB Mass Storage support registered.
May  6 12:36:58 marvin scsi.agent[3573]: disk at /devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0
May  6 12:36:59 marvin kernel: usb 1-1: USB disconnect, address 4
May  6 12:36:59 marvin kernel: sda : READ CAPACITY failed.
May  6 12:36:59 marvin kernel: sda : status=0, message=00, host=1, driver=00
May  6 12:36:59 marvin kernel: sda : sense not available.
May  6 12:36:59 marvin kernel: sda: Write Protect is off
May  6 12:36:59 marvin kernel: sda: assuming drive cache: write through
May  6 12:37:00 marvin kernel: sda : READ CAPACITY failed.
May  6 12:37:00 marvin kernel: sda : status=0, message=00, host=1, driver=00
May  6 12:37:00 marvin kernel: sda : sense not available.
May  6 12:37:00 marvin kernel: sda: Write Protect is off
May  6 12:37:00 marvin kernel: sda: assuming drive cache: write through
May  6 12:37:00 marvin kernel: sda : READ CAPACITY failed.
May  6 12:37:00 marvin kernel: sda : status=0, message=00, host=1, driver=00
May  6 12:37:00 marvin kernel: sda : sense not available.
May  6 12:37:00 marvin kernel: sda: Write Protect is off
May  6 12:37:00 marvin kernel: sda: assuming drive cache: write through
May  6 12:37:00 marvin kernel:  sda:<3>scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:00 marvin kernel: Buffer I/O error on device sda, logical block 0
May  6 12:37:00 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:00 marvin kernel: Buffer I/O error on device sda, logical block 0
May  6 12:37:01 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 262143
May  6 12:37:01 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 262143
May  6 12:37:01 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 0
May  6 12:37:01 marvin kernel:  unable to read partition table
May  6 12:37:01 marvin kernel:  sda:<3>scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 0
May  6 12:37:01 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 262143
May  6 12:37:01 marvin kernel: scsi0 (0:0): rejecting I/O to device being removed
May  6 12:37:01 marvin kernel: Buffer I/O error on device sda, logical block 0
May  6 12:37:01 marvin kernel:  unable to read partition table
May  6 12:37:01 marvin kernel: Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0

So, thinking it may be the pin switches, I unscrewed everything to change the pin selector from Cable Select to Master. Trying again, with the bare disk and just the connectors, I confirmed this was the issue. This is what one should expect.

May  6 13:00:28 marvin kernel: usb 1-1: new full speed USB device using address 6
May  6 13:00:29 marvin kernel: scsi2 : SCSI emulation for USB Mass Storage devices
May  6 13:00:29 marvin kernel:   Vendor: Genesys   Model: USB to IDE Disk   Rev: 0033
May  6 13:00:29 marvin kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02
May  6 13:00:29 marvin kernel: SCSI device sda: 586114704 512-byte hdwr sectors (300091 MB)
May  6 13:00:29 marvin kernel: sda: test WP failed, assume Write Enabled
May  6 13:00:29 marvin kernel: sda: assuming drive cache: write through
May  6 13:00:29 marvin kernel:  sda: unknown partition table
May  6 13:00:29 marvin kernel: Attached scsi removable disk sda at scsi2, channel 0, id 0, lun 0
May  6 13:00:30 marvin scsi.agent[4172]: disk at /devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/host2/target2:0:0/2:0:0:0

So working with /dev/sda which was expected, sd being for the USB connections, and a for the first.

Double check nothing on drive.

$ fdisk -l /dev/sda

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda doesn't contain a valid partition table

Partitioning

Partition the drive into 3 x 100GB partitions.

$ fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 36483.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-36483, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-36483, default 36483): +100000M

Command (m for help): p

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       12159    97667136   83  Linux


Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (12160-36483, default 12160):
Using default value 12160
Last cylinder or +size or +sizeM or +sizeK (12160-36483, default 36483): +100000M

Command (m for help): p

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       12159    97667136   83  Linux
/dev/sda2           12160       24318    97667167+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (24319-36483, default 24319):
Using default value 24319
Last cylinder or +size or +sizeM or +sizeK (24319-36483, default 36483):
Using default value 36483

Command (m for help): p

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       12159    97667136   83  Linux
/dev/sda2           12160       24318    97667167+  83  Linux
/dev/sda3           24319       36483    97715362+  83  Linux

Command (m for help): v
15371 unallocated sectors

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Confirm.

$ fdisk -l /dev/sda

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       12159    97667136   83  Linux
/dev/sda2           12160       24318    97667167+  83  Linux
/dev/sda3           24319       36483    97715362+  83  Linux

Format

Formating the 3 new Partitions. (Note: this takes a while)

$ mkfs.ext3 -v /dev/sda1
$ mkfs.ext3 -v /dev/sda2
$ mkfs.ext3 -v /dev/sda3

Confirm

Create some mount points and test mount.

$ mkdir /u11
$ mkdir /u12
$ mkdir /u13
$ mount -t ext3 /dev/sda1 /u11
$ mount -t ext3 /dev/sda2 /u12
$ mount -t ext3 /dev/sda3 /u13

Add hard disk to fstab