Low-Level Format For a USB Flash Drive?
Luyseyal writes "I unwittingly bought one of these terrible flash cards at Fry's and have managed to nuke two of them, successively. I have a USB flash card reader that will read/write the current one at USB 1.0 speed, but it locks up every Ubuntu and XP machine I've come across in high-speed access mode. I have read that if I low-level format it that it could be fixed, though my current one doesn't support it. My Google-fu must be weak because I cannot seem to find a USB flash reader that specifies that it will do low-level formatting." Can anyone offer advice for resurrecting such drives?
The typical ask Slashdot articles of late:
Dear Slashdot,
Something brown just fell out of my butt and it smells really bad. What should I do?
http://www.sdcard.org/consumers/formatter_3/
Give DBAN a try. This tool never fails me for any kind of disk I throw at it.
http://www.dban.org/download
Not sure when it locks up the system.
Try
HP USB Disk Storage Format Tool
http://www.pcworld.com/downloads/file/fid,64963-order,4/description.html
"... but it locks up every Ubuntu and XP machine I've come across in high-speed access mode. I have read that if I low-level format it that it could be fixed, though my current one doesn't support it. My Google-fu must be weak because I cannot seem to find a USB flash reader that specifies that it will do low-level formatting."
I wonder if GNU Shred would be something to try, at the device level? Let's say your flash drive shows up as /dev/sdc, then you'd do this:
shred -v -n 1 /dev/sdc
(You might even try -n 3.) I think this would work, but I don't know what wear leveling would do when shredding a USB flash drive.
Once you run shred, you'll have wiped the entire flash drive. That means you'll need to repartition the device and lay down a new filesystem.
Might work.
Ahm.. has the meaning of this term changed? Last time I heard the term it referred to syncing a drive and it's controller, and thus fell out of usage with the rise of IDE disks.
That's ridiculous. A-DATA sells crap. Reformatting will not change that.
The controller is probably fried, maybe a voltage spike or static electricity occurred. Or it's just cheap Chinese crap. So it can't talk to the USB host controller properly.
The actual NAND memory is probably fine but unless you want to resolder a controller chip just toss the drive.
I've used the industrial paper shredder at work to destroy flash drives when they were no longer recognizible by the host yet they still had potentially sensitive personal or corporate data on them.
Take the PCB out of the housing, snap off the USB connector and feed the board into it, the flash chip gets ground to bits so no adversaries can recover your data. :D
Encrypt your data to avoid such hassles in the future. Encryption makes theft or loss of your medium a non-problem, besides the lost material value.
They don't abstract the filesystem, but they abstract the hell out of the lowlevel Flash blocks and just present you with a pretty array of sectors that all work perfectly... until they don't, and then you're screwed.
Good luck, but I wouldn't hold my breath. These things are essentially disposable, and probably more trouble than it's worth reviving.
The specifics:
sudo dd if=/dev/zero of=/dev/rdiskxxx bs=1024000
or whatever variation you need for your distro. The above is for mac os x. yes, rdisk is a character device I know I know, but for some reason os x io's a LOT faster o that than the block device. (double or better) No idea why. Block works too tho, whatever works for you. Just plug in the correct disk number for the xxx. Careful which device you're nuking, dd is both swift and unforgiving.
I'd also like to get slightly pedantic and point out that this is NOT a low level format. Low level format refers to laying down the address blocks, and also the data headers and trailers. All dd does is write zeros to the meat of the data block, and update its checksum. There's no such thing as a low level format for non magnetic media because flash drive blocks are electrically addressed, not physically.
FWIW, you can probably tack on "count=20" to make things go much faster. I assume all you need is the partition table completely zapped, and the first 20mb should do it fine. Without this it will wipe the entire device, which for a flash drive may take a little bit. But then again your distro or whatnot may try to find a backup copy of the boot block and partition table etc at the end of the device in which case just wipe the whole thing to avoid it "fixing it" for you.
I work for the Department of Redundancy Department.
First find out the device of the flash disk.
The following fixed a USB disk which was hosed:
dd if=/dev/random of=/dev/sda
or
dd if=/dev/zero of=/dev/sda
It's not a format, but fixes corrupt files, which can cause the disk to be unuseable.
Can anyone offer advice for resurrecting such drives?
Spell: Resurrection
Level: 7
Range: Touch
Duration: Instantaneous
Any brand has the occasional lemon but overall WD is decent. People expect unrealistic things from hard drives too. You're talking about a device extremely sensitive to heat, moisture, vibration, and magnetism at the least and people want to cram 2TB of priceless family photos and their thesis paper into a $50 device without making backups. Yeah that's a recipe for disaster. I know - I've made the same mistake and paid for it. Lately I've been using WD Caviar Black 1TB w/ 64MB cache drives in a Drobo Elite and they've been doing pretty well but I expect to lose a couple of them per year under the stress of being in a server. Certain files I keep in RAID5 on Corsair Nova SSD drives and I use the same drives in my laptops and they've done pretty well. And of course everything is backed up to a NAS drive of which I use both WD My Book World Edition II - 2 TB (2 x 1 TB in RAID1) and Drobo FS. Previously I had used a couple cheaper NAS and Firewire/USB/eSATA drives for backup but all of them died. One happened to die at the same time the main drive died which was unpleasant - both were about six months old. I think hard drive manufacturers should have to include free data restoration for the life of the warranty. The main expense of data restoration is getting exact matching parts for your drive so the manufacturer could do it MUCH cheaper and easier than anyone else. Wouldn't hurt to have a drive stop working completely, unless a jumper is switched, when it senses itself dying so it won't self destruct further. Of course if I got to pick I'd like to see standard sized PC and laptop drives come w/ two physically separate drives and RAID 1 so the drive could sense death and go into a read-only recovery mode. Data is way more valuable than hardware so every possible effort should be made to make data possible to recover. 1TB for $150 is fine with me - instead of offering me 2TB for the same price give me the built-in RAID1.
At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
If speed is a factor, then none of the answers I read above apply to your issue.
Your el cheapo flash card has a temperature-sensitive hardware defect which probably turned into an inability to read at hi-speed when the unit heated up to a certain temp and caused some poorly-made part of the chips to act flakey or broken. At USB 1.x speeds, the flash unit remains cool so access to it remains OK. Consider returning that flash card.
Of course, there is another possible explanation: Your particular flash reader device has an incompatibility with your flash cards (possible but not likely). You could try different readers if you haven't already.
There's no such thing as a "low level format" on a flash drive. The term refers to specifying where the tracks are at on a magnetic disk. It was possible, although incredibly stupid, back in the day to perform a low level format on a hard drive and tell it to move the tracks closer together. As a result, you could bump your 10MB disk to 12MB.
This works only because the physical magnetic disk doesn't "know" anything about tracks and sectors. It always drives me crazy when someone who wants to wipe a drive clean, asks me about a "low level format", when what they want to do is zero out the drive (ie dd if=/dev/zero of=/dev/sda).
For a flash drive, each memory cell physically has a 1-to-1 correspondence to a bit (or several bits) of information, so there's no low level format.
Like any good developer I'm ignoring what the customer asked for and trying to figure out what they need. ;)
You want to be able to write to the card at more than 1.0 speed. Here's some random thoughts:
1. Have you tried a different reader? Fry's sells them for as little as $7.99 (Sorry, couldn't resist that one.)
2. Have you tried a different class of device? How about formatting in a camera or PDA and see if that allows you to then read/write at the faster speed on a PC.
3. Can you return or exchange it as defective? If it isn't transferring at the advertised rate then that assumption can be made. See if they can get to full speed at Fry's.
4. You didn't mention what versions of Ubuntu you tried, but is it current? How about Windows 7 or a live CD of another distro? (see #1)
Of all the ba-jillion cards out there the fact that you've had problems with two of them with the symptoms you describe makes me think the problem might be on your end. Just a guess. Either way, good luck.
And I do mean one time, but three years later I'm still using the thumb drive. The following assumes a Linux environment. First, pull off any data you can (and want to), then unmount it and type:
/dev/sdg, not /dev/sdg1. This guarantees that all the Flash blocks on the chip are reset. The patterns 0xAA, 0x55, 0xFF, and 0x00 are written, then checked; "shred" does no checking, and doesn't report errors. The "-s" is to show continuous progress.
#badblocks -w -s device-path
Use the entire device, e.g.
If you get any errors (and you probably will, if the device is as weak as you say), simply re-run the "badblocks" command, and note if the error count goes down. The one time I did this, I got a few errors (less than 10) the first time, but zero the second time. Whatever badblocks caused on the low level of the device, it was just what the doctor ordered. I hope it can help you, too.
Here's what I used to use for a low-level format:
A>debug
g=c800:5
If you've got a fairly speedy machine, set the interleave to 1:1. Don't forget to input the list of bad blocks so the drive won't try to store data in them. There's some more info in this KB article
HTH, HAND
You need to learn you lesson for patronizing vendors of cheap garbage technology.
Why did you not pay a little more for your flash drives and get something more reliable? If you want to go to the trouble of resurrecting your half-dead flash drives you can spend the $10-20 on a new one from a major brand name.
The problems you describe sound like shitty controller circuitry, that's either failing, poorly designed or quite likely both.
The lower level operations of flash are abstracted away behind the controller, with the exception of some drives theres you can't do much about it.
USB Flash drives and cards can be brought back to as-new performance by performing a write-erase pass over the entire drive. This was used to revive degraded used SSDs that would drop in performance, the TRIM feature now takes care of this on the fly. About all you can do for thumb drives and cards is to perform a single erase pass. If that doesn't work you're SOL.
After logging in slashdot still does not take you back to the page you were on. It's been that way for 20 years.
If you want to use it, go buy a reliable piece of hardware.
If you want to wipe it for disposal, just hit it with a hammer.
Some things are not worth your time. Even if your time has no value.
I am responding to your post on the chance that you are seeing a photo import bug because you use gthumb.
The 16GB flash card you link to in your Ask Slashdot question looks like the 8GB flash card I use in my digital camera.
If you are doing digital photography and using Ubuntu or a Linux, take note that the photo import utility in gthumb is broken in Ubuntu 9.10. The gthumb version is 2.10.11 and the specific thing broken is photo import of jpeg images. Photo import fails if there are .avi movie files on the flash card.
I have had a series of flash card aggravations and here is my version of the preceding AskSlashdot comments:
1. Digital cameras format flash memory cards with minor variations or they store image data with minor variations. I work around potential glitches by keeping the card in the camera and connecting the camera to the Ubuntu computer.
2. Use gthumb (note bug above) or the graphical file tool Nautilus. The top level menu item "Places" in Ubuntu starts Nautilus. Copy the files from the camera to the computer.
3. Speaking about USB flash memory, I feel they have devolved into a Windows quality file transfer device = WQFTD That means, they work using the supplied file system. The success of the same devices using Ext2 and Ext3 file systems is problematic.
4. Measuring the read and write reliability of these WQFTDs at the bit level is a difficult problem. As I mention in my journal, I have a big name DVD drive that is a WQFTD. I know it fails when reading huge 8 bit data files. But, building a tool to prove when and where it fails is beyond my available time as an evening hacker.
5. So one answer is "simplify and work around your WQFTD" without challenging it's limits.
But the point is the parent's point still holds. You *can* put any FS you wish onto the card, but there's no guarantee your data will still be there when you come to read it. For instance, a "smart" SD card might doing background erasing of sectors that are marked as empty according to the FAT so that it can achieve faster write speeds when those sectors are re-used.
You stole the second one?
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
2. Use gthumb (note bug above) or the graphical file tool Nautilus. The top level menu item "Places" in Ubuntu starts Nautilus. Copy the files from the camera to the computer.
Rather than gthumb or Nautilus, I use the command-line tool rsync, as follows: rsync -avc (source) (destination), with the source being the flash memory card. When the copy is complete I remove the card, re-insert it, and run the command again. The "c" in "-avc" means to checksum the corresponding files, and copy them again if the checksums don't match. When this triggers a re-copying of a file I know that the card is failing, and discard it.
I bought a bunch of cheap cards when I first got my camera. After some bad experiences with losing pictures I now test each card that I buy, filling it with data and using the above technique to verify that I can get the same data from it twice running. If I can't, the card is discarded. If I ever buy cards locally, I will return bad ones for replacement instead of discarding them.
man fsck.msdos
Yeah, I hated that kludgey old OS too...
"Slashdot - News and Chat Sites Deviant". (Click "homepage" link above for details).