Installing Linux via Bootable USB

Most of my Linux experience has been with Ubuntu. If not Ubuntu, then a relative flavor with Linux Mint and some slight tinkering with elementaryOS. The great thing about these three is that you can easily create a bootable media for either running a live desktop to test or to install thanks to the Startup Disk Creator application that ships with Ubuntu and Linux Mint both (and likely eOS also, but I didn’t check).

If you want to create a bootable media for another distribution, you’re out of luck with Startup Disk Creator. Even Debian distributions, which Ubuntu is derived from and actually show up in the pane listing ISO source images to use in Startup Disk Creator, won’t complete write to the USB drive without spitting out an error right before it would normally queue for password to write the boot record onto the media.

You’ll get a few different opinions on how to create a bootable media when searching online, some of which suggest installing and using additional packages such as UNetBootin or USB Creator. If you’re not comfortable with using terminal, or aren’t familiar enough with mounted drives and devices to make sure you don’t commit an act that will cause you to potentially lose vital data on your computer, then perhaps those are the better options.

For me, I hate installing any applications or packages that I don’t need. Since Ubuntu, and I wager most Linux distributions, ship with dd I prefer to use that. What’s better is its use is fairly straight-forward on top of it. You can get a few ideas of what dd can be used for by viewing its Wikipedia page. It appears to be a relatively easy option for backing up sensitive data, such as the MBR on a drive.

But anyway. If you’re looking to create a bootable media for a non-buntu distro, you can do so with dd with the following command:

sudo dd if=image.is of=/dev/sd?

If you read up on dd at the Wikipedia page, you’d have seen that there is also an argument you can pass: bs. By default, bs, which defines the block size for reading and writing in dd, is 512 bytes. Some suggestions that I’ve seen online recommend defining the block size to be larger. Larger block size would lean one to believe means less cycles when writing. So, you may want to bump that up to something larger, though staying within appropriate boundaries. Examples online of using dd to create writable USB drives often include a block size of 1MB. So, you could include that in the command:

sudo dd if=media.is of=/dev/sd? bs=1M

You must also make sure the media you’re writing to isn’t mounted before using dd to write to it:

sudo umount /dev/sd?

So, for example, if you’re USB drive was mounted as device sdc and your Linux distro image was named Linux-LiveUSB.iso (and we’re assuming you’ve navigated terminal to be in the same directory as the ISO image to avoid needing to include the path), you would issue the following to write it to the USB drive:

sudo umount /dev/sdc
sudo dd if=Linux-LiveUSB.iso of=/dev/sdc bs=1M

A brief summary of the commands are

  • if: Input File. This is the location and file that is being read from.
  • of: Output File. This is the location and/or file that is being written to.
  • bs: Block Size. This is the size, in bytes, that each data block is being read and written at. The default is 512, so leaving this undefined will have dd read and write data blocks at 512 bytes.

Lastly, I would say to only use this method if you need to create a bootable USB drive, and there are no other pre-installed software to get the job done. For example, why use this over Startup Disk Creator if you’re in a *buntu OS and need to create a bootable *buntu USB drive? There is no reason to. If you’re writing to a CD/DVD, then I would think the included disk burning software on your system would work just fine. If not, then dd should work fine for that as well. Just use the device name of the disk burner when designating the output file in the command. If the idea of manipulating data via terminal scares you, then I’d say better safe than sorry, and just look around for a fitting application with an easy UI.

Ubuntu: Creating non-buntu Startup Disks

I ran into this problem while trying to create a startup disk for OpenSUSE in Ubuntu using the included Startup Disk Creator. I noticed that only Ubuntu and Ubuntu-based isos were being listed in the program, and even when browsing to the other isos, I found that clicking to open them in the program did nothing.

After some brief searching, I came across the following thread in Ubuntu Forums. The second post within the thread was extremely helpful to me, and following its instructions led to a successful bootable USB drive with which I was able to test OpenSUSE. On top of that, I learned from the post that the Startup Disk Creator software included in Ubuntu is actually limited to only Ubuntu-based isos.

So, I thought it would be worthwhile to repost the command here on my blog for both my own records and for anyone else who might not have managed to come across the use of dd to create bootable disks in Ubuntu. From what I understand, it should work for just about any type of bootable disk. However, I can only testify that it worked for the OpenSUSE disk from my own experience so far. As always, make sure you are certain of what you’re inputting when working with CLI, and this command could cause some serious pain in terms of data loss if you accidentally designated the wrong location.

sudo dd if=/path-to-iso of=/dev/sdX bs=4096

The command should be fairly straight-forward. The if argument should be the full path that points to the location of the iso. The of argument should be the device that is being written to as the startup disk. That’s probably obvious, but I felt it was necessary to clarify just in case. I’m assuming that bs is referring to the boot sector location of the device being written to, but that is purely speculation on my part and the value was simply left as-is when I used this method of creating the boot disk.

You can also use the mount  command to list all mounted devices currently connected to your computer. If you know the name of the device (which you can see by hovering over the USB drive’s icon on the Unity launcher) you can then look through the list of devices displayed from mount  and find what device it is so that you supply the right value for the of argument when using dd. A more graphical method would be to open the Disk Utility and find the USB drive listed in the left pane. Clicking on it will then display the device information in the right pane, including where the device is mounted.

I’ve been meaning to create a Windows boot disk using this, to at least see if it would work. I need to re-install Windows on a laptop that doesn’t have a disc drive built into it, and the USB method seems my best option. I’ll add a comment or update the post with the results once I run it.