How To Install An OS Off Of A Flash Drive

lucasbytegenius

Well-Known Member
How To Install An OS Off Of A Flash Drive
By lucasbytegenius
After a lot of experimentation, disastrous mistakes, slow download speeds and finally, success, I have written this guide to educate the common user, DIY, and IT in installing Microsoft Windows, Mac OS X, and many major Linux distributions from a USB flash drive. Please note that all techniques described in this guide do have risks, most of the time due to human mistake. We do not claim any liability for these mistakes unless they can be proved to be directly due to this guide, and a kind PM sent to the author will help improve this guide if the user does come across any mistakes on my part.

Installing Windows:
EDIT: Microsoft has released a utility for Windows 7 and Windows 8 which will make this much easier. However, the steps outlined here require only the command line and the Windows DVD. You download this utility at http://www.microsoftstore.com/store/msusa/html/pbPage.Help_Win7_usbdvd_dwnTool

This section will describe how to make a bootable flash drive for use of installing Windows. Support in this guide includes Windows Vista and Windows 7, basically all Windows NT 6.x systems are supported. Regrettably, Windows NT 5.x systems (Windows XP, etc) are yet to be added, due to some software complications that have yet to be sorted out.
What you need is:
  • An empty 2 GB USB 2.0 or 3.0 compliant flash drive.
  • A USB 2.0 or 3.0 compliant USB port, this will include most computers manufactured in the last 5-6 years.
  • A Windows Vista, Windows 7, or other Windows NT 6.x family OS install disc. It can be either x86 or x64.
  • A computer with Windows Vista or above installed.
Ok, now that you’ve ascertained that you have all the requirements, let’s get started.
First, open an elevated command prompt by typing cmd into the search box and pressing enter, and then hit Ctrl + Shift + Enter.
Type the following commands, pressing enter after each one:
Code:
DISKPART
LIST DISK
In the list, you will see a list of disks, each with a number. The disk whose size corresponds to the size of your flash drive should be your flash drive. It is very important that you select the right one, as data could be lost. Remember the number next to your flash drive.
Now, type the following commands (pressing enter after each one):
Code:
SELECT DISK x (replace x with the flash drive number you memorized earlier)
CLEAN
CREATE PARTITION PRIMARY
SELECT PARTITION 1
ACTIVE
FORMAT FS=NTFS QUICK
ASSIGN
EXIT
Don’t close the prompt window.
Place your Windows DVD into your DVD drive, and remember the drive letter of the DVD drive and your flash drive. Then go back to the prompt and type the following commands, pressing enter after each one:
Code:
X: CD BOOT (where x is your DVD drive)
CD BOOT
BOOTSECT.EXE /NT60 Y: (where y is your flash drive letter)
Then copy the entire contents of your Windows DVD to your flash drive, and restart. It should boot.
For those familiar with the bootsect command, the nt52 switch has not proven successful for me while trying to get XP on the flash drive, before you ask. If you have a way to put the Windows XP installation files on a flash drive and make it bootable, please let me know.

Installing Mac OS X:
This section will describe how to make a bootable flash drive for use of installing Mac OS X. Support in this guide includes all versions of Mac OS X.
What you need is:
  • An empty 5-8 GB USB 2.0 or 3.0 compliant flash drive
  • A USB 2.0 or 3.0 compliant USB port, this will include most Macs manufactured in the last 5-6 years.
  • A Mac OS X 10.x.x install disc.
  • A Mac running OS X.
Ok, now that you've ascertained that you have all the requirements, let's get started.
First, open the Utilities folder by pressing Shift + Command + U, and open Disk Utility.

Picture%203.png


Insert your Mac OS X Install disc. Select it in the list in the Disk Utility, and click Restore.
Drag the Mac OS X Install disc from the list to the Source box.
Then plug in your USB drive, and drag it from the list to the Destination box.

Picture%201.png


Check the Erase Destination box and click Restore. After a few minutes, you will have a bootable USB drive with Mac OS X on it.
To test your drive, open System Preferences>Startup Disk, enter your administrator’s password if necessary, and then select the disk you restored to with Disk Utility, and then click Restart. You can also hold down the Option key after the startup chime, and select the disk.

