88

I was using:

dd  if=/path/to/my/ubuntuiso/ubuntu.iso  of=/dev/sdb1  bs=4M  &&  sync

In order to create bootable Ubuntu USB drives on older Ubuntu versions. It was working perfectly. Sometimes I used the Startup Disk Creator program, which worked well.

But when I use the same methods on Ubuntu 16.04 LTS, I get some warnings while formatting it afterwards.

The installation media works as expected, but when I try to format that USB stick after my work is done, I get the following warning :

enter image description here

The partitioning of that Pendrive looks strange :

enter image description here

And it also shows my 16GB pendrive as 64GB.

After struggling a lot with Gparted, I will somehow format it. But Why is it happening like this ?? Is there any better methods of creating bootable Ubuntu in 16.04 ?

EDIT : there is a related question here. But my question is not about how to format it properly. My question is "How to create a bootable USB without that errors." & "Wht are the causes of that error"

  • for UEFI I use sgdisk commands - I've made 6 distro live USBs this way in the last few months & it works beautifully for me – Zanna Jun 3 '16 at 8:00
  • @Zanna please explain the usage of sgdisk – Severus Tux Jun 3 '16 at 8:06
  • Are you sure that is the correct device? If it should be 16GB maybe it is /dev/sdc or something else. A lot of sd cards are 64GB and those don't usually work for booting. Your drive will not always show the same (sdb sdc) and it all depends on which drive was mounted first. – mchid Jun 3 '16 at 8:18
  • 1
    I format USBs with mkfs after an ISO. Works regardless of USB creation method. – UniversallyUniqueID Jun 3 '16 at 8:28
  • 4
    Possible duplicate of Unable to delete USB Drive partitions (Block size error) – Braiam Jun 3 '16 at 17:01

11 Answers 11

111

A command-line method to make a live USB for UEFI systems

Please note: this deletes all data on the target device.

Install prerequisite:

sudo apt-get install p7zip-full

Assuming the target USB is at /dev/sdb

(please check first with lsblk or gnome-disks or sudo fdisk -l and be sure you know what you are formatting)

Make sure the device has no mounted filesystem and unmount it if necessary, for example:

udisksctl unmount -b /dev/sdb1

Destroy existing partition table:

sudo sgdisk --zap-all /dev/sdb

Create new GPT:

sudo sgdisk --new=1:0:0 --typecode=1:ef00 /dev/sdb

Format as FAT32:

sudo mkfs.vfat -F32 /dev/sdb1

Check it:

sudo fdisk -l /dev/sdb

Should output something like:

Device     Start      End  Sectors  Size Type
/dev/sdb1   2048 15663070 15661023  7.5G EFI System

Mount the drive and extract iso onto it, replacing 'name-of-iso' with the actual filename of the iso you downloaded earlier

sudo mount -t vfat /dev/sdb1 /mnt
sudo 7z x name-of-iso -o/mnt/

Unmount

sudo umount /mnt

Now reboot & enjoy Ubuntu ^_^

