Software & AppsOperating SystemLinux

How To Format a USB Drive with Block Size Error in Ubuntu

Ubuntu 13

If you’re using Ubuntu and have encountered a block size error while trying to format your USB drive, this guide will provide you with several solutions. This error typically arises when you’re unable to delete partitions on a USB drive. Here are four possible solutions to this problem.

Solution 1: Using the dd Command

The dd command is a powerful tool that can copy and convert raw data. In this case, we’ll use it to overwrite the first 32 blocks of the USB drive with zeros, effectively wiping the partition table.

  1. Open a terminal.
  2. Run the command: sudo dd if=/dev/zero of=/dev/sdd bs=2048 count=32

Replace /dev/sdd with the correct device path for your USB drive. The if parameter stands for “input file” (in this case, /dev/zero), of stands for “output file” (your USB drive), bs stands for “block size” (2048 bytes), and count stands for the number of blocks to be copied (32 in this case).

After the command finishes, you should be able to access your USB drive through tools like GParted.

Solution 2: Using the fdisk Command

The fdisk command is a disk partition manipulation tool that can create, delete, resize, and manage partitions on your drives.

  1. Open a terminal.
  2. Run the command: sudo fdisk /dev/sdy

Replace /dev/sdy with the correct device path for your USB drive.

In the fdisk prompt:

  • Type p to list the partition table and identify the partition you want to delete.
  • Use the command d # to delete the identified partition (Replace # with the partition number).
  • Type w to save the changes and exit fdisk.

Eject the USB drive and reconnect it to check if the partitions have been successfully deleted.

Solution 3: Using the wipefs Command

The wipefs command can be used to erase all partitions on a device.

  1. Open a terminal.
  2. Run the command: wipefs -a /dev/your-device

Replace /dev/your-device with the correct device path for your USB drive. The -a option tells wipefs to erase all available signatures.

Double-check the device path before running the command to avoid any accidental data loss.

Solution 4: Using the sgdisk Command

The sgdisk command is part of the gdisk package and is used to manipulate the partition table. This solution is particularly useful for UEFI-based bootable disks.

  1. Open a terminal.
  2. Run the command: sudo sgdisk --zap-all /dev/???

Replace ??? with the appropriate identifier for your USB drive, which can be found using sudo parted -l or sudo fdisk -l. The --zap-all option tells sgdisk to zap the partition table on the USB drive, allowing you to create new partitions.

Use caution when using this command as it irretrievably removes any data on the drive.

Note: It is important to double-check the device path before running any of the above commands to avoid accidentally affecting the wrong drive. Additionally, using tools like GParted or mkusb can provide a graphical interface and additional safety measures when working with partitioning and formatting USB drives.

By following these steps, you should be able to format a USB drive with a block size error in Ubuntu. Always remember to backup your data before performing these operations to prevent any accidental loss of information.

What is a block size error?

A block size error occurs when you encounter difficulties deleting partitions on a USB drive. It usually indicates an issue with the partition table or the formatting of the drive.

How can I identify the correct device path for my USB drive?

You can use commands like lsblk or sudo fdisk -l to list all connected drives and their device paths. Look for the drive with the appropriate size or label to determine the correct device path.

Can I recover data from a USB drive after formatting it?

Formatting a USB drive erases all data stored on it. However, if you have a backup of your data, you can restore it after formatting. It is important to always have a backup of your important files to prevent data loss.

Are there any graphical tools available for formatting USB drives in Ubuntu?

Yes, there are graphical tools like GParted and mkusb that provide a user-friendly interface for formatting and partitioning USB drives in Ubuntu. These tools can offer additional safety measures and a visual representation of the drive’s partitions.

How do I backup my data before formatting a USB drive?

To backup your data, you can simply copy and paste the files to another location, such as your computer’s hard drive or an external storage device. Alternatively, you can use backup software or cloud storage services to create a backup of your files.

Leave a Comment

Your email address will not be published. Required fields are marked *