Linux and USB keydrives

Introduction

Things to check before buying a USB keydrive:

What makes a USB keydrive bootable?

"USB Keys can be formatted in two ways:

This is the reason, why some bootable USB keys not boot on every system. Some computers BIOS simply only understand one of the formats, not both, and if you use Windows and plug your key in, you won't notice the difference. Using Linux it get's pretty clear. Looking at the different formats shows, that the superfloppy formatted key is formatted as one big storage device (/dev/sda is mounted). The harddisk formatted key, which has a MBR, can have multiple partitions (/dev/sda1 etc.)." www.marlow.dk/site.php/tech/usbkeys

"There are two common BIOS methods for direct USB booting:

"If you have an older computer system, your BIOS might not support USB-HDD boot. In this case, it may still be possible to boot Linux from USB if your BIOS does list USB-ZIP as a boot option. In order for this to happen, we need to trick the BIOS into thinking that the USB flash drive is a zip drive." www.pendrivelinux.com/booting-linux-from-usb-zip-on-older-systems/#more-180

"Some USB flash drives are notorious for having problems with corrupted master boot records. If your system refuses to boot from the flash memory stick, the mbr may be at fault. To fix this, you can use the mbr package to install a new master boot record. " www.pendrivelinux.com/install-a-new-mbr-to-your-usb-flash-device/#more-191

Commands

dmesg

To check what is reported by Linux when plugging a keydrive:

usb 2-3: new high speed USB device using ehci_hcd and address 3

scsi7 : usb-storage 2-3:1.0

scsi 7:0:0:0: Direct-Access     General  USB Flash Disk   3.00 PQ: 0 ANSI: 2

sd 7:0:0:0: Attached scsi generic sg2 type 0

sd 7:0:0:0: [sdb] 7829504 512-byte logical blocks: (4.00 GB/3.73 GiB)

sd 7:0:0:0: [sdb] Write Protect is off

sd 7:0:0:0: [sdb] Mode Sense: 0b 00 00 08

sd 7:0:0:0: [sdb] Assuming drive cache: write through

sd 7:0:0:0: [sdb] Assuming drive cache: write through

 sdb:

sd 7:0:0:0: [sdb] Assuming drive cache: write through

sd 7:0:0:0: [sdb] Attached SCSI removable disk

lspci

lshw

To list hardware. Text-based equivalent to Windows' Device Manager

lsusb

usb-devices

What do those infos mean?

T:  Bus=02 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  3 Spd=480 MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=8644 ProdID=800a Rev=01.00

S:  Manufacturer=General

S:  Product=USB Flash Disk

S:  SerialNumber=0000000000001F52

C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA

I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

fdisk

mk.x

To format a partition with filesystem x

eject /dev/sdb

Resources