You are on page 1of 8

Search Text Titles

How to Set Up a USB Key to Install

CentOS

Starting with CentOS 6.5 and 7.0 the


preferred way to create a USB stick to
install from is by using dd (example
below).

Some of the Alternatives at the bottom


are preferred by other users, and are
demonstrated to work with CentOS-6.

The procedures below have been tested by various users, but may
not cover all eventualities. There is a formal CentOS project
recommended approach and that is to use dd.

Motivation

Many recent systems, particularly netbooks and small notebooks,


may not have a CD or DVD drive and a network install may be
difficult, impractical, or impossible, depending on network
connectivity and installer support for the available network
hardware. This procedure allows a CentOS install without network
connectivity and with no media other than a bootable USB device
and the target system disk.
CentOS release 6 (newer than 6.5) and CentOS 7

Starting with CentOS 6.5, one can install


from USB keys by simply transferring the
desired ISO using dd.

For example, assuming your USB stick is seen as /dev/sdb (please


double check what yours is, do not blindly assume /dev/sdb as you
may overwrite something irretrievably):

dd if=CentOS-6.5-x86_64-bin-DVD1.iso of=/dev/sdb

You must write to the entire device and not a partition on it (so,
/dev/sdb not /dev/sdb1)

When asked for the media to install from, select "hard disk" and then
the device corresponding to the USB key.

Make sure you select as destination the


device corresponding to the USB key
(/dev/sdb in the above example) and not a
partition (such as /dev/sdb1)

Exactly the same method works for CentOS 7. Moreover, the CentOS
7 installer image has a special partitioning which, as of July 2014,
most Windows tools do NOT transfer correctly leading to undefined
behaviour when booting from the USB key. Applications known (so
far) to NOT work are unetbootin, multibootusb and "universal usb
installler" - do NOT use these. Confirmed as functioning correctly are
Rufus (may depend on options selected, there have been reports
of failure with rufus too), Fedora LiveUSB Creator, Win32 Disk
Imager, Rawrite32 and dd for Windows. If using a version of
Windows newer than 7, make sure you unmount the USB drive first
(formatting it prior to launching the disk copier is one way to
accomplish that), otherwise Windows might refuse to write on the
stick, bailing out with the "can't write to drive" error message.

If using dd for Windows, run dd --list and look carefully at the list of
NT Block Device Objects and use the one that looks like \\?
\Device\Harddisk1\Partition0 where the description is something like
Removable media other than floppy. Block size = 512. Be very careful
about which output device you pick or you may overwrite something
you did not intend to! On my machine I ran dd if=CentOS-7.0-1406-
DVD.iso of=\\?\Device\Harddisk1\Partition0 - your device names
and command may vary accordingly!

Previous versions of CentOS 6

Beware that only the very latest CentOS


releases are supported. We strongly advise
you to not install anything but the latest
minor release. Therefore the following
methods should no longer be attempted
unless you have a very very good reason to
install an old and unsupported release.

An end user recommends the following approach for CentOS-6, using


livecd-iso-to-disk from livecd-tools with DVD1. This has been tested
with livecd-tools-13.4-1.el6 from EPEL. Thanks to forum user
AndrewSerk for the recommendation in a forum post. See also
the notation of a need for installation of qemu in this mailing list
post.

Older Method

This method has been reported as still viable for CentOS 6.4

Building a distribution on a USB key as of CentOS 6.2 - thanks to


Mark Roth for the CentOS-6 procedure, and to Yves Bellefeuille on
the CentOS-Docs list for several additions and corrections.

Recommended: An 8GB or larger USB key.


1. Partition the USB key into two partitions: the first, FAT32, and
about 250M; the second, the rest of the drive, and ext3. (An
ext3 partition is required because the ISO file, that will later
be copied to it, is larger than the maximum file size for a
FAT32 or VFAT partition.)
2. Mount DVD1, if it isn't automounted (on /media, or /mnt). The
following assumes /mnt/USB and /mnt/DVD.
3. Mount the USB key on /mnt/USB/.

4. Copy the directory and contents of /mnt/DVD/isolinux to

/mnt/USB/.

5. Rename /mnt/USB/isolinux to /mnt/USB/syslinux

6. Rename /mnt/USB/syslinux/isolinux.cfg to

/mnt/USB/syslinux/syslinux.cfg

7. Copy the directory and contents of /mnt/DVD/images to

/mnt/USB/. (A bug has been filed [ToDo - add link] because as

of 11 Jan 2012, the install requires the .iso (see below), but

linux rescue requires the contents of images to load and run.)

8. Assuming that the USB key is /dev/sdb


syslinux /dev/sdb1

9. Unmount the first USB partition, and mount the second


