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

  • What are you using to delete the partitions? – kos Sep 18 '15 at 15:53
  • I have been using Disks. GParted does not seem to detect/display my USB Drive. – Nectar Sep 18 '15 at 16:07
  • 4
    Have you tried wiping it clean first with dd if=/dev/zero of=/dev/sdd bs=2048? MAKE SURE YOU USE /dev/sdd ONLY IF THAT'S WHAT IT IS! – Daniel Sep 18 '15 at 16:51
  • Brilliant, that worked perfectly. I'll remember those commands :) – Nectar Sep 18 '15 at 17:10
up vote 162 down vote accepted

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.

  • It sounded so right, but still didn't work for me :( Is there any way to just fix it? – Eric Fossum Mar 11 '16 at 23:10
  • 6
    I was able to fix this error without re-writing the whole device, I just added count=32 at the end of the command and then ran dd. Much faster this way ;-) – That Brazilian Guy Apr 20 '16 at 18:43
  • 4
    @Lee It will only write 32 blocks (in this case, 32 blocks of 2048 bytes, or 68 KB), instead of writing each and every byte on the device. I believe just overwriting the partition table, or equivalent area at the beginning of the device would suffice. I specified 32 blocks just to be sure. – That Brazilian Guy Aug 11 '16 at 19:59
  • 1
    Worked but i had to reboot my computer to make it work after using the command line. – Danyl Bekhoucha Apr 12 '17 at 15:44
  • 1
    @gooseberry I don’t think “writing blocks at the wrong size” is possible. The only difference should be speed (and in case of flash memory, wear). The command probably works, but the explanation doesn’t seem right. – Martin Jan 6 at 15:34

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.

  • 2
    Worked perfectly. Did sudo fdisk /dev/sda, then at the prompt typed d a couple of times to delete each partition in turn, then w to write my changes. Then took out the USB drive, put it back in again and used the disk manager to create a Fat32 partition. – Robin Winslow May 17 '16 at 17:15
  • What is dd's nickname? – Kolob Canyon Jan 3 '17 at 12:05
  • Does it stand for dick death the demon slayer? – Kolob Canyon Jan 3 '17 at 12:27
  • Nice! didn't need the demon slayer :| – Kolob Canyon Jan 3 '17 at 12:47
wipefs -a /dev/your-device

it will erase all partition in your disk

  • 1
    This command helped me in my case when I could not format my USB drive. Be careful when choosing your device path. Double check! – Bakhtiyor Feb 16 '17 at 9:56
  • 1
    updated for simplest answer that works – knocte Dec 3 '17 at 13:50

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.)

enter image description here

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

Use fdisk command to delete the partition and create again.

Run command:

sudo fdisk /dev/sdxY  

(In my case, partition is 'sdb1' - replace with the correct name)

Command (m for help): d to delete the partition, choose 1 or 2.

Type w to save and exit.

Now eject the usb and connect again to check changes.

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.