Four Vista/Windows-7 installation DVDs in one flash drive
How to Transfer 4 versions of Vista and Windows-7 installation DVDs into a flash drive
Edited 18/6/10 --- I have discovered a method to put the installation DVDs and boot each one from a logical partition. This remove the limitation of 4 installation DVD. You can have as many as you want limited by only the flash drive capacity. More details shown in Post #5
The recent versions of MS Windows of Vista and Windows 7 installers support booting from a USB device so it is possible to transfer the contents of the installation DVD to a flash drive and use it for booting.
A USB flash drive however is classified by M$ as a “Super floppy” that can only have one partition. This means one flash drive can store one MS Windows boot loader.
This tutorial shows how to use Grub, a Linux boot loader, to boot 4 Vista/Windows 7 installation in one flash drive.
(1) I have checked to my satisfaction that none of the MS Windows of Win2k, Xp, Vista and Win7 can mount or see more than one partition in a flash drive. That doesn't mean the user can't have multiple partitions. It is just MS systems have been engineered to mount the first one it recognises and disregards the rest.
(2) MS Windows installers of Vista and Win7 do not like to be booted from a logical partition. As a flash drive with a Msdos partition table can have a maximum 4 primary partitions hence this tutorial describes 4 versions of MS Windows installers of Vista Home-32, Win7 Ultimate-32, Vista Home-64 and Win7 professional-64.
(3) Grub accomplishes the booting process by unhiding the partition it is asked to boot and hiding the remaining 3 primaries. The hiding only alter the partition Type number in fooling the installer thinking the hidden partitions being foreign. MS system command “diskpart” has a similar facility by “setid” doing exactly the same thing. Grub can do this during boot time whereas diskpart can only operate after an installer or a MS Windows has been booted up first.
(4) Every MS system, from Dos to Win7, has a boot sector code deposited in the reserved boot sector of the partition it resides in. Technically it become possible for another boot loader to load the boot sector code and hand over the control to the MS system. This is one boot loader booting another one, a technique called “chainloading" used by virtually all reputable boot loaders. MS Win2k/Xp's NTLDR and Vista/Win7's bootmgr boot other operating systems with the same technique. The scheme described here is install the boot sector code of bootmgr in each primary partition of the flash drive. Grub is fired up first and then asked to hand over the control to this boot sector code which responsible for loading the Vista/Win7 common boot loader bootmgr. It is bootmgr that fires up the installer program.
(5) Vista and Win7 has a program “bootsect.exe” stored in every \boot directory of the installation DVD. To generate a boot sector code for boomgr, say to the drive D: is simpy
Outline of the scheme
bootsect.exe /nt60 d:
(i) Format the flash drive into 4 primary partitions. This is done in Linux with a Live CD as Linux mount all partitions and has a far more powerful set of utilities.
(ii) Copy the contents of each MS Windows installation DVD into each partition of the flash drive. This can be done either in Linux (or MS Windows if using a USB hard disk as an interim storage with which all 4 primaries can be mounted, otherwise one partition at a time with a pen drive)
(iii) Write the boot sector code in each primary partition. This operation can only be done with an installation DVD or using an installed 64-bit MS Vista or Win7.
(iv) Arrange the booting process. This involves using Linux. Only the boot loader Grub is installed but its location can be in a floppy, with the flash drive, in a CD/DVD or any of the hard disk partition.
Essential steps or commands
I list all the essential commands with brief explanations.
(A) To create a Linux bootable CD. - to be done in MS Windows or any OS.
This requires a user to download an iso file free from an Internet site and burn the image file to a bootable CD. I suggest Mepis, downloadable from here from DistroWatch.com, as it has Grub1 inside. The most popular Linux is Ubuntu but it has moved to Grub2 which is more difficult to use. Ubuntu, if internet-able, can also be used if the user replace the Grub2 with Grub1 by adding it with the command
(B) Boot up Mepis Live CD, claim the root privilege (equivalent to Admin rights in MS Windows)
sudo apt-get install grub
Mepis will ask for the root password which for a Live CD is just “root”. If Ubuntu is used the "su" is replaced by "sudo su" and Ubuntu doesn't demand a password if it is a Live CD.
Then do a sanity check to show up all disks and partitions by command
The above displays the device names of every partition.
(C) Formatting the partitions - shown here done in Linux but can be done in Windows
There are many partitioning tools in Linux. I used a script, equivalent to a batch file in Dos, to do the partitioning. First I entered this line in terminal
which produces a text file called “a2” representing the key strokes I would have to use with the program “sfdisk” in Linux. The 393, 393, 654 and 523 are the number of cylinders in the 4 primary partition which I specified with Type “7” signifying the NTFS filing type. The partitioning command is just
echo ",393,7" >a2 ;echo ",393,7" >>a2 ;echo ",654,7" >>a2;echo ",523,7" >>a2
producing the following partition table
sfdisk /dev/sdc< a2
on a 400Gb USB external hard disk temporarily. MS Windows mounts every partition if it is a hard disk in the USB connection. I was just make use this feature to accelerate the process. I shall show how the finish product can be copied to a USB flash drive in one operation.
Disk /dev/sdc: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00017ff8
Device Boot Start End Blocks Id System
/dev/sdc1 1 393 3156741 7 HPFS/NTFS
/dev/sdc2 394 786 3156772+ 7 HPFS/NTFS
/dev/sdc3 787 1440 5253255 7 HPFS/NTFS
/dev/sdc4 1441 1963 4200997+ 7 HPFS/NTFS
The use of a USB hard disk as an interim storage is optional but it amkes life a lot easier.
The above partitions sizes, approximately 3.2Gb, 3.2Gb, 5.3Gb and 4.3Gb were selected to accommodate the 32-bit Vista, 32-bit Win7, 64-bit Vista and 64-bit Win7 respectively, after checking their DVD contents. One cylinder is 255 heads x 63 sectors x 512 bytes per sector giving 8.225Mb.
Linux separates the partition creation with formatting. The former is reversible but the latter is irreversible. The formatting in Linux is conducted on the device which cannot be mounted yet as it has no filing system yet.
In the above I opted for a “fast” format and added a “Label” to each partition to help me identify them.
mkfs.ntfs -f -L Vista-32 /dev/sdc1
mkfs.ntfs -f -L Win7-32 /dev/sdc2
mkfs.ntfs -f -L Vista-64 /dev/sdc3
mkfs.ntfs -f -L Win7-32 /dev/sdc4
Now with a filing system inside these blank partitions can be mounted for accepting the DVD data.
Linux uses the /mnt for the mounting purpose so I made 4 mounting points, one per partition, in the /mnt directory and mounted the appropriate devices or partitions.
mount /dev/sdc1 /mnt/sdc1
mount /dev/sdc2 /mnt/sdc2
mount /dev/sdc3 /mnt/sdc3
mount /dev/sdc4 /mnt/sdc4
(D)Transferring the content of the installation DVDs to the partitions - shown in Linux here but can be done in Windows
By placing one DVD after the other
In the above the terminal will not accept my command until the copying operation is complete. The CD/DVD drive has been mounted automatically by Linux under the name of “UDF Volume” in /media directory.
cp -R /media/UDF\ Volume/* /mnt/sdc1
cp -R /media/UDF\ Volume/* /mnt/sdc2
cp -R /media/UDF\ Volume/* /mnt/sdc3
cp -R /media/UDF\ Volume/* /mnt/sdc4
I have now transferred the 4 Vista and Win7 DVDs into the 4 primary partitions of a USB hard disk.
(E) Write boot sector code in each primary partition. - must be done in MS Windows
I need to run bootsect.exe with this Windows-only operation with the USB disk. It can be done inside a 64-bit Win7's Command Prompt or by booting up a 64-bit Win7 or Vista DVD, opt for “Repair” and select “Command Prompt”.
In a Vista/Win7 Command Prompt, which is equivalent to the terminal mode in Linux or Recovery Console in XP installation CD, one has to check the partition drive letters first. The labels I entered during the formatting enable me to identify them as drive j:, l:, m: and n: respectively. I then issued these commands to write each system's own boot sector code in its own partition. The 32-bit bootsect.exe does not work on 64 bit version so it pays to use each system's own bootsect.exe.
j:\boot\bootsect.exe /nt60 j:
l:\boot\bootsect.exe /nt60 l:
m:\boot\bootsect.exe /nt60 m:
n:\boot\bootsect.exe /nt60 n:
(F) Clone the USB hard disk into the flash drive. - can be done in any Linux but requires third party software if done in Windows
This has to be done easily in any Linux as it has a command called “dd” that could do a sector-to-sector copying. When booted up a Linux Live CD with my 400Gb USB hard disk and the 16Gb USB flash drive were identified as devices /dev/sdc and /dev/sdd. The cloning operation is just one line of command but it can only be issued after booting up Linux, opt for a terminal and claim root privilege.
The command “dd” here is instructed to read from an input file sdc, which is the 400Gb USB hard disk and write the data on an output file sdd, which is the 16Gb USB flash drive, using block size 32256 bytes. One complete track of 63 sectors times 512 bytes per sector is 32256 bytes I specified here as one record.
dd if=/dev/sdc of=/dev/sdd bs=32256
“dd” will attempt to read all 400Gb hard disk and put the same on the 16Gb flash drive but it has to stop with an error when the room for writing has been exhausted in the 16Gb device. The partitions I have created in the 400Gb hard disk is less than 16Gb so the rest is just empty space.
I used the above technique because it is simple. When the first record, which should be 63 sectors of 512 bytes, is cloned the MBR of the 400Gb hard is faithfully duplicated on the 16Gb flash drive. “dd” does not copy files. It copies the binary bits in the hard disk and so the boot sector codes are automatically transferred.
On completion I have a healthy and sound flash drive ready to boot up any of the 4 Vista and Win7 installation DVD. All I need now is how to boot it.
(G) To arrange booting arrangement - Only done in Linux and the reason of this thread
The easiest way to boot the fully populated flash drive is by a Grub floppy. This is because one does not have to bother with the Bios at all if the floppy is the first bootable device.
Here are the steps to make a bootable Grub floppy, involving copying just two files, called stage1 and stage2 normally residing in the /boot/grub directory of a Linux that has Grub1. In a terminal with root privilege and a spare 1.44Mb floppy in the drive the method published by GNU/Grub Manual is
The GNU/Grub method produce a floppy without a filing system. So it is only usable for booting purpose. My own method involves the following steps but the floppy is formatted and can be used for storage.
dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1
dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1
At this point the floppy isn't bootable yet. To make it bootable I need to put the boot sector code in the floppy by invoking a Grub shell at the Linux terminal and set up Grub, by these commands
mkdosfs -F12 /dev/fd0
mount /dev/fd0 /mnt/fd0
cp /boot/grub/stage* /mnt/fd0/boot/grub/
The above floppy can accept a booting menu which can be created by an text editor. The filename must be menu.lst and has to be stored in the /boot/grub directory of the floppy. It is very easy to create one. I have assumed my flash drive as the 4th disk in the PC but a user can adjust for his/her situation accordingly.
Grub1 counts disks and partitions from zero. First disk is (hd0), second disk is (hd1) etc. The second digit is attached denotes the partition number. Therefore the 1st partition of the first disk is (hd0,0) and the 2th partition of the 4th disk is (hd3,1). Since my flash drive is the 4th disk so my 4 choices of booting the 4 installation DVD will be like, using a Linux terminal editor like
to have the following entries
In the menu there is no need to hide with the partitions after the one to be booted because Vista and Win7 would not mount them.
title Vista 32-bit in first primary of 4th disk
title Win7 32-bit in second primary of 4th disk
title Vista 64-bit in third primary of 4th disk
title Win7-64-bit in fourth primary of 4th disk
I provide the booting alternative with a Grub floppy because it is the most convenient method of booting. When Grub is loaded it will try to execute the menu.lst if it is available. If it is not found or defective then Grub defaults to a Grub prompt. In a Grub prompt one can boot up each MS Windows installer “manually”! The commands in the above menu.lst are actually the manual commands required by typing one line at a time, with the “title” statement omitted and the after “chainloader +1” add one more statement of “boot”.
As an example if a user in a Grub prompt can boot the second partition manually by
He/she can fire up a hard disk any time in a Grub prompt by loading its MBR by
It is noteworthy to point out the simple process of booting here too. What Grub is doing here after being informed of the partition required to be booted by the “root” statement it is then instructed to chainload the boot sector of the partition at the “+1” position, meaning from the second sector onward as Grub itself occupies the first sector.
If a user has no floppy drive then it will be necessary to install Grub in the pen drive. A different thread has be written for this particular purpose. It is a cunning technique because the pen drive has 4 primary partitions and has no more room for Grub which needs a partition for installation. Grub cannot be place in a NTFS partition because it cannot read such filing system. However a newer version Grub2 may be able to read a NTFS partition but it may need the partition's boot sector for residence too. Please refer to this thread for details to place Grub in a fully populated flash drive. I have written this thread showing how Grub can be put inside a CD/DVD or a hard disk partition.
Discussuion of results
The 4 Vista and Win7 installation DVDs were successfully transferred and booted up as expected. However I found the MS installer has been written to fetch files from the first partition from the flash drive. Therefore partitions in front of the one you want to boot must be temporarily deleted. If this rule is not followed the installer can report an error asking a driver for the CD/DVD drive.
All 4 installation DVDs have been booted successfully and can be used for installation.
Example of deleting partitions in front of the one required to be booted.
I deleted the first primary and booted the second partition which is still known to Linux as sdc2 but the partition table now has no sdc1 entry. To my surprise my Win7-32 booted. I then deleted the second partition and the 3rd partition of Vista-64 booted up successfully. With the partition table looking like this
Naturally I tried the last partition sdc4 by removing sdc3 and my Win7-64 fired up. So it all works as long as the Installation DVD is at the "first" partition of the hard disk with nothing ahead of it.
Disk /dev/sdb: 16.2 GB, 16173236224 bytes
255 heads, 63 sectors/track, 1966 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00017ff8
Device Boot Start End Blocks Id System
/dev/sdc3 787 1440 5253255 7 HPFS/NTFS
/dev/sdc4 1441 1963 4200997+ 7 HPFS/NTFS
It is a bit of inconvenient I admit but remember I could restore my partition table any time with a script. So I went into the Internet, displayed this thread, copied the script in Section (C), activated it in a terminal and did
and have my full partition table back again.
sfdisk /dev/sdc <a2
In conclusion the above scheme can allow all 4 Vista/Win7 installation DVD installable from 4 primary partition of a flash drive. More can be accommodated if they are stored in the logical partitions. (see Post #5). However putting the installers in the primary partitions seems better and has less hassel with the installer during the boot time.
The simple booting of Vista/Win7 installer by a Linux boot loader Grub is demonstrated.
Grub in here has been made to interface with the Vista/Win7 boot loader bootmgr. The two work seamlessly.
Grub's ability to boot an operating system step by step manually is highlighted.
I was talked into working with a flash drive. Many restrictions disappear if a USB external hard disk is used.
Additional tips and explanations
Tips for Windows Users
In the Scheme proposed in Post #1 a USB hard disk was temporarily used for the storage of the DVDs. The contents was finally transferred to the flash drive. This is because MS Windows do not treat a USB hard disk as a "Super floppy" with only one partition but a flash drive they do. Therefore with a USB hard disk a user can operate all 4 primary partition simultaneously and save a lot of time.
Therefore Step (i), (ii) and (iii) can all be done in a pure MS Windows environment.
Step (i) can be carried out in MS Windows using "disk Management". The creation of a partition is coupled with formatting in Windows. In Linux the two must be separated if it is done in a terminal but in a desktop programs like Gparted will carry out the two task simultaneously just like Windows.
Step (2) Can be done in Windows "drag and drop" or in a Command Prompt with command like "xcopy" from one drive to another.
Step (3) Must be done in a Windows environment and it has to be a 64-bit too because a 32-bit Windows cannot load the bootsect.exe of a 64-bit Windows installer. I have not investigated further but it would appear there may be a reason for it so to play safe carry out the operation of "bootsect.exe" a a 64-bit environment which is obtainable by booting up a Vista-64 or Win7-64 installation DVD and opt for the Command Prompt.
The Vista/Win7 have another command to fix the boot sector like
but this command may be suitable for the C: drive only. I used bootsect.exe because it can be done for all partitions at the same time.
Both Vista and Win7 use the same boot loader boot.mgr but the newer version in the Win7 should be better and downward compatible. Use it whenever possible.
The transfer of the contents from a USB hard disk to a USB flash drive can also be done by Windows third party special software like Norton Ghost or Acronis but I have not tried it myself. I use Linux because "dd" is a fundamental tool and is normally the fastest if you know exactly what you want.
The booting process has been made complicated by my write up, mainly my detailed step to obtain a Grub floppy which is the most useful booting tool ever invented. It can be used to boot up any installed operating system in a PC. If you have it then you can boot the flash drive immediately after executing the bootsect command.
In fact if you are interested in the subject you can only do the bootsect on one of the partitions, say the 3rd one, and use the GRub floppy to try all 4 primary partition to prove only the 3rd one will respond. Grub will tell you by an error message that other partitions are not bootable.
I put in a bit of effort to explain how Grub works. The simple commands "root (hdx,y)", "chainloader +1" and "boot" are universal to all installed MS systems from Dos to Win7. All you need is a Grub floppy and the disk number in x and the partition number in y. Booting with Grub in a "child play".
I hope this thread will go some way to convince the readers that the booting process is a lot simpler than M$ wants us to believe.