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.