Dec 30, 2010

Formatting USB Flash Drives for ext3

Hit and Miss
Apparently, not all flash drives are created equal. Or, maybe it's my technique. I tried to format a Maxell 4GB nubbin (tiny, little bigger than the USB connector) flash drive for use in my hacked Asus WL-520GU router. This would hold the python-related files and my scripts for passing to an arduino-powered VFD.This is with Ubuntu 10.04:
       Process
  • unmount (previously mounted) drive
  • su -   ; fdisk -l to find the device, in my case /dev/sdb1
  • fdisk /dev/sdb1sdb; p = print partions      <====Corrected!
  • delete partition
  • add new primary partition, all available space, type 83 = ext3
  • write
  • mkfs.ext3 /dev/sdb1
  • remove drive from USB; insert drive into USB
  • mounts
In the case of the Maxell, issuing the mount command from terminal still identifies this as FAT32.
Tried this same thing with a PNY brand 4GB drive, also a nubbin. Worked fine. Go figure...

Tip: To add files to the new partition, from a terminal issue: gksudo nautilus. This will allow you to add files graphically as root. For working with OpenWRT on my hacked Asus WL-520GU, root ownership just worked.
Update 1:  DOH! You need to create the partition via fdisk /dev/sdb, NOT fdisk /dev/sdb1. What I was doing was creating a partition under a partition. Didn't know you could do that! The result was a partition named: /dev/sdb1p1.
This was from the linuxforums.org (http://tinyurl.com/23regf2):
>
"You have incorrectly created a partition table *on a partition* instead of on the device. You need to run fdisk against /dev/sdb NOT /dev/sdb1.
fdisk /dev/sdb
Use option o to create a new partition table. Then use n to create new partitions. When you're done, fdisk -l will show 2 partitions on sdb, not the 1 partition you have now."
Update 2:  After creating a new partition as /dev/sdb1, tried to automount the drive and got:
wrong fs type, bad option, bad superblock on /dev/sdb1
Did an fsck -y /dev/sdb1 and got the message:
*** journal has been re-created - filesystem is now ext3 again ***
Removed/inserted the drive and got the "bad superblock" message again. No luck.




No comments:

Post a Comment