Copying ISO Images To USB

From NST Wiki
Revision as of 07:43, 7 October 2017 by Rwh (talk | contribs) (Using dd - Linux System)
Jump to navigationJump to search

The NST distribution is based off of Fedora. Because of this you can use a variety of methods to install the NST ISO image onto USB media (memory sticks, SD cards, etc).

The following sections provide a quick reference for some common methods for transferring the ISO image to a USB flash drive. What is described below is just the tip of the iceberg. For full details, refer to the man pages for the various utilities used and visit the "How to create and use Live USB" page on the Fedora wiki.

Using liveusb-creator

If you are more comfortable with graphical applications, you can use the liveusb-creator tool. Look for the Fedora LiveUSB Creator launcher icon under system tools. This tool offers a subset of the features provided by the livecd-iso-to-disk command line utility, but is recommended for beginners (or people that don't have time to read and can live with limitations).

There is a version of liveusb-creator available that runs under Windows.

For more details on using the liveusb-creator tool, refer to Fedora's excellent write up: "How to create and use Live USB" .

Using livecd-iso-to-disk

The livecd-iso-to-disk command line utility provides a lot more options than the simplified liveusb-creator tool. The livecd-iso-to-disk utility can be installed on a NST (or any Fedora based system) by running the following command:

sudo rpm -q livecd-tools || sudo yum install livecd-tools

Once installed, you can run use the livecd-iso-to-disk utility in the following manner (there are a lot more options available and you are encouraged to read the man page).

 sudo livecd-iso-to-disk --noverify nst-20-5102.i686.iso /dev/sdx1

NOTE: You will need to substitute the name of the ISO file to use (nst-20-5102.i686.iso) and the USB disk partition to install to (/dev/sdx1) according to your situation.

The following example formats the USB drive and enables EFI/UEFI booting of your USB drive with a 64 bit version of the NST ISO image (for newer Intel hardware and Macs).

 sudo livecd-iso-to-disk --format --efi --noverify nst-20-6480.x86_64.iso /dev/sdx1

If you booted from a DVD ISO image, it is possible to create USB media using from the DVD you have booted from. Substitute /run/initramfs/livedev for the name of the ISO file to use (you may also need to include the --noverify option as we aren't sure verification works when reading from raw devices). Here is an example:

sudo livecd-iso-to-disk --noverify /run/initramfs/livedev /dev/sdx1

You will need to change /dev/sdx1 shown above to the partition of your USB flash drive you want initialized. Add the --format and --reset-mbr options if you need to clear/initialize your USB flash drive to a good working state.

For more details on using the livecd-iso-to-disk tool, refer to Fedora's excellent write up: "How to create and use Live USB" .

Directly Copying ISO Image To USB

One of the simplest methods to convert a ISO image to bootable USB is to directly copy the image to the USB media. The dd command can be used for this purpose on Linux and Mac based systems.

Here are some things to be aware of when using the dd method:

  • The entire USB flash drive is used. Hence, if you use a 16GB flash drive, you won't be able to store information on any of the remaining disk space.
  • The systems which you want to boot from need to support booting from USB ISO images in addition to or instead of booting from USB FAT images. This may lead to better or worse compatibility.
  • You will not have access to all of the fancy features available when using the Live USB tools (separate writable home partition, overlay, etc).

Using dd - Linux System

The following demonstrates how to use dd on a Linux system to copy the contents of the ISO image to a 8GB USB flash drive ("/dev/sdc") from the command line. An 8GB Block Size ("BS") was used for file transfer optimization. Make sure the USB flash drive is not mounted prior to performing the copy. The cmp utility is used after the copy for verification.

Note: Alternatively, one could use the dcfldd (Defence Computer Forensics Lab) utility for copying the image to the USB drive. This utility provides console output progress information during the copy operation. The "statusinterval" option is used to specify the update period in "N blocks" transferred.
[root@shopper2 Downloads]# ls -al ./nst-20-5102.x86_64.iso 
-rw-r--r-- 1 root root 2002780160 Dec  2 06:21 ./nst-20-5102.x86_64.iso
[root@shopper2 Downloads]#
[root@shopper2 Downloads]# lsscsi -s
[0:0:0:0]    disk    ATA      OCZ-VERTEX3      2.25  /dev/sda    120GB
[1:0:0:0]    disk    ATA      SanDisk SDSSDX24 R211  /dev/sdb    240GB
[12:0:0:0]   disk    SanDisk  Cruzer           1.01  /dev/sdc   8.00GB
[root@shopper2 Downloads]#
[root@shopper2 Downloads]# dd if=./nst-20-5102.x86_64.iso of=/dev/sdc bs=8M
238+1 records in
238+1 records out
2002780160 bytes (2.0 GB) copied, 519.832 s, 3.9 MB/s
[root@shopper2 Downloads]#
[root@shopper2 Downloads]# cmp -l ./nst-20-5102.x86_64.iso /dev/sdc
cmp: EOF on ./nst-20-5102.x86_64.iso
[root@shopper2 Downloads]#

Using dd - Mac System

It is also possible to use the dd command to copy the contents of the ISO image to a USB flash drive having a capacity of 2GB (or more). The following demonstrates how to do this from the command line on a Mac. The diskutil utility was used prior to invoking the dd command determine the device entry for the USB flash drive and to unmount any active partitions.

taco-e:tlp pkb$ diskutil list
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *512.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            511.8 GB   disk0s2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *750.2 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS TIMEMAC                 749.8 GB   disk1s2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.0 GB     disk3
   1:             Windows_FAT_32 tldboot                 128.0 MB   disk3s1
   2:                      Linux                         7.9 GB     disk3s2
taco-e:tlp pkb$ diskutil unmountDisk /dev/disk3
Unmount of all volumes on disk3 was successful
taco-e:tlp pkb$ sudo dd if=/Volumes/public/vm/iso/nst-20-5102.i686.iso of=/dev/disk3 bs=$((8*1024*1024))
220+1 records in
220+1 records out
1847590912 bytes transferred in 2957.797273 secs (624651 bytes/sec)
taco-e:tlp pkb$ diskutil eject /dev/disk3
Disk /dev/disk3 ejected
taco-e:tlp pkb$

Direct Write For Windows Systems

If you are on a Windows based system, you will not have access to the dd command. However, there are other methods which allow you to directly write ISO images to USB media. Detailed instructions can be found at Fedora's excellent: "How to create and use Live USB" page.