Restoring my USB drive

Message
Author
Bierhundt
Posts: 186
Joined: Wed Jan 31, 2018 12:12 pm

Restoring my USB drive

#1 Post by Bierhundt »

When I downloaded antiX live from a Winblows laptop, it somehow 'locked' the info on my 32Gb USB drive. now it's only 3.3Gb,, and I can't remove the antiX to get my drive back. I've been trying to fdisk the drive, but so far it's not working. fdisk calls the drive sdb1(empty) and sdb2 (where antiX resides):

Code: Select all

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *        0 1282047 1282048  626M  0 Empty
/dev/sdb2         328    7015    6688  3.3M  1 FAT12
I've been following these instructions, but it doesn't give me the drive letter:

Code: Select all

fdisk -l /sdb/1 /sdb2
fdisk: cannot open /sdb/1: No such file or directory
fdisk: cannot open /sdb2: No such file or directory
I think normally the USB shows up as either drive 'D' or drive 'E' but I wanted to ask advice before I tried that.
https://www.pendrivelinux.com/restoring-your-usb-key-partition/ wrote:
Restoring your USB key to its original state using Linux:

A. First we need to delete the old partitions that remain on the USB key.

Open a terminal and type sudo su
Type fdisk -l and note your USB drive letter.
Type fdisk /dev/sdx (replacing x with your drive letter)
Type d to proceed to delete a partition
Type 1 to select the 1st partition and press enter
Type d to proceed to delete another partition (fdisk should automatically select the second partition)

B. Next we need to create the new partition.

Type n to make a new partition
Type p to make this partition primary and press enter
Type 1 to make this the first partition and then press enter
Press enter to accept the default first cylinder
Press enter again to accept the default last cylinder
Type w to write the new partition information to the USB key
Type umount /dev/sdx1 (replacing x with your drive letter)

C. The last step is to create the fat filesystem.

Type mkfs.vfat -F 32 /dev/sdx1 (replacing x with your USB key drive letter)

That's it, you should now have a restored USB key with a single fat 32 partition that can be read from any computer.
Is this not a good way to do this, (since I have a couple more flash drives that have given up!)? Any advice?
TIA

User avatar
duane
Posts: 266
Joined: Sun May 20, 2007 3:08 pm

Re: Restoring my USB drive

#2 Post by duane »

I do this in MX linux by opening the Gparted after the usb drive is plugged in and changing to the usb drive.
Make sure you are not opening the hard drive that your operating system is on.
You don't want to delete anything on your computer.
Once you have the right drive, on my system it would be /dev/sdb since /dev/sda is my hard drive.
Then you can see which partition on the usb drive is the one you want to delete and delete it.
If you are making a usb drive for Antix or MX use the live usb-maker provided to make your new live usb.
I don't know your level of expertise but I suggest using the gui based tools.
Lenovo M92p Quad Core i5 3470 3.2Ghz

Bierhundt
Posts: 186
Joined: Wed Jan 31, 2018 12:12 pm

Re: Restoring my USB drive

#3 Post by Bierhundt »

duane wrote:I do this in MX linux by opening the Gparted after the usb drive is plugged in and changing to the usb drive.
Make sure you are not opening the hard drive that your operating system is on.
You don't want to delete anything on your computer.
Once you have the right drive, on my system it would be /dev/sdb since /dev/sda is my hard drive.
Then you can see which partition on the usb drive is the one you want to delete and delete it.
If you are making a usb drive for Antix or MX use the live usb-maker provided to make your new live usb.
I don't know your level of expertise but I suggest using the gui based tools.
THX, I'll try that! I'd just like to be able to use those USB sticks again ;>)

Bierhundt
Posts: 186
Joined: Wed Jan 31, 2018 12:12 pm

Re: Restoring my USB drive

#4 Post by Bierhundt »

@ duane - That worked fine on one of the sticks, now it's just 29Gb unallocated. The other two are not showing anything (unallocated), but when they first plug in, they show antiX files (locked) and Debian 9.3 files (locked) with the appropriate number of Gb's taking up the space. If I then go to Gparted, it shows as if there is nothing on it! I can't format either one, even though I was able to format the first one. Do I need to load something on these so that I can use them for videos, pix, docs, etc.?
TIA

GreenMartian

Re: Restoring my USB drive

#5 Post by GreenMartian »

Assuming your still on Win, and have AntiX on a thumb drive.

You can always format Fat32 another USB stick using Rufus. Burn AntiX or MX to that drive. Fire up that stick, and use Gparted to delete the original AntiX thumb drive. While you're in Gparted, then create a partition (msdos) and format the drive as fat32.

Once that's clear, re-fire Win and run Rufus. You should now be able to delete AntiX on the 2nd stick, then partition it as msdos and format fat32.

Hopefully, you should have both drives free and clear.

Use Rufus, rather than a Win program. Sometimes those Win programs can take devices prisoner.

GM

Bierhundt
Posts: 186
Joined: Wed Jan 31, 2018 12:12 pm

