2

After I used dd to make a USB drive from an Ubuntu ISO, I am unable to format it for normal use.

I ran:

sudo dd if="ubuntu-16.04-desktop-amd64.iso" of="/dev/sdb" bs=4M

In order to create a bootable USB drive.

However, after I was done with it, I wanted to format it as FAT32 and use it like a normal USB drive.

No problem, should be easy, right? WRONG.

I have tried:

  • Using the included Disks application to format it. It threw an error about corrupt GPT tables and wouldn't give me an override option.
  • Using Gparted the erase the current partition table and write a new MBR table [completed successfully]
  • After that I created a FAT32 partition spanning the entire volume, and remounted. [Showed up in Files, good so far]
  • Attempted to copy a file to it. It thre an error saying the medium was read-only.
  • Erased the partition table again in Gparted and this time created an NTFS partition spanning the entire disk. [Same RO error when attempting to copy a file onto it]
  • Repeated the procedure trying this time with EXT4 [Same RO error]
  • Repeated procedure trying a GTP table instead of an MBR table. {Same error]

Finally, I tried running:

sudo hdparm -r0 /dev/sdb

And remounted. Still the same error. Keep in mind that I remounted it after formatting it each time.

I am at a total loss. Has dd bricked my USB drive?

2 Answers 2

3

I can't really be sure which of the things I did fixed it, but it turns out that something must not have been synced.

Simply rebooting the computer fixed the issue. However I did try plugging it into a different Ubuntu system and it didn't work there either. So it was definitely something I did that fixed it.


For anyone else facing this issue, I would recommend running these commands to make sure it is usable again:

sudo dd if="/dev/zero" of="/dev/sdX" bs=1M count=10 #Replace "X" with your USB's letter
sudo reboot
8
  • If that is the solution you have found for your problem, then maybe you should mark your own answer so that this question could be classified as solved. Jun 25, 2016 at 15:13
  • @CristianaNicolae - Please reverse your downvote. There is a two-day waiting period before I am allowed to mark it as the answer. Jun 25, 2016 at 15:20
  • @CristianaNicolae lighten up a little.
    – nixpower
    Jun 25, 2016 at 15:41
  • @Android Dev - Sory, the downvote was not my doing. But I have upvoted the answer. I hope this helps . Jun 25, 2016 at 17:20
  • The last command to reboot isn't a bad idea, but it's not necessary. You can simply just format the USB stick with your tool of choice after zeroing just the first couple MB of the USB device.
    – b_laoshi
    Apr 12, 2017 at 0:51
1

using fdisk can be good solution(Be careful not to use wrong drive)

Find your device/disk name:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   1  15.2G  0 disk 
├─sdb1   8:17   1   564M  0 part /media/user/pendrive
└─sdb2   8:18   1    31M  0 part 

unmount all of mounted partition
then you wand to select whole partition so /dev/sdb

$ sudo umount /dev/sdb1

then use fdisk to create a partition and format to specific filesystem
Be careful here in selecting disk

$ sudo fdisk /dev/sdb

then you can use m for help
create a partition table we use DOS partition so o then you can print partition table with p

Command (m for help):o

Created a new DOS disklabel with disk identifier 0xd745b93f.

Command (m for help):p
Disk /dev/sdb1: 564 MiB, 591396864 bytes, 1155072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos 
Disk identifier: 0xd745b93f

then create new partition using n
you can hit enter for default choice of one primary partion or choose according to given option

Command (m for help):n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-1155071, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-1155071, default 1155071): 

Created a new partition 1 of type 'Linux' and of size 563 MiB.

here your default partition is Linux you can change by typing t and select c for FAT32

Command (m for help): t
Selected partition 1
Partition type (type L to list all types):c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

or you can use L to list all the type and select your choice
Then finally you can conform format and quit using wq

Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Now you can remove unplug and plug again
You can see new drive try writing by making folder & file
Now it must work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .