Score:0

Help formatting usb drive

bd flag

So I have accidentally corrupted a sandisk usb drive. When I go to Disks & Devices, the usb is not detected there. I can access it only through kde partition manager or the terminal but I am unable to read any data in it. It is supposed to be 64GB but in kde partition manager, the capacity is shown as 64MB. I tried creating a new partition table, it shows success but the partition table doesn't get created. It still prompts me to create a new partition table. How do I make the usb drive usable? I don't care if the data is lost.

I tried the previous answer to a similar question How to format a USB drive?

It didn't work for me. Here is the output when executing those commands.

❯ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0     4K  1 loop /snap/bare/5
loop1         7:1    0  72.9M  1 loop /snap/core22/509
loop2         7:2    0  72.9M  1 loop /snap/core22/522
loop3         7:3    0 452.4M  1 loop /snap/gnome-42-2204/56
loop4         7:4    0 460.3M  1 loop /snap/gnome-42-2204/65
loop5         7:5    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop6         7:6    0  49.8M  1 loop /snap/snapd/17950
loop7         7:7    0  49.8M  1 loop /snap/snapd/18357
sda           8:0    1    64M  0 disk 
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 200.9G  0 part 
├─nvme0n1p4 259:4    0     1G  0 part 
├─nvme0n1p5 259:5    0   2.2G  0 part 
├─nvme0n1p6 259:6    0   252G  0 part /
└─nvme0n1p7 259:7    0  20.6G  0 part 

❯ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf430b9ec.

Command (m for help): o
Created a new DOS disklabel with disk identifier 0xd9afc416.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-131071, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-131071, default 131071): 

Created a new partition 1 of type 'Linux' and of size 63 MiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.


❯ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0     4K  1 loop /snap/bare/5
loop1         7:1    0  72.9M  1 loop /snap/core22/509
loop2         7:2    0  72.9M  1 loop /snap/core22/522
loop3         7:3    0 452.4M  1 loop /snap/gnome-42-2204/56
loop4         7:4    0 460.3M  1 loop /snap/gnome-42-2204/65
loop5         7:5    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop6         7:6    0  49.8M  1 loop /snap/snapd/17950
loop7         7:7    0  49.8M  1 loop /snap/snapd/18357
sda           8:0    1    64M  0 disk 
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 200.9G  0 part 
├─nvme0n1p4 259:4    0     1G  0 part 
├─nvme0n1p5 259:5    0   2.2G  0 part 
├─nvme0n1p6 259:6    0   252G  0 part /
└─nvme0n1p7 259:7    0  20.6G  0 part 

Even though fdisk says a new partition was created, when rechecking afterwards with lsblk it doesn't show any new partition.

24601 avatar
in flag
what is your actual question since you ask two different ones? Is it to format the drive or to recover the data from it? Please [edit] accordingly.
hasan ramp avatar
bd flag
@graham made the changes
24601 avatar
in flag
does this answer your question? https://askubuntu.com/questions/198065/how-to-format-a-usb-drive
hasan ramp avatar
bd flag
@graham I used method 2. In the end it shows "Created a new partition 1 of type 'Linux' and of size 63 MiB.". But when I use lsblk again, it doesn't show the new partition.
ar flag
Be aware that SanDisks have gained a reputation for [sudden failures](https://arstechnica.com/gadgets/2023/05/sandisk-extreme-ssds-keep-abruptly-failing-firmware-fix-for-only-some-promised/) recently and [Western Digital was sued](https://www.theregister.com/2023/08/17/western_digital_sandisk_ssd_lawsuit/) for it. I hope this is not the situation for you, and wish you best of luck.
hasan ramp avatar
bd flag
@user68186 That's not the case. The usb was working, but I accidentally started to format it and then I cancelled it midway. Probably that's why it got corrupted somehow.
ar flag
Does this answer your question? [How to format a USB drive?](https://askubuntu.com/questions/198065/how-to-format-a-usb-drive)
hasan ramp avatar
bd flag
@user68186 read above comments
ar flag
I am voting to close this question as a duplicate. the method 2 should have worked. Please try it again and copy and paste the commands and corresponding outputs in your question. You may have to unplug and plug the drive again to get it recognized. It is important to edit the question and demonstrate that the answers to the linked question didn't work so that it is not considered a duplicate.
ar flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/148008/discussion-between-user68186-and-hasan-ramp).
sudodus avatar
jp flag
The hardware of your USB drive might be damaged. Otherwise the methods discussed in the previous comments should work. Anyway, you can analyze the problem according to [this link](https://askubuntu.com/questions/144852/cant-format-my-usb-drive-i-have-already-tried-with-mkdosfs-and-gparted/933035#933035) and if you are lucky, find a solution.
cc flag
Take a look at the f3 package (fight fake flash) -- the larger flash drives are popular fraud targets.
guiverc avatar
cn flag
You've provided no OS/release details; where software stack specifics are helpful and avoid is being limited to *generic* advice. Your details match *dying* or a *failed* flash drive, with the media being *cheap* and made to cost, without the diagnostics or redundancy found in hard drives or SSDs. As such I see the question currently about hardware problems due to failing/faulty device
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.