1

I got a partition that is probably created by dd, and is about 200MB on a 4GB USB stick. I am failing to delete it using GParted (the option is greyed on the right-click menu).

enter image description here

enter image description here

2

Open a terminal

steve@mcr-pc-29334:~$ sudo fdisk  /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d                   
Selected partition 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
steve@mcr-pc-29334:~$ 

so sudo fdisk /dev/sdb

then press d

to delete the partition if its the only one there it will auto select otherwise it will prompt for partition number

then press w to write the changes to the disk

done :)

|improve this answer|||||
1

Try unmounting it from commandline: umount /dev/sdb1.

If you cannot delete it in any way, create a similar partition in a loopback device and dd it to that stick.

Then, you must install the programs to create a FAT32 partition again.

|improve this answer|||||
1

I think the reason the option was greyed out is because the stick wasn't actually unmounted. It's a bug in GParted because I unmounted it using its Unmount right-click menu option, and I didn't get a message saying the operation failed.

|improve this answer|||||
0

Sorry if this answer is too generic, but it applies to situations where partitions just won't delete - by deleting the partition table. You might need this for those NTFS volumes that are locked or corrupted for example, or when MBR, VBR etc are corrupt or locking the filesystem.

This will destroy all* data so backup first. In Ubuntu close GParted and unmount the volume if possible, then type:

sudo dd if=/dev/zero of=/dev/[drive name] bs=512 count=4 status=progress

where: [drive name] including brackets is the name of the drive that is locked, bs=block size in bytes; count=number of blocks to overwrite. I only needed 4 blocks i.e. 2048 bytes in my case, you might need more; status=progress is optional and displays progress of dd.

After I did this, the drive looked unformatted in gparted and I was able to create a partition table and new partitions.

*The remaining data will still be lingering on the drive though so you could write over the entire drive with zeros or /dev/urandom if you need to.

This situation arose for me because I'd been given a usb memory stick which claimed to be 16GB capacity but was actually 4GB and wasted much time backing up files, as it would corrupt anything stored past 4GB. See F3probe https://askubuntu.com/questions/737473/check-real-size-of-usb-thumb-drive

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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