(Here's where I originally learned to do this.)

  • 3
    Doing it... but this needs the packages p7zip-full , It would be better if you would add doing the same with tar in your answer. – Severus Tux Jun 3 '16 at 8:46
  • 3
    wow! Thank you very much . It works well. partition looks clean . It would be best if you add extracting using inbuilt tools like tar in your answer. (or even adding that 7z is available in p7zip-full) – Severus Tux Jun 3 '16 at 8:56
  • 2
    I'm upvoting this post because it is a nice description showing 'all' the basic steps :-) But there are also tools that make things automatically for the lazy user ;-) – sudodus Sep 6 '17 at 13:49
  • 3
    This is the only one working for me under 16.04. Thanks! The default app corrupts muy media with the wrong block size problem, and creates a read-only file system that I was unable to revert because of the block size problem. This method allows the user to enjoy all the remaining free space. – user334639 Oct 7 '17 at 0:11
  • 3
    Ubuntu 17.04's usb-creator (Startup Disk Creator) "corrupts" my USB drive every single time. And this step-by-step here is the only way to revert it to a normal writable state. gparted can't. – isync Jan 10 '18 at 12:33
34

Here's how I solved the problem of getting this error when trying to reformat a USB after using it as installation media:

  • First open the Disks Application under Applications > Disks
  • Select the bootable pen drive.
  • There will be an option menu on top right corner
  • Select the Format drive option (CTRL + F)
  • A pop-up will be shown. Select 0 partition and format the disk
  • Now the disk will be empty but it will be not recognized by system. But you can see on Disks Application.
  • Select the pen drive and re-format it. Now the pendrive can be detect by any system.

The accepted answer is too complex to use, as it required lots of typing and remembering the particular disk name (otherwise you may end up with serious problem). Mine is super easy to implement.

  • 2
    +1, but I think this question has a misleading title - I have edited it. The accepted answer to this question is a method of creating installation media, as OP requested, not simply formatting the drive (and you always have to be sure you are selecting the right device when formatting, no matter what method you use!) – Zanna May 16 '17 at 18:06
  • Ok, Thanks for letting me know. Now As per your edited title, You can use startup disk creator to create an fresh installation media after formatting the drive. – Gopal Prasad May 16 '17 at 18:15
  • Thank you. The menu in top right corner was not obvious to find. – Tor Klingberg May 9 '18 at 12:58
14

It is found that the problem is due to a bug in usb-creator-gtk. It is setting improper block-size during the creation of bootable media.

If this bug affects you, you can mark it here : https://bugs.launchpad.net/ubuntu/+source/usb-creator/+bug/1589028

  • 1
    On the last comment on the above website, There's the user named EoflaOE, and below it, you see the comments and what affected me and what did I suggest so you never try to damage your USB like last time. If you need to make your own bootable USB, Use Rufus or Universal USB Creator until this bug is fixed. – Eofla Jan 27 '17 at 15:05
11

This was much easier. Just replace /dev/sdd with your device address. This can be found in the Disks or Gparted utility.

sudo dd if=/dev/zero of=/dev/sdd bs=2048 count=32

You can then use Startup Disk Creator to burn the image to the drive.

7

I use UNetbootin on Ubuntu (both older version and 16.04) and it works fine on my PC. Here's the link for more info.

sudo apt-get install unetbootin
  • 3
    thanks for your interests, but my question is not "any alternatives ? " my question is "Why are those methods not working as expected?". I would also appreciate any other methods which does not involve 3rd party tools. – Severus Tux Jun 3 '16 at 8:11
  • 7
    @SeverusTux Actually, unetbootin is no more 3rd party than anything else. It's available through apt-get. – mchid Jun 3 '16 at 8:16
  • Does not allow a disk image (multi-partition) install, insists one partition mounted already. – Gringo Suave Apr 29 '18 at 18:54
5

Try dd if=/path/to/my/ubuntuiso/ubuntu.iso of=/dev/sdb this way never failed me. (Note b not b1 at the end - will destroy other partitions if present)

Did you check if the ISO is corrupted?

Also doing this from TTY while not logged in the graphical environment could help in tracking down the problem.

Edit: instead of using the ISO you could use /dev/null to overwrite the partition table.

  • like this: dd if=/dev/null of=/dev/sdb ? This doesn't seem to do anything – quantumbutterfly Jan 10 '17 at 5:03
  • 2
    /dev/null points to 'nothing' and is used for output, but /dev/zero generates zero characters (ascii 0). – sudodus May 16 '17 at 18:08
2

The complaint about block size was probably caused by a bug in the software reading the iso9660 file system. A new version of gparted is released and is available at least in Ubuntu 17.10, where this bug is squashed.


You can use mkusb to clone the drive. This method is not sensitive to the content of the drive, so it is very reliable.

It is also very safe, because mkusb 'wraps a safely belt' around the powerful but dangerous dd command. The target drive is shown very clearly and you have a final checkpoint, where you can double-check, that you will be installing to the correct drive (and avoid mistakes).

See this link: https://help.ubuntu.com/community/mkusb

If it is still not working, you can try according to the following link,

Can't format my usb drive. I have already tried with mkdosfs and gparted - Analysis of the problem

Please notice that you need not start with formatting, because mkusb will overwrite the previous content of the drive anyway. You can go ahead directly and

  • install the operating system from the iso file (or image file) or
  • restore the drive to a standard storage device
1

a problem that comes up with the chosen answer : The pen drive is now invisible upon inserting. (I'm on Lubuntu 16.04 64-bit) Solution: Open the Disks utility to mount it.

In Lubuntu: Start menu > Preferences > Disks.

What has worked with the chosen answer, is that we're back to good old way of the USB drive getting the bootable ISO written to it and still remaining a writable USB drive with remaining space available to store other files (from another existing OS where we're not running the live OS). With Startup Disk Creatoras of 16.04, it is wiping out the USB, creating a read-only partition akin to a CD, making the remaining portion of the USB unallocated (so a 32GB drive becomes a 900mb read-only drive), and I wasn't able to create any secondary partition in the unallocated space.

Update: Unetbootin seemed to do the job, the pen drive remained visible, didn't hide on inserting, and the remaining part of the disk remained available for storing other data. BUT the disk did NOT get recognized as a bootable USB when I booted my laptop! I used the Ubuntu version of UNetBootin.

  • 1. You might have better luck, if you install Unetbootin from the developer's PPA, because the version in Ubuntu's repository can be too old (not up to date to cope with new versions of Ubuntu); 2. The error message in the title of this question is because the software does not understand the iso9660 file system of a cloned boot drive; 3. And if you have problems to restore the drive to a standard storage device, you can use mkusb according to the link in my answer. (It is possible with gparted and Disks too, but maybe more difficult.) – sudodus Oct 7 '17 at 9:49
0

I had the exact same problem, even on a brand new SSD. I used Linux Mint 18.1 and Ubuntu 16.04 LTS ISO versions. No matter how many times I redownloaded the ISO's, rewrote the ISO's and did all tthe steps suggested above to resolve the error mention, it just wouldn't go away. Strangely I did have Mint 18.1 installed and wanted to do fresh install but then encountered the error. I even used the same USB sticks & SSD to install Windows 10, then rewrote the same USB disks AGAION with Ubuntu 16.04/Mint 18.1 and install failed. My opinion is that there was either fault with the ISO file or my particular hardware not compatible. I wasted several HOURS of my life.

** SOLUTION: Downloaded Ubuntu 17.04 ISO & installed. Worked fine on the exact same hardware, same USB drives/sticks where Ubuntu 16.04 wouldn't have any of it.****

0

Apparently the error lies with parted reading the drive incorrectly and not the dd command or the Startup Disk Creator program

Debian Bug report for parted: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788808

Workaround: If you use fdisk instead of parted then you will see the correct partitioning. Use fdisk instead of parted until the parted bug is fixed.

0

It is a shame that many of these GUI disk utilities won't just allow you to delete the partition table off the USB, instead of just prompting with stupid errors like:

Physical block size is 2048 bytes, but Linux says it is 512 bytes

That error dialog should be coupled with this question:

Would you like delete the partition table on this device (all data will be lost)?

Since it doesn't do this, you can immediately do it yourself with this command:

sudo sgdisk --zap-all /dev/sd?

Be sure of two things before you do the command above:

  1. Make sure your terminal is logged into the computer you think it is.
  2. Make sure the device path is correct (see the question mark in he command above,you need to change that to the correct device path).

As others have mention, you can figure out the device path with:

sudo fdisk -l

After this, you can probably proceed by using the utility you were using when you got this error.

BTW, the dd command solutions for this problem are too slow for my needs. All I really want to do is get rid of that error, without waiting on dd to zero out the whole drive.

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.