LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to erase read-only usb memory stick? (https://www.linuxquestions.org/questions/linux-general-1/how-to-erase-read-only-usb-memory-stick-945289/)

hearthstone 05-16-2012 08:27 AM

How to erase read-only usb memory stick?
 
How do I erase read-only usb memory stick?
I have an install Debian on it, but it is read-only, I can't erase it.
I tried to follow http://www.linuxquestions.org/questi...d-only-772711/ , but to no avail. gparted doesn't do it.
Thanks, Hearthtstone.

fukawi1 05-17-2012 02:32 AM

Quote:

I have an install Debian on it, but it is read-only, I can't erase it.
You really need to give us some information to work with, other than "I cant do it".
Posting the command you are trying to use, and the resulting output would be most beneficial.

To erase a disk completely, and unequivocally you should be able to write zeros/random with dd. Search LQ for dd and you will find a couple of good threads that give examples on just about every possible use of dd.
You may not be able to do this as a user, you may need to be root.

onebuck 05-17-2012 06:59 AM

Member response
 
Hi,

Look at pendrivelinux: Restoring your USB Key
procedure to restore the USB flash using MS Windows or Gnu/Linux. Simple!

jefro 05-17-2012 10:43 AM

Did you boot to the usb?

hearthstone 05-18-2012 12:43 PM

I give up.
Hearthstone.

onebuck 05-18-2012 12:55 PM

Member response
 
Hi,

Quote:

Originally Posted by hearthstone (Post 4682030)
I give up.
Hearthstone.

You did try the pendrivelinux procedure for MS Windows or Linux? If so what happened?

Chris.Bristol 05-26-2012 12:08 PM

Hearthstone
Perhaps you are having the same problem as me. The instructions on the Pendrivelinux site look sensible, and I think that the program "Disk Utility" will achieve the same thing, so you might want to try that.

I just get an error message "One or more partitions are busy on /dev/sdd", so maybe it's something to do with whether or not the USB drive should be mounted?

If you know how to do that you could try mounting and unmounting it first. If that works please post how you did it.

hearthstone 05-27-2012 02:53 AM

1 Attachment(s)
Please see the bellow (and the attachment)--is this what I wanted?

I want to use the stick to have a bootable, installable .iso on it AND extra space for storing files. Would that be possible?

Thanks, Hearthstone.

After I followed the instructions for Linux - http://www.pendrivelinux.com/restori...key-partition/

I got:

modelearth:~# fdisk -l

Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00028b7f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 7047 56601600 83 Linux
/dev/sda2 7047 7296 2000897 5 Extended
/dev/sda5 7047 7296 2000896 82 Linux swap / Solaris

Disk /dev/sdb: 4004 MB, 4004511744 bytes
220 heads, 3 sectors/track, 11850 cylinders
Units = cylinders of 660 * 512 = 337920 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0621e424

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 606 199648 17 Hidden HPFS/NTFS
modelearth:~# fdisk /dev/sdb1

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Chris.Bristol 05-27-2012 12:47 PM

I've found a way to reformat the disk despite it being write-protected, which is all I want, but I think that if you did that then made it bootable it would probably become write-protected again. Maybe you need to try different packages for making bootable USB sticks - it may be that there is one doesn't make it write-protected. Alternatively that may just be the way it is with bootable memory sticks.

hearthstone 05-28-2012 10:55 PM

1 Attachment(s)
I used gparted to erase and repartition the stick, then I used:
modelearth:~# dd if=/root/firmware-6.0.1a-i386-netinst.iso of=/dev/sdb1
to get Debian Squeeze install .iso on it.
The flag checked for "boot".
Please see the attachment.
Yet it did not boot.
Thanks, Hearthstone.

hearthstone 05-30-2012 05:46 AM

This, finally, worked:
I used (g)parted to erase and partition the stick.
Then I followed instructions at http://pthree.org/2010/02/21/installing-debian-via-usb/ and got me a stick that I can install a Debian Squeeze with on wireless, using debian-6.0.5-i386-netinst.iso.

Thank you all!

Hearthstone.

Chris.Bristol 05-30-2012 10:44 AM

Thanks for posting the answer Hearthstone.


All times are GMT -5. The time now is 05:37 AM.