Sunday, July 7, 2013

Creating Fedora on Bootable USB

The following procedure is to create a bootable USB drive for Fedora software. I've tested the procedure by creating bootable USB drive for Fedora 19.

Creating USB on Windows

To create a bootable USB drive on Windows system, you need to download the software liveusb-creator. Please be aware that there are copies of virus infected liveusb-creator floating around various download site. You need to download from the official page here. Once you installed and launch the program, you just need to point to the target and the source. Please also note that the software can only create live images, it cannot create Fedora DVD image. 

I've not tested this software on Windows. The screen should be similar as the one below:

You just need to select the source and target and click Create Live USB.

Creating USB on Linux

There are three methods to create bootable USB drive on Fedora. The first method is to use liveusb-creator similar to the Windows method mentioned above. The second method is to use livecd-tools. This is a command line tool. The last method is to use dd command. Fedora recommends using the first two methods. Use dd command as a last resort.

Finding the Partition of USB Drive
In Linux, you need to find which partition your USB drive belongs to. Plug in your USB and find where the USB is mounted on.

Issue the command mount. You can find the USB information such as "/dev/sdb1 on run/media/technozeal/1GB.....". In this case,  /dev/sdb1 is the partition to the USB. For those USB drive without label you should see /.../NoName or /.../Untitled.

My example for the mount command returns:
/dev/sdb1 on /run/media/technozeal/1GB......

Therefore, the partition name is /dev/sdb1, the drive is mount on /run/media/technozeal/1GB.

You can also use other command such as findfs LABEL='<label>' if you know the label.
findfs LABEL='1GB'

Alternatively, you can check the log file using the command less /var/log/messages, however I find this method too cumbersome.

Important: It is very important that you must find the correct partition name for the USB drive. Please note that your USB partition name is not always sdb1. If you plug in the USB into another system, it may be named as sdc1. Writing to the wrong partition will have disastrous consequences. Not only you could erase your data, you might cause the system to be unusable if you write the image to the wrong partition. Check and double check. If you plug the same USB drive into another system, check the partition again. Inserting a CD or turning on external hard disk will also change the partition name.

Method 1: Using liveusb-creator
My first attempt on using the liveusb-creator was not successful. However, after I've create the bootable drive using the livecd-tools. My second attempt was successful. My advice is to create bootable USB drive using this method, if it fails try the second method. Please note that this method can only use to create LiveCD, other images such as Fedora DVD does not work here.

To install liveusb-creator, use the command:
yum install -y liveusb-creator

Then, you need to launch the program from Applications.

After you have choose the target device, you can choose to use the iso image from your folder or you can download a new one. Once you've made the options just click Create Live USB.

Note: Make sure you have the correct target. Writing to the wrong target will have detrimental consequences. Check and re-check again.

Method 2: Using livecd-tools
This method works on all iso images including Fedora DVD. To install livecd-tools use the command:
yum install -y livecd-tools

Please make sure that you got the partition right. One useful way is to list the files in the partition to make sure you got the right partition. Use the command:
ls -al /run/media/technozeal/1GB

Finally, use the command to create bootable USB drive.
su -c 'livecd-iso-to-disk /path/image.iso /dev/<sdX1>'

You need to know the location of the ISO image and the partition name. You need to substitue the complete path of image.iso and the partiton of your USB. Make sure you have the correct target partition name. Writing to the wrong target will have detrimental consequences. Check and re-check again.

For my example the command is as follows:

su - c 'livecd-iso-to-disk ~/Downloads/Fedora-Live-Desktop-x86_64-19-1.iso /dev/sdb1'

Method 3: Using command dd
The software for the command dd was already installed. Please use this method when the first two methods are not working or if you are using other variant of Linux distros or if you are using Mac OS.

Plug in your USB and find where the USB is mounted on. Issue the command mount to find out the partition of your USB drive.

Use the command:
su -
dd if=<path_iso_image> of=<device_name>

Note: You need to enter the complete path of the iso image. Device name is the same as partition name without the partition number. Therefore, the device name of sdb1 is sdb. Make sure you have the correct device name. Writing to the wrong target will have detrimental consequences. Check and re-check again.

My example:
su -
dd if=~/Downloads/Fedora-Live-Desktop-x86_64-19-1.iso of=/dev/sdb

Note for Mac Users
To use dd you must unmount the USB drive using the command diskutils umount. I've tried the dd command using sudo, the system hangs. Alternatively, you might need to enable root user and use su instead of sudo. As I am not willing to mess up the Mac by enabling root, I did not test the part. For Mac users, let me know your test results in the comment.

After the USB is created, it is advisable to test the USB by booting it.



  1. You don't need to "enable root" to be able to have root shell. You can simply do:
    sudo -i
    sudo su -

    1. Thanks for the tip. However, I've tried sudo su - and it doesn't work for me. I've not tried sudo -i. Perhaps readers should follows Arif's tip. If it doesn't work revert to my suggestion.


Note: Only a member of this blog may post a comment.