Creating a live Fedora USB image from the command line





Last Updated on 09/04/2023 by dboth

Creating a live Fedora image from the command line can be fairly straightforward. There are two methods that I have used for creating Live USB images.

livecd-iso-to-disk

The advantages of this method is that it supports non-destructive Live USB creation so that the current contents of the USB are not destroyed, and data persistence so that you can store data on the USB device from your activities while running the Live image.

First verify that the livecd-iso-to-disk program is installed. You may need to install the livecd-tools package if it is not.

Assume that your USB memory thumb drive is brand new and has never been used. Also assume that your live ISO image file is named Fedora20-Live-X64-KDE.iso. Insert the USB drive and use the dmesg command to determine which device your system sees the USB drive at. The output from the dmesg command will look similar to the following:

[174156.598656] usb 3-4.3.1.3: new high-speed USB device number 34 using xhci_hcd
[174156.618484] usb 3-4.3.1.3: New USB device found, idVendor=058f, idProduct=6387
[174156.618487] usb 3-4.3.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[174156.618489] usb 3-4.3.1.3: Product: Mass Storage
[174156.618490] usb 3-4.3.1.3: Manufacturer: Generic
[174156.618492] usb 3-4.3.1.3: SerialNumber: F24CDC58
[174156.618828] usb-storage 3-4.3.1.3:1.0: USB Mass Storage device detected
[174156.618977] scsi24 : usb-storage 3-4.3.1.3:1.0
[174157.622885] scsi 24:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 4
[174157.623102] sd 24:0:0:0: Attached scsi generic sg10 type 0
[174157.623798] sd 24:0:0:0: [sdh] 7884800 512-byte logical blocks: (4.03 GB/3.75 GiB)
[174157.624458] sd 24:0:0:0: [sdh] Write Protect is off
[174157.624461] sd 24:0:0:0: [sdh] Mode Sense: 23 00 00 00
[174157.625130] sd 24:0:0:0: [sdh] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[174157.628636] sdh: sdh1
[174157.630612] sd 24:0:0:0: [sdh] Attached SCSI removable disk

For this example assume that USB device is identified as /dev/sdh as shown above. Use the following command to install the ISO image onto the USB device and make it bootable.

livecd-iso-to-disk --format --reset-mbr Fedora20-Live-X64-KDE.iso /dev/sdh

It may take several minutes to complete the process, so be patient.

The dd method

I prefer the dd method because I do not run Live images to do productive work, only to perform installations. dd stands for “dusk dump” although many sysadmins refer to it as the “disk destroyer” because it can destroy all the data on a storage device.

Using the same drive and image information as in the example above, the following command creates a Live image. It works on any USB thumb drive and can be used to rewrite USB drives that already have a Live image on them.

dd if=Fedora20-Live-X64-KDE.iso of=/dev/sdh

This simple command takes the in file (if) and writes it to the out file (of). It writes until there is no more data to transfer. Note that you are not writing the image to a partition on the USB drive, but to the drive itself as a device.

Remember that to Linux Everything is a file.

Resources

Fedora Project: How to create and use a Live USB