Skip to content | Change text size

ITS home

 

Modifying a USB storage device for use in Linux

Overview

USB storage devices are more likely to work in the Linux labs if two conditions are met:

  1. The device is recognised by Linux.
  2. The device has a partition table with one primary partition.

Modification

Follow these steps to modify a USB storage device for use in the Linux labs. The device must be recognised by the installed operating system.

Remember to copy all data from the device before continuing.

By using these instructions the user acknowledges that IT Services accepts no responsibility for loss of data or damage caused to the device in the use of these instructions.

  1. Use fdisk to remove all partitions from the device, and then create one partition.
fdisk commands:
d (delete one partition at a time until all partitions are deleted)
n (add a new partition)
p (for primary partition)
1 (for partition number 1)
Press Enter for the default first cylinder
Press Enter for the default last cylinder
t (change partition type)
1 (for partition number 1)
b (for FAT32)
w (write changes to the disk and exit, ignore permission denied message)

Here is an example fdisk session:

$ fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 259 MB, 259276800 bytes
50 heads, 63 sectors/track, 160 cylinders
Units = cylinders of 3150 * 512 = 1612800 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 161 253102+ 6 FAT16
Partition 1 has different physical/logical endings:
phys=(945, 49, 63) logical=(160, 35, 63)

Command (m for help): d
Selected partition 1

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

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (Win95 FAT32)

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 13: Permission denied.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
  1. Zero out the first 512 bytes of the DOS partition so that DOS format will believe the partition table over any header information that might normally be found at the start of the partition. The following example uses /dev/sda1. Remember to use the correct device name.
dd if=/dev/zero of=/dev/sda1 bs=512 count=1
  1. Format the partition with mkdosfs. The following example uses /dev/sda1. Remember to use the correct device name.
mkdosfs -F 32 /dev/sda1