Creating a USB Boot Disk

So, just needed to create another USB Boot disk, and had to search through my command line history for the command set I used… tends to be, if you’ve ever needed to do anything more than once, its probably a good idea to write it down. So here is how to create a Linux USB pen, on the command line, step by step…

Step One: Plug in the USB Pen. Yes its that simple! No that isn’t it for this step. You then need to run ‘dmesg’ to find out what the computer thinks this drive is under. You should see something in the most recent messages about the USB pen, including something about /dev/sd*. Mine was /dev/sdb, with /dev/sdb1 being the actual drive. So, you then run ‘umount /dev/sdb1’ (replacing sdb1 with whatever your results are).

Step Two: Download the .iso image you want to use for the boot image. In my case, atleast this time, it was Ubuntu, with a file name of ‘ubuntu-13.04-server-amd64.iso’. Then, you can actually write the image! to do that you run ‘dd if=Downloads/ubuntu-13.04-server-amd64.iso of=/dev/sdb’. Thats it. What dd does, is copy and convert something – in this case, a binary image for a cd/dvd – and converts it into the files on a usb drive. in the command, you can see ‘if=’ which is how you set the input file, and ‘of=’ which is how you set the output file. Nice and easy!

Extra Credit: Now when dd is running, it has no progress bar or anything… it just sits there and says nothing at all. There is a way, however, to get it to say something. What you need to do, is open another terminal (in a new tab, screen, tmux window, whatever), and type ‘watch kill -USR1 `pidof dd`’. Note the backticks around pidof dd – those are important. On my keyboard, they are on the key above tab, although this may vary from country to country. This will then cause the terminal that you ran dd in, to start spitting out text – which will tell you exactly how much of the file it has written. If you’re just setting it running then going to do something else though, you probably dont need to bother with it.

WARNING WARNING WARNING: Be VERY sure where you are writing the output file – dd can and WILL overwrite a hard drive, quite happily. I’ve never tried to overwrite my main hard drive – I dont know if its possible while your using it as your main boot disk, but I would rather not find out. Also, make sure you dont have any data on the USB pen that you want to keep, as this will completely overwrite everything on the disk, even if it is much bigger than the actual disk image you are going from.

Other than that, have fun, and enjoy your new boot disk!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.