Re: Restoring my USB drive

#6 Post by Bierhundt »

I've tried everything suggested .... and from a couple of responses, I think I must have worded my question wrong (not unusual for me). First, I am using MX Linux .... the only time I use Winblows is to download my distro, and to use my BeerSmith application. I have 2 ea. 32Gb USB drives. One is loaded with antiX-17, and the other is loaded with Debian 9.3. Both of the operating systems show that they are locked for some reason. I've never run up against this before. I am trying to clear the ISOs off of both drives so I can use the drives for storing documents/videos/ photos, NOT to put another ISO on them. So far, I have tried to format with winblows, which tells me that it is unable to format because it doesn't recognize the information on the drives. I have also tried Gparted on MX Linux, which doesn't even recognize the USB so that I can try to unlock and format the drives. Any other advice would be greatly appreciated!
TIA

User avatar
chrispop99
Global Moderator
Posts: 3174
Joined: Tue Jan 27, 2009 3:07 pm

Re: Restoring my USB drive

#7 Post by chrispop99 »

I've come across this problem a couple of times, though with other Linux distributions. After following pretty much the same journey that you have taken, I eventually found a piece of Windows software that would recover drives that were impossible to format by normal means. It is available here:

https://www.bleepingcomputer.com/downlo ... rmat-tool/

Hope this fixes it for you.

Chris
MX Facebook Group Administrator.
Home-built desktop - Core i5 9400, 970 EVO Plus, 8GB
DELL XPS 15
Lots of test machines

User avatar
Adrian
Developer
Posts: 8266
Joined: Wed Jul 12, 2006 1:42 am

Re: Restoring my USB drive

#8 Post by Adrian »

Try: "live-usb-maker partition-clear"

User avatar
fehlix
Developer
Posts: 10366
Joined: Wed Apr 11, 2018 5:09 pm

Re: Restoring my USB drive

#9 Post by fehlix »

In some cases usb-devices do resist to get properly formated.
Even very good tools like Rufus (on win) sometimes cannot sort this out.
The HP-formater is certainly a good choice in that OS to handle this.

On Linux not all formater-tools do handle USB-devices well enough when it comes to clearing the partition table properly before the formating takes place.
I‘ve seen this happen unfortunately with Gparted and also within the famous Mint-Stick usb-formater tool.

The most reliable tool for clearing partiton table I‘ve seen.. ( you won’t believe it ;=)
comes with MX-Linux. The partition clearing is handled within the live-usb-maker tool.
You would call the partion clearing from within the terminal like this

Code: Select all

# sudo live-usb-maker partition-clear 
The tool is save in a sense as it will only show you the available USB-device.

Code: Select all

# sudo live-usb-maker partition-clear 
======================================================
Starting live-usb-maker
======================================================
Only one target usb device was found sdg
Will use target device sdg (7.5G Lexar USB Flash Drive)
-------------------------------------------------------
Ready to perform partition-clear action on sdg
-------------------------------------------------------
Shall we begin?                                                                                                               
  > yes                                                                                                                       
  > no                                                                                                                        
  > pretend mode                                                                                                              
Press <Enter> to select the highlighted entry                                                                                 
Use 'h' for help, 'r' to redraw, 'q' to quit                                                                                  
 

After partion table is cleared properly you will have a far more better chance
that Gparted will create a proper formated USB-Stick.
Within Gparted create the Partiton Table (unter Menu→ Device).
After that is done create a new partition (under Menu → Partition)
using the whole space and choose eg. format FAT32 and Label something like USBFAT32.

Please remember USB-devices do have a limited live write-cycle. To properly verifiy the USB-stick will not have blocks with failure do check the USB-stick using the tool badblocks
like this for usb device e.g. /dev/sdg

Code: Select all

# sudo  badblocks  -t random  -v -w -s  /dev/sdg
 
Even for new USB-Sticks it might be a good advice to check the device before using it.
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
Richard
Posts: 1577
Joined: Fri Dec 12, 2008 10:31 am

Re: Restoring my USB drive

#10 Post by Richard »

Adrian wrote:Try: "live-usb-maker partition-clear"
I did on a damaged 8 GB Lexar and it did; however, gparted still could not create a partition table --said the device was read-only.

Running "sudo badblocks -t random -vws /dev/sdc" on it at the moment to see if it will then accept creating a partition table. It may just be beyond help. Have another identical that works fine.
badblocks is about 2/3 done. Time will tell.

Now showing 378 errors, so it really seems as if it's done.
. . .
7675957
7675958
7675959
7675960
7675961
7675962
7675963
7675964
7675965
7675966
7675967
done
Pass completed, 3850618 bad blocks found. (0/0/3850618 errors)
root@mx171:/home/richard#
Yep. It's really done for.
Last edited by Richard on Fri Apr 20, 2018 11:27 am, edited 1 time in total.
Thinkpad T430 & Dell Latitude E7450, both with MX-21.3.1
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.

Post Reply

Return to “General”