Jump to content

What happens to USB key after becoming an OS disk?


theYinYeti
 Share

Recommended Posts

Yesterday, I was going to dd the 2010beta One ISO to a 2GB USB stick to test it, but I did not.

 

Last time I played with a USB key, for something other than storing data, was when I tried several distributions that boot on CD or USB (among which is GeeXboX) for my “salon†PC to become disk-less. Each USB distribution involved formatting the USB either FAT or Ext2, and installing on it. At the fourth attempt or so (only one of which booted fine), the USB device stopped working beyond any hope of repair: it reported a ridiculously small capacity, an invalid partition table…

 

So before “playing†with a USB stick again, I want to be sure there's a way back. In particular, the ISO being only 700MB, the USB disk will probably report a capacity of 700BM, and I want to be able to get the 2GB back.

 

Can someone enlighten me on the workings of USB sticks and why capacity and formatting is not as straightforward as with standard hard disks?

 

Yves.

 

BTW: what's the proper En/Us word for this USB thing? “USB stickâ€, “USB keyâ€, “flash driveâ€, something else?

Link to comment
Share on other sites

USB sticks contain often very bad quality flash chips, especially if it was some cheap noname stick, they don't last many write cycles.

 

Other than that they should behave exactly like a hdd from a formatting and partitioning point of view.

 

I found that the more reliable solution is to buy a good brnad CF card (SanDisk, Kinston, Transcend) and then use a stick-sized CF-to-USB adapter, instead of a USB stick. CF cards are generally built to cope with a lot more write cycles than cheap USB sticks.

 

If you want to reset a USB stick, you can do the same as you would with a hard disk:

dd if=/dev/zero of=/dev/sdX bs=4096 count=1024

(replace sdX with the actual device name of your USB stick, this overwrites the first 4MB of the stick with zeroes which should zero out both the partition table and the filesystem headers).

 

badblocks -b 4096 -svw /dev/sdX

will do a very thorough test of the USB stick (it will erase all data too!), finding any bad blocks, but will take a few hours.

Link to comment
Share on other sites

Something related that I saw today on the mandriva forum. http://forum.mandriva.com/viewtopic.php?p=720604#720604

 

Users with a 4GB Flash, do not use this ISO it will destroy your Flash!

 

Here's the story:

I bit the banana and bought one of those nice and shiny external DVD reader/writer drives. Burned the ISO to a DVD. I had to change the BIOS settings to boot from the new external drive et voilà: the ISO booted to the prompt!

 

I punched in 'upgrade', hit ENTER and after some loading the system asked me to insert my Flash. Did so and my 2008.1 4G Flash was recognized! After mounting the Flash, backing up all config files, user accounts and Firefox user data it started the transfer of the new system.

 

After a while (8 minutes) the system showed an error, telling me there is not enough space on the device! Nevertheless it continued the routine and even told me that everything was successfully upgraded and I should reboot now. I rebooted but did not get far - black screen with the cursor blinking in the upper left corner. tty0 showed errors about not found directories and files, obviously due to the error message about lack of space during transfer.

 

Of course my 4GB Flash was now totally hosed, thanks to myself I made a backup before!

 

What happened here?

 

1. The "splash screen" of the ISO showed all kinds of options to upgrade Flash sticks from 2008.1 on to 2009 Spring - but only for 8GB sticks!

2. Although the routine recognized my usb key as a valid Mandriva Flash it did not recognize that it is only a 4GB Flash and started to transfer data. Here it should have stopped instead of hosing the exisating system by starting a transfer which could never be successfully ended.

3. The system did not even stop after the error occurred, it told me that everything was successfully upgraded, which obviously was not the case.

 

Although it is nice that the ISO upgrades all versions to 2009 Spring starting with 2008.1, it is useless for those who have a 4GB Flash.

Link to comment
Share on other sites

Something related that I saw today on the mandriva forum. http://forum.mandriva.com/viewtopic.php?p=720604#720604

 

good to know but "destroy" is the wrong word, it surely didn't destroy the flash physically, it just corrupted the Mandriva installation.

That flash key could be reformatted/partitioned and reused.

Link to comment
Share on other sites

So before “playing†with a USB stick again, I want to be sure there's a way back. In particular, the ISO being only 700MB, the USB disk will probably report a capacity of 700BM, and I want to be able to get the 2GB back.
What I would do is make an image of the drive

dd if=/dev/sdX of=flash-drive.img

when you want your stick back just reverse it.

dd if=flash-drive.img of=/dev/sdX

An even better way is to use mandriva-seed.sh to write the ISO, that way you can partition and use the space beyond your 700MB bootable partition.

 

Ken

Link to comment
Share on other sites

Thank you Ken! That's an interesting tool to know about. I'll try this mandriva-seed.sh.

 

BTW, I had a backup when I “broke†my device, but no amount of dd would restore it… It was a “free ad†USB key from my wife's work, though, so probably not good quality.

 

Yves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...