Coding is one of the highest art forms achieved by mankind; an idea - just an electrical impulse - is made real in an alternate electronic universe; the created idea however, does not have physical form, and yet can change the physical world; it cannot be touched, and yet may touch all mankind.
How to make a bootable linux USB 'disk'
There are several ways to do this. The method shown here is the simplest one I've ever seen.
At the heart of this process is this command:
livecd-iso-to-disk --format --reset-mbr /path_to/Live_DVD.iso /dev/sdX
This tells the program livecd-iso-to-disk to create a bootable file system using a downloaded ISO file on the USB device /dev/sdX.
1 Download a live CD or DVD image of the Linux distribution you prefer. In this example I'm using Fedora 17, x86_64 architecture. You can get a suitable ISO file from here.
2 Next you'll need to install the package livecd-tools. If you try to do this when you're not root you'll get this error:
bash-4.2$ yum install livecd-tools Loaded plugins: langpacks, presto, refresh-packagekit You need to be root to perform this command.
Switch user to root and re-issue the command.
bash-4.2$ su - Password: [root@cobh ~]# yum install livecd-tools
3 Now change directory to where you saved the downloaded ISO image file, and use ls to get the full name of the downloaded file.
[root@cobh ~]# cd /home/username/Downloads [root@cobh Downloads]# ls -l total 660484 -rw-r--r-- 1 username domainusers 676331520 Oct 11 09:41 Fedora-17-x86_64-Live-Desktop.iso
4 Now find out the name of your USB device. Plug it in, wait a moment and then use df to identify your device name.
[root@cobh Downloads]# df -h Filesystem Size Used Avail Use% Mounted on rootfs 32G 9.1G 21G 31% / /dev/sda3 497M 90M 383M 20% /boot //server/public 805G 556G 249G 70% /home/username/Public //server/users/username 805G 556G 249G 70% /home/username/Documents /dev/sdb1 1.9G 706M 1.1G 40% /media/LIVE
How do I know my device is /dev/sdb? Because a moment earlier — before I put in the USB disk — /dev/sdb wasn't on this list when I used df.
5 Now double check, using fdisk that you've got the right device. You're about to overwrite the device and you don't want to kill your hard drive by accident!
[root@cobh Downloads]# fdisk /dev/sdb Command (m for help): p Disk /dev/sdb: 2002 MB, 2002747392 bytes 32 heads, 63 sectors/track, 1940 cylinders, total 3911616 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x21260744 Device Boot Start End Blocks Id System /dev/sdb1 63 3911039 1955488+ 6 FAT16 Command (m for help): q
I know this is the right device because the size matches what's printed on the USB stick (2G =~ 2002MB) — and nothing else does. Now that I've double-checked, I can continue.
6 unmount any partitions on the device which are mounted.
[root@cobh Downloads]# umount /dev/sdb1
7 Now issue the command:
[root@cobh Downloads]# livecd-iso-to-disk --format --reset-mbr Fedora-17-x86_64-Live-Desktop.iso /dev/sdb
Which causes this to happen:
Verifying image... /home/fachtna/Downloads/Fedora-17-x86_64-Live-Desktop.iso: 8f867005fc8d23b3a9f0d3918d7ad825 Fragment sums: 937bd8e8d79fa61fdebca46ed56bb7f295116544a578b8c2c6c35f51cb9e Fragment count: 20 Press [Esc] to abort check. Checking: 100.0% The media check is complete, the result is: PASS. It is OK to use this media. WARNING: THIS WILL DESTROY ANY DATA ON /dev/sdb!!! Press Enter to continue or ctrl-c to abort
After taking a moment to check that I have the right device (in my example /dev/sdb - yours might be different) I press Enter as requested, then sit back and watch while all this goes on:
wipefs: WARNING: /dev/sdb: appears to contain 'dos' partition table Waiting for devices to settle... mke2fs 1.41.14 (22-Dec-2010) Filesystem label=LIVE OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 122160 inodes, 488192 blocks 24409 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=503316480 15 block groups 32768 blocks per group, 32768 fragments per group 8144 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. Copying live image to target device. squashfs.img 655540224 100% 11.90MB/s 0:00:52 (xfer#1, to-check=0/1) sent 655620321 bytes received 31 bytes 12254586.02 bytes/sec total size is 655540224 speedup is 1.00 osmin.img 8192 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/1) sent 8265 bytes received 31 bytes 16592.00 bytes/sec total size is 8192 speedup is 0.99 Updating boot config file Installing boot loader /media/tgttmp.AxZocV/syslinux is device /dev/sdb1 Target device is now set up with a Live image! [root@cobh Downloads]#
8 Now that I have a bootable USB device, I can reboot another computer, change the BIOS to boot from USB and run the live DVD without needing to modify the hard drive.
Last updated: 20150326-09:41