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 was also 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"

share|improve this question
    
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. – Bharadwaj Raju 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

10 Answers 10

up vote 73 down vote accepted

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

share|improve this answer
2  
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
2  
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
1  
@SeverusTux Very good point. I haven't tested it with tar so I added to my answer to install pre-req. If you did it with tar successfully please let me know the correct command and I will edit (tar -xf(z?) name-of-iso -C /mnt/?) – Zanna Jun 3 '16 at 16:32
1  
@Zanna I searched a lot, It seems like iso files cant be extracted using tar . All I have found is using mount -o loop . 7z is better even though its not inbuilt. – Severus Tux Jun 3 '16 at 17:03
1  
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

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.

share|improve this answer
1  
+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

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

share|improve this answer
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

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
share|improve this answer
2  
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
6  
@SeverusTux Actually, unetbootin is no more 3rd party than anything else. It's available through apt-get. – mchid Jun 3 '16 at 8:16

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.

share|improve this answer
    
like this: dd if=/dev/null of=/dev/sdb ? This doesn't seem to do anything – quantumbutterfly Jan 10 '17 at 5:03
1  
/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

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.

share|improve this answer

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.

share|improve this answer
    
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

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
share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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