umount /mnt/USB
mount /dev/sdb2 /mnt/USB

10. Copy the .iso file to /mnt/USB. Do not use the LiveCD or

LiveDVD. Use DVD1, the minimal CD ISO, or a combined

DVD1/DVD2 created following CD to DVD Media. Do not copy

the contents - the install now wants the .iso file itself, which it

mounts during installation, and follow the upstream

Installation_Guide to create an images directory on the

same partition. Optionally, add DVD2 if you used DVD1, and

need it for the install.


11. Optional: On /mnt/USB, create a grub.conf. This may be

required if your system wants the USB key as the first drive, so

that you can later copy it to the hard disk. See

HowTos/GrubInstallation section 2 for guidance.

12. Umount the USB key, and it's ready to use.


13. Boot from the USB media by setting it as the first BIOS boot
device, or on some BIOSs by hitting a key such as F12 to select
a boot device after POST.

14. During the installation process, the user is asked "What type of

media contains the installation image?" Select the first

partition on the USB key, which should appear in the menu

under "Hard drive", then /dev/sda1 or whatever device

corresponds to the first USB partition.

15. After partitioning, the user is asked whether to install the


Grub boot loader and where to install it. After booting from
the USB key, the BIOS may think that the USB key is the first
drive. If the USB is seen as the first device, then to install the
Grub boot loader on the hard drive MBR, which is the usual
case, the user must change the order of the hard drives using
the Grub advanced installation options.

16. After the Grub installation options, the following error

message may appear: "Missing ISO 9660 image: The installer

has tried to mount image #1, but cannot find it on the hard

drive". The installation program is looking for the ISO file on

the first partition of the USB key, but it's on the second

partition. Go to a terminal with a shell with Ctrl-Alt-F2,

unmount the first partition of the USB

umount /mnt/isodir
mount the second partition on the USB device. This will be the
same device used in #14 above - for example
mount -t ext3 /dev/sda2 /mnt/isodir

Return to the installation program (Ctrl-Alt-F6) and choose


"Retry".

17. Finish the installation and reboot without the USB device

connected. If there are problems booting then it is likely the

boot record was written to the wrong device. See How to re-

install bootstrap code (GRUB), and if having difficulties

determining the correct device, Troubleshooting GRUB Issues.

Alternatives

These alternative methods are listed as a


historical convenience. They mostly apply
only to CentOS 6 and should not be used
for CentOS 7. The best way to copy a
CentOS ISO image to a USB stick is using
dd.

UNetbootin is probably the most popular "outside" method, has


both Windows and Linux executables, and allows you to create
bootable Live USB drives for a variety of Linux distributions. This
utility is no longer recommended for use as it fails to work with
newer CentOS iso images. There was an anaconda bug that could
render the media unusable - now closed for Fedora 13 and
presumably thus RHEL/CentOS-6. It has been reported on the fora
to work with at least the netinstall ISO for CentOS-6. When using the
netinstall ISO the full installation media ISO can be copied to the root
directory of the USB media and a "Hard Drive" install performed.

Marcus Moeller recommends:


Much better is livecd-iso-to-disk which can be obtained from git:

https://git.fedorahosted.org/cgit/livecd/plain/tools/livecd-iso-to-
disk.sh
Just download it, chmod +x and run:

./livecd-iso-to-disk.sh /path/to/iso /dev/partition_of_your_usb_stick

You could also add an option like:


--overlay-size-mb 1024

to add some persistent space to the key.

The resulting key could directly be used for installations, without the
need of placing the iso manually on the key.

Forum user Al_Stu recommends this procedure.

Yet another procedure for Building an install disk on a USB

key.

An alternative approach if no network is available is to boot

from diskboot.img on a USB key as documented in the

Installation Guide and do a hard disk install with ISO

images on the target computer.

Forum user ixeous describes use of GRUB2 to create a

bootable USB for a variety of uses.

Not an endorsement, but OSDisc.com sells various bootable

USB media with CentOS at seemingly reasonable prices. A

report on the Fora would be appreciated if anyone tries

these.
Using Windows

First of all, take into account that the instructions for modern
CentOS versions ( CentOS 6 > 6.5, CentOS 7 ) are at the top of this
page.

Starting with CentOS 6.5, one can create a bootable USB key simply
by installing the ISO file on the key using a program such as
Win32 Disk Imager. This will delete all information already on the
key.

Forum user ron_l_j recommends a Windows tool

iso2usb.

A CentOS ML member recommends Pendrivelinux.com.

This page was created by PhilSchaffner. Other Wiki

contributors with edit rights are invited to make corrections

or additions.

HowTos/InstallFromUSBkey (last edited 2017-05-19 15:24:18 by TrevorHemsley)

You might also like