-   Debian (
-   -   format a usb drive (

jbs1136 11-03-2012 12:54 AM

SOLVED - format a usb drive
I just bought a used netbook, Acer Aspire One, kind of old, atom, single core 32 bit with 8g ssd hdd with windows xp installed. bought a 16 gig usb drive and inserted. downloaded to windows the debian installer. ran the installer and rebooted when told. Everything seemed to be going fine until I got to the partioner. Thought about using LVM and let it partion to that. Didn't like the way it looked so tried to go back and redo manual partioning. For some reason the usb drive is now in read-only mode. I have tried it on two different linux computers and one windows and they all say read only.

Did I screw the drive up totally or is there a way to fix it? I have tried gparted, fdisk, cfdisk and none of them will let me reformat. Everytime I stick it in it automatically mounts in media as read-only. The drive is really small and doesn't have a switch for lock/unlock. I checked that too and even read the manual (of sorts) that came with the drive.

Any help appreciated.


Randicus Draco Albus 11-03-2012 05:24 AM


Originally Posted by jbs1136 (Post 4821198)
I have tried gparted, fdisk, cfdisk and none of them will let me reformat. Everytime I stick it in it automatically mounts in media as read-only.

When you try gparted, do you unmount the drive after inserting it?

qlue 11-03-2012 05:35 AM

Have you tried using shred on that flash drive?
make sure you identify the drive correctly (on my machines it would usually come up as /dev/sdb)
then just type:

shred /dev/sdb
Replace /dev/sdb with the correct path for your flash drive. Warning, shred will make any data on the target drive unrecoverable.
After doing that, you should be able to format the drive normally.

RockDoctor 11-03-2012 08:27 AM

I think Randicus has it right - after you insert the drive, but before trying to do anything to it, unmount it.

I've run a number of distros on my AOA150 (1st generation Aspire One netbook with a 120GB HDD). My current favorite is Fedora 17 LXDE. At the time, the AOA110 (8GB SSD instead of the 120GB HDD) came with Linpus Lite, a Fedora 8 derivative running kernel 2.6.18. The Linpus folks included a kernel module subsequently rejected for inclusion into the mainline kernel that allows the multicard reader to read xD cards.

jbs1136 11-03-2012 10:24 AM

I have tried gparted with the drive both mounted and unmounted, still says read-only. I tried shred the same way and same answer.

Thanks for the help,


RockDoctor 11-03-2012 07:21 PM

Random thought of possible relevance:
Does the USB drive have a physical switch to make it read-only?

jbs1136 11-03-2012 07:24 PM

Good thought and that was one of the first things I checked. Thanks


AwesomeMachine 11-03-2012 09:04 PM

I've seen U3 do this. to get rid of U3, write zeroes to the drive. I believe shred works within a file system, not on the hardware level. The dd command works well on virtual file systems, such as /dev.

dd if=/dev/zero of=/dev/sdc bs=1m count=500

That command line will destroy U3, and all partitions on the drive, destroying all data on the drive. So, then you can use the entire drive, without inconsistent behavior. After the command completes the first time, hit the up arrow, let it complete again, and then do it again. Remove the drive, wait three seconds or more, reinsert it, partition and format, and it should do what you want. If you write an iso9660 or some hybrid of it, there is no write support, because CDs and DVDs aren't random-access writable, so their file systems aren't writable either.

If you want to put a bootable .iso file on a USB flash drive, you have to write is as directories and files, and then install syslinux or some other boot loader. Hope this helps. I have confidence in you! Just don't give up! Quitters never win, and winners never quit.

jbs1136 11-04-2012 10:40 AM

Thanks for the suggestion. Honestly I had never heard of u3-tools. Pretty neat, gotta remember that one. Unfortunately it didn't work. The biggest problem is that the drive is mounted read-only. Because of that nothing else is working. When inserted it shows 2 mounted partitions which are mounted ro. I even tried adding them to /etc/fstab as rw but that wouldn't work either.

Thanks for all of the suggestions,


qlue 11-04-2012 11:59 AM

Try connecting the drive before you turn on the computer. (make sure you've removed the lines you added to /etc/fstab)
That way, the drive shouldn't be mounted. dd and shred won't work properly on /dev/sdb or whichever device it is when it's mounted.
As far as I know, shred uses dd internally and I've used it at device level before. But either method should work as long as the drive is not mounted.
You may need to use sudo in front of these commands to override whatever has set the drive to read only.

jbs1136 11-04-2012 03:02 PM

I double checked fstab, inserted drive, rebooted. When I got to log in window i did ctrl-alt-f1, logged in as root. went to /dev/ to check to make sure of the drive letter. This time it was sdd with sdd1-4 listed. Tried shred and was told it was read-only. Tried testdisk and got the same response. No luck with dd either. This was the response from testdisk "This media may be physically write-protected, check the jumpers." This is a link to the drive from Staples that I bought -

Thanks for the suggestions,


RockDoctor 11-05-2012 10:40 AM

If I understand the above post correctly, it looks like /dev/sdd has 4 partitions on it (sdd1, sdd2, sdd3, sdd4). Have you unmounted all of them before attempting to reformat the usb drive?

jbs1136 11-05-2012 10:44 AM

I have tried both mount and unmounted.


fatmac 11-11-2012 10:46 AM

Possible solution if you don't want anything on the disk.

Boot your computer, insert your usb hdd, as root, check the drive number (i.e. /dev/sd?), unmount it, & then do:-

dd if=/dev/zero of=/dev/sd? bs=512 count=1

This will zero out the partition table completely & you should then be able to remove & re insert it, then reformat.


jbs1136 11-11-2012 10:48 AM

Thanks for the suggestion. I finally tried staples support and they had no suggestions. They did however give me a case number and told me to use it to exchange the drive for a new one.

Thanks to all who offered suggestions and help.


All times are GMT -5. The time now is 06:11 PM.