Installing Linux:
This section will describe how to make a bootable flash drive for use of installing some Linux distributions. Support in this guide includes the Ubuntu family, version 10.10 and lower, with experiments performed on 10.04 and 9.10, and a few other distributions I have not experimented with but should work.
What you need is:
  • An empty 1-8 GB USB 2.0 or 3.0 compliant flash drive.
  • A USB 2.0 or 3.0 compliant USB port, this will include most computers manufactured in the last 5-6 years.
  • A distribution’s ISO image or disc.
  • A computer with preferably Ubuntu 10.10 or Windows XP, Vista, or 7 (yes Windows ;))
The following files/utilities:
The Unetbootin and Pendrive Linux interface is pretty intuitive, I doubt it's necessary to write instructions on how to use them.
Also, you can put Ubuntu on a flash drive through Ubuntu by navigating System>Preferences>Startup Disk Creator and going from there.

Conclusion:
If you followed this short guide correctly, you should now have a USB drive containing the Windows, MacOS X, or Linux setup files. Congratulations!
Notes on Future Improvement:
If you (the reader) think it necessary to include more documentation on the Linux utilities, Unetbootin and Pendrive Linux, please comment.
If any more screenshots are needed, I'll be happy to provide them.
As for advanced configuration of the setup files before copying them to the USB drive, I'm still having a little trouble with that and may just go and write a whole new guide on how to patch the setup files when I'm done with my research.

Written originally for EnigmaBoard.
 
Last edited:

tremmor

Well-Known Member
One thing is a lot do not know how to search and find it.
I will 99% of the time if i need it. Great effort like many who explain.
No doubt it takes time and have everything in order and sequence.
thanks.
 

jamesd1981

Active Member
nice guide lucas, well layed out and clear, good of you to take the time and effort to do such a pro guide. :)
 

bkribbs

New Member
I don't need to use it atm, but I probably will actually refer to it for whenever I get around to making my install cd's into FD's. But looks good!
 

tlarkin

VIP Member
Another way is to boot from the Installer DVD of the OS and choose the USB/FW drive if the installer supports it. Most Linux distros and OS X support this method. Windows I am not entirely sure of. Also, on a PC you must make sure your BIOS supports USB booting, but most modern motherboards support such features.

Otherwise, the guide looks good to me.
 

lucasbytegenius

Well-Known Member
Another way is to boot from the Installer DVD of the OS and choose the USB/FW drive if the installer supports it. Most Linux distros and OS X support this method. Windows I am not entirely sure of. Also, on a PC you must make sure your BIOS supports USB booting, but most modern motherboards support such features.

Otherwise, the guide looks good to me.
Thanks, tlarkin. I'm considering adding a note on how to use the PloP Linux CD on older machines to boot, if you think it's really worth it.
 

pane-free

Member
Any other suggestions, opinions, or results?

One could use the dd command, as in this example from CrunchBang forum:

http://crunchbanglinux.org/wiki/statler_usb_installation

HOWTO copy a CrunchBang 10 Statler ISO image to USB in Linux

:!: WARNING, the following instructions will destroy any existing data on your USB stick.

1. Insert your USB stick and learn how your USB stick is recognized by the system, enter the command:

