Unable to delete USB Drive partitions (Block size error)
I have been unable to format/delete the partitions on my Sandisk Cruzer Force 32 GB USB Drive. I get the following error when deleting any of the partitions on it.
`Error deleting partition /dev/sdd2: Command-line `parted --script "/dev/sdd" "rm 2"' exited with non-zero exit status 1: Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.
(udisks-error-quark, 0)
Is there any way I can completely format all of my drive and turn it into one large partition? I haven't found a solution to this particular error here yet, so I thought I'd actually ASK for once
The problem you are describing was caused by a low-level device tool (like dd) writing blocks at the wrong size directly onto the device.
To fix this, you need to re-write the device blocks to the appropriate size. This can be done with dd. Double check your output device before running the command
sudo dd if=/dev/zero of=/dev/sdd bs=2048 count=32
Once the dd command is done, you should be able to access your device through gparted.
You Can always try using fdisk
Open a terminal (Ctl+ALt+t) and type
sudo fdisk /dev/sdy
where /dev/sdy
= The device file for your flash drive. Once you get fdisk
open, type p
to list the partition table, Once you know where it is located you can use d #
to delete it. (#
= The partition; ExAMPLE d 1
, d 2
) w
writes the partition table back to the disk and q
quits, m
for help)
If fdisk
fails, Then I would use dd
(Be careful using this it got it didn't get its nickname for no reason)
sudo dd if=/dev/zero of=/dev/sdy bs=512 count=1
Of course /dev/sdy
should be replaced with the actual device for your flash drive, will do that for you. You can increase the count= number to write zeros to more of the disk, or omit it entirely to overwrite the entire disk. Needless to say, if you do this, you irretrievably lose any files that may have been stored on the disk.
wipefs -a /dev/your-device
it will erase all partition in your disk
This issue has something to do with UEFI based bootable disks. I frequently create bootable USB disk, then I need it for storage but can't delete the partition.
This one command below zaps the partition table so I can do whatever next I want with the USB disk.
sudo sgdisk --zap-all /dev/???
Replace ??? with the appropriate identifier (e.g., sdc) corresponding to the USB disk to be cleared. It can be found out by -
sudo parted -l
or
sudo fdisk -l
or
using the disk utility.
dd is powerful but dangerous
dd
is a very powerful but also very dangerous tool. It works well to wipe the first part of a USB drive in order to remove any data, that might confuse the tool that you want to use. But dd
does what you tell it to do without questions, so if you tell it to wipe your family pictures ... and a minor typing error is enough to overwrite another drive instead of the USB drive, that you intended to overwrite.
Yes, you can use dd
, if you know what you are doing, but please check and double-check, that the command line with dd
is correct.
mkusb wraps a safety belt around dd
mkusb provides a graphical user interface with checkpoints to help you identify the target drive and double-check that you are wiping the correct drive.
There are menu options to wipe the first megabyte (actually mibibyte), which is usually enough, or the whole drive, which is a slow process, and useful only in special cases, for example when a pendrive is getting slow (for example less than half of the original speed.)
See these links for details how to install and use mkusb version 12 alias mkusb-dus.
help.ubuntu.com/community/mkusb
mkUSB-quick-start-manual.pdf