LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   I cannot erase USB flash-drive. Previously it was prepared & used as ubuntu-22 installation disk. Please help. Thanks (https://www.linuxquestions.org/questions/linux-software-2/i-cannot-erase-usb-flash-drive-previously-it-was-prepared-and-used-as-ubuntu-22-installation-disk-please-help-thanks-4175734238/)

Igor Evgen 02-25-2024 07:42 AM

I cannot erase USB flash-drive. Previously it was prepared & used as ubuntu-22 installation disk. Please help. Thanks
 
I cannot erase USB flash-drive. Previously it was prepared & used as ubuntu-22 installation disk. Please help. Thanks

PurpleSquirrel 02-25-2024 07:49 AM

Hello Igor. What have you tried already?

michaelk 02-25-2024 07:52 AM

Use gparted to create a new partition table, a new partition and select the desired filesystem.

lvm_ 02-25-2024 08:02 AM

When flash disk ignores write requests and retains old data it is an indication that it has failed and is giving you the last chance to copy your files.

PurpleSquirrel 02-25-2024 08:09 AM

I have run into the same problem a time or two. I've been using wipefs lately to get rid of the filesystem signatures before I do anything else, especially if I installed from the memory stick.

I'm going to have to try gparted next time. Sounds like a solid suggestion.

PurpleSquirrel 02-25-2024 08:10 AM

Quote:

Originally Posted by lvm_ (Post 6485801)
When flash disk ignores write requests and retains old data it is an indication that it has failed and is giving you the last chance to copy your files.

I've seen that too.

DavidMcCann 02-25-2024 11:26 AM

There are two possibilities. It might be failing but it may just be that its iso formating makes it look like an external optical drive and what could alter that?

Mount it, note the id (e.g. /dev/sdc or whatever), unmount, and use this
Code:

dd if=/dev/zero bs=1M count=10 of=/dev/sdc
Then format it with gparted.

Igor Evgen 02-25-2024 11:33 AM

Quote:

Originally Posted by PurpleSquirrel (Post 6485798)
Hello Igor. What have you tried already?

I tried several ways posted on Internet, in particular, using g-parted. Failed.

Igor Evgen 02-25-2024 11:36 AM

Terminal printed: Permission denied

michaelk 02-25-2024 11:43 AM

Quote:

Originally Posted by Igor Evgen (Post 6485856)
Terminal printed: Permission denied

If you are trying to use dd as posted above then you need to use sudo

sudo dd if=/dev/zero bs=1M count=10 of=/dev/sdx

Please verify the correct device ID.

Igor Evgen 02-25-2024 11:43 AM

#2
PurpleSquirrel

I tried g-parted

and

https://www.techrepublic.com/article...owing-it-away/

Igor Evgen 02-25-2024 11:47 AM

DavidMcCann

I -- not a pro -- tried that way. Failed.

Igor Evgen 02-25-2024 11:49 AM

michaelk

Thank you. Especially for the last quotation.

Regretfully, it cannot help to purge my flash-jack.

fatmac 02-25-2024 11:51 AM

When a pendrive has been used as an installation image, to return it to normal usage, you need to write a new partition table to it, usually an MBR, (could be a GPT, depending on size), then partition, & add a file system.

Igor Evgen 02-25-2024 11:54 AM

michaelk

Terminal answered:
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.0065166 s, 1.6 GB/s

So?

Igor Evgen 02-25-2024 12:04 PM

fatmac

When a pendrive has been used as an installation image, to return it to normal usage, you need to write a new partition table to it, usually an MBR*, (could be a GPT*, depending on size), then partition, & add a file system.

* Sorry, but what's that?

michaelk 02-25-2024 12:11 PM

Now with gparted
1. Create a new partition table. MBR for a flash drive is fine
2. Create a new partition, select the desired filesystem. If also using the drive with Windows select NTFS, exFAT or FAT32.
3. Click the green check mark to apply all operations.

MBR = Master Boot Record. It organizes partitions on a drive so the system can find them.
GPT = GUID Partition Table. Basically same as for MBR but for drives > 2TB

Igor Evgen 02-25-2024 12:21 PM

DavidMcCann

Mount it, note the id (e.g. /dev/sdc or whatever), unmount, ...


It doesn't mount.

yancek 02-25-2024 12:50 PM

If you created a new partition table as instructed above, did you create a partition with a filesystem (see post 17)? If not, it won't mount as there is nothing to mount. You need to create a filesystem on it.

Igor Evgen 02-26-2024 12:03 AM

I thank you all for your answers to my post.

PurpleSquirrel 02-26-2024 03:39 AM

I think fatmac is on to something:

Quote:

Originally Posted by fatmac (Post 6485864)
When a pendrive has been used as an installation image, to return it to normal usage, you need to write a new partition table to it, usually an MBR, (could be a GPT, depending on size), then partition, & add a file system.

If you write a DVD image to the flash drive, it gets a ISO9660 file system signature written to it. And ISO9660 is read-only.

I have been using wipefs a lot lately to make good-but-unwriteable USB flash drives writeable again. The command line is "wipefs -a /dev/sdX". It zeroes out the file system signature and a couple of other locations, as described in the man page.

It has failed me on a couple of cheap drives. They got the hammer-and-trash treatment.

If you can still read the data from the last time you used the drive, give wipefs a try.

HTH

DavidMcCann 02-26-2024 10:47 AM

Quote:

Originally Posted by Igor Evgen (Post 6485874)
DavidMcCann
Mount it, note the id (e.g. /dev/sdc or whatever), unmount, ...

It doesn't mount.

The reason for telling you to mount it was to see where your computer mounts any usb stick. You don't want to dd zeros all over a hard drive! You could mount a usb stick, see where that goes, unmount it and replace with the one you are trying to repair. But if it doesn't actually mount, then it may well be dead.


All times are GMT -5. The time now is 06:47 AM.