sudo ls -l /dev/disk/by-id/*usb*

This should produce output along the lines of:

lrwxrwxrwx 1 root root 9 2010-03-15 22:54 /dev/disk/by-id/usb-_USB_DISK_2.0_077508380189-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 2010-03-15 22:54 /dev/disk/by-id/usb-_USB_DISK_2.0_077508380189-0:0-part1 -> ../../sdb1

2. Unmount the usb stick, then use this command to write (as root) the image iso to your USB stick.
:!: Replace /dev/sdX with the actual hard disk device learned from the command above. In this example /dev/sdb NOT /dev/sdb1
:!: Replace the name of the iso image below by the actual name of the iso image you downloaded.

sudo dd if=/path/to/iso/crunchbang-10-20101205-openbox-i686.iso of=/dev/sdX bs=4M;sync

All being well, you should now have a bootable CrunchBang Statler USB stick.

aptosid manual gives similar instructions: http://manual.aptosid.com/en/hd-ins-opts-oos-en.htm#raw-usb

There is also a procedure using cfdisk, i just cannot remember it offhand.
EDIT: here it what I was thinking of, compiled --

##########################################################################

COMPLEX METHOD (USB stick corrupted/need to make it recognizable again/desire a bootable distro installed on a USB stick previously formatted to NTFS)

1. Download your chosen distro ISO file, noting the path (/home/username/Downloads/)

2. Physically uninstall/unplug all other USB devices from the computer and do not use a USB hub.

3. Insert your USB stick and learn how your USB stick is recognized by the system (as #2 above)

4.
PHP:
sudo umount /dev/sdX

5.
PHP:
dd if=/dev/zero of=/dev/sdX bs=512 conv=notrunc,sync
NOTE: this will both wipe your entire USB drive with zeros, destroy all existing data
and TAKE A WHILE!

6. Partitioning and Formatting your USB Drive with cfdisk as a single partition using FAT32
NOTE: Please refer to http://manual.aptosid.com/en/part-cfdisk-en.htm

PHP:
cfdisk /dev/sdX

A. Delete all existing partitions using arrow keys to highlight each --

"d" or "Delete" <Enter>

B. Create a new partition

"n" or "New" <Enter> choose "Primary Partition" NOTE: "Units" (MB)-- entire USB drive <Enter>
"t" or "Type" <Enter> choose "0B" (FAT32) <Enter>
"b" or "Boot" <Enter> NOTE: toggle until "Boot" flag remains visible
"W" or "Write" <Enter> NOTE: if you don't do this you'll have to start over!
"q" or "Quit" <Enter>

Your newly partitioned USB stick is now recognized as sdX (usually sdb)
and your new partition on the stick is now recognized as sdX1 (usually sdb1)

C. Still at the joyous prompt, Format the newly partitioned USB drive!

PHP:
fdisk /dev/sdX

PHP:
mkfs -t vfat /dev/sdX1

7. Now, perform #3 and #4 of the SIMPLE METHOD, and you are done!


##########################################################################
SOURCES (for all; Copyleft applies):
http://www.pane-free.com (compilation synthesized by chamaecyparis)
http://manual.aptosid.com/en/part-cfdisk-en.htm
http://crunchbanglinux.org/wiki/statler_usb_installation
 
Last edited:

tlarkin

VIP Member
Well, in OS X you can block copy images with the asr command, which is what disk utility uses under the hood.

Code:
/usr/sbin/asr restore --source "/Volumes/pathto/usb/imagefile.dmg" -target /dev/disk0s2 -erase -noprompt -timeout 0 -puppetstrings -noverify --verbose

That is of course your standard set up that your main OS partition is in fact on disk0, you could compile this into a script to make it detect your main drive first and then block copy your disk image of your OS over to your destination.
 

lucasbytegenius

Well-Known Member
@ lucasbytegenius
Yes you can use win to flash program to make bootable usb, without cmd.
It is a lot easier.
Also can you take a look here, I have a big problem whit booting from usb and maybe you could help me.
Link http://www.computerforum.com/190236-window-7-wont-boot-usb.html

Originally, my guide was based off of WinToFlash, but it didn't work too well (can't find my old guide-it's somewhere on this forum;)) so I figured out how to do it with the command line. WTF is in beta still, when they release it it should have all its bugs cleared up and then I'll consider a rewrite.

@tlarkin: When I rewrite my guide, I'll be sure to include your tip :)
@pane-free: Thanks, I'll also add that too :)
 

lucasbytegenius

Well-Known Member
Here's an alternative way on how to install windows 7 using a flash drive. http://gadgetmix.com/netbook/how-to-install-windows-7-via-usbflash-drive/

Thanks, but the technique I use requires less external software and I have used it with far more success than that one. I experimented with that technique a month or two back and it was troublesome, as it could be tricky with the mbr on the drive. Eventually I settled with the current technique, as it was much simpler than the exaggerated list of steps I would have to put in to troubleshoot your link.
 

leosar

New Member
installing win vista?

hi
excuse me to post this question.
i have hp laptop with vista
i tried to restore it to earlier date,and while it was restoring we lost electricity,(batterie is dead)
my cd-rom is not working
so can i put win vista on usb key 4gb and format my laptop ?
and how should i do this?
 
Top