format usb drive using linux so windows can read it

So you just go a external USB drive and you want to use it on you Windows box.  Well Windows is just not that smart to read osx formatted partitions.

Start by pluging it in, yaha.  Below is a snip it from dmesg that shows the usb drive being recognized when plunged in.

cfdisk example output

cfdisk 2.12r

Disk Drive: /dev/sdb
Size: 120034123776 bytes, 120.0 GB
Heads: 255   Sectors per Track: 63   Cylinders: 14593

Name              Flags            Part Type       FS Type                  [Label]               Size (MB)
———————————————————————————————————————-
sdb1                                Primary        NTFS volume set                                120031.52

[Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]  [  Quit  ]  [  Type  ]  [ Units  ]
[ Write  ]

Notice that the dmesg output says sdb so the device path will be /dev/sdb, and the first partition will be /dev/sdb1.

sb 5-5: new high speed USB device using ehci_hcd and address 4
usb 5-5: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver…
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
Vendor: Ext Hard  Model:  Disk             Rev:
Type:   Direct-Access                      ANSI SCSI revision: 04
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: [mac] sdb1 sdb2
sd 2:0:0:0: Attached scsi disk sdb
usb-storage: device scan complete
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1
SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
sdb: Write Protect is off
sdb: Mode Sense: 10 00 00 00
sdb: assuming drive cache: write through
sdb: sdb1

First you have to delete the osx partition.  I suggest using cfdisk.  It is one of my favorite disk formatting command line gui programs.  fdisk /dev/device also works but is a little trickier to use.

The commands below show how to format the drive

server:~# mkdosfs -n “external disk” /dev/sdb1
mkdosfs 2.11 (12 Mar 2005)

Now go and mount the newly created the file system.

mount /dev/sdb1 /mnt/usb

Now you can unmount it so that it is safe to remove the usb device.

server:/mnt# umount /mnt/usb

server:/mnt# mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
mini:/mnt#

Now you can disconnect the usb drive.

usb 5-5: USB disconnect, address 4

server:~# mkdosfs -n “external disk” /dev/sdb1
mkdosfs 2.11 (12 Mar 2005)