How-To repartiton (format) a USB flash drive.

Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

How-To repartiton (format) a USB flash drive.

Postby michaelrmgreen » 12 Feb 2010, 13:29

The partition and formatting on a USB flash memory drive is sometimes a bit faulty.

Symptoms include (but are not limited to) FreeBSD complaining about the start and/or end of the partiton not being on a track boundary, the total number of sectors not being a multiple of the number of tracks, the drive not being recognised especially in MS Vista and errors when saving files in Windows.

If you have a malfunctioning USB stick try this:

Copy off any files you want to keep. (important)

Plug in the stick and check what device it is recognised as. It's usually da0 if you don't have any SCSI drives. But CHECK.

Now remove the existing partiton information:
[CMD=" "]# dd if=/dev/zero of=/dev/da0 bs=2m count=1[/CMD]

Create a new slice/partiton
[CMD=" "]# fdisk -i /dev/da0[/CMD]
In the interactive section accept the defaults except for sysid, which is 165 for FreeBSD but for FAT32 is 12.
Ignore the 'fdisk: Class not found' error.

Create a new file system ('format')
[CMD=" "]# newfs_msdos -F32 /dev/da0s1[/CMD]

Enjoy working USB drive.
User avatar
michaelrmgreen
Member
 
Posts: 204
Joined: 16 Nov 2008, 21:49
Location: The Peoples Republic of Couch

Postby graudeejs » 12 Feb 2010, 13:50

Why would one want to partition usb flash?
Simply run newfs_msdos /dev/da0, and it works well :D
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby michaelrmgreen » 12 Feb 2010, 15:27

Hmmm, now I'm going to have to find another USB drive with a wonky filesystem to try that on.
User avatar
michaelrmgreen
Member
 
Posts: 204
Joined: 16 Nov 2008, 21:49
Location: The Peoples Republic of Couch

Postby Ruler2112 » 12 Feb 2010, 18:22

killasmurf86 wrote:Why would one want to partition usb flash?
Simply run newfs_msdos /dev/da0, and it works well :D


I've seen a flash drive get a corrupted partition table before. No idea how it got that way, but the above is exactly how I was able to make it usable again. (After playing with it to recover the data off of it of course, but that's another discussion.)
User avatar
Ruler2112
Member
 
Posts: 419
Joined: 15 Sep 2009, 16:23
Location: Michigan, USA

not to have some secret install that I use for unsavoury activities

Postby fronclynne » 12 Feb 2010, 19:29

killasmurf86 wrote:Why would one want to partition usb flash?
Simply run newfs_msdos /dev/da0, and it works well :D


8g flash drive, don't need 8G of fat32 storage*, would like to also have a small install of freebsd (for testing, obviously).



*okay, I didn't need an 8G flash drive at all, but the dang thing was on sale for less than a 4G drive
[color="DimGray"]Quid habemus reliquum?
Nutrimentum anatum![/color]
[color="Teal"]Внимание: лифт вниз не поднимает[/color]
User avatar
fronclynne
Senior Member
 
Posts: 1297
Joined: 09 Feb 2009, 04:47
Location: Lunch Time

Re: How-To repartiton (format) a USB flash drive.

Postby ikbendeman » 01 Dec 2013, 13:11

I know this was a few years ago, and sorry to revive a dead thread. But you didn't mention what you paid for that 8g 8 GB flash drive. I just wanted to point out I got a 64 GB USB 2.0 flash drive for $11 US yesterday (I couldn't justify the price increase for USB 3.0, especially when I don't know exact speeds, I'm pretty sure a 2.0 will give me about 15 MB/s which is enough to test drive the other BSDs (a reason to partition, as somebody asked why above).
User avatar
ikbendeman
Member
 
Posts: 229
Joined: 01 Dec 2009, 17:05
Location: California, US


Return to Howtos & FAQs (Moderated)

Who is online

Users browsing this forum: No registered users and 1 guest