magic_ninja
December 30th, 2009, 09:12 AM
Create an external hard drive with multiple OS installers
Preface:
I created this guide after spending quite a while googling and getting help on irc, when I realized that there wasn't really a howto on this. This particular guide goes for Windows 7 Installer and Ubuntu 9.10 installers on the same disk. This guide assumes you have basic knowledge of how to partition your hard drive with your selected program, and that you are capable of using the appropriate letters/identifiers for your disk in windows and linux. YOU HAVE BEEN WARNED!
Materials You Need:
External Hard drive with at least 30 GB of free space
Partitioning Program - I like Acronis Disk director if your in windows, but GParted should work fine, and as you need at least an Ubuntu Live booting method, you will have to boot into Ubuntu by one way or another anyway.
Windows 7 ISO of your choice - I used the ultimate x64 bit version myself
Ubuntu ISO of your choice
Bootable ubuntu 9.10 flash drive or cd - if you don't have Ubuntu installed
A way to mount the Windows7 ISO in windows (this is native in linux)
Remember with the OS installers, you can put 32 bit and 64 bit version installers on the hard drive (the beauty of this).
The Steps
Partitioning the Hard Drive:
Warning: you will want to erase the entire disk for the first step so back up your data. If you have the space you can copy it back over afterwards. Here is how I partitioned my 200GB external drive.
Label - /boot - 2-5 GB+ - ext3 or ext4
This depends on how many linux ISO installers you will use, and how big they are. I do need to go into some depth on this partition though. Not all ISOs can be booted with GRUB2, it has to be supported by the ISO (so this is mostly linux ISOS at the moment).
Label - WindowsInstallerx64 - 10GB - NTFS
This of course is your windows installer, you can create other partitions for 32 bit and 64 bit versions or however you want to do this.
Label - Swap - 512 MB - swapfs
Label - Storage - NTFS/EXT3
Whatever is leftover and this is where you will copy your data you backed up back to.
Setting up the Installer Files:
Get the windows7 and ubuntu isos copied to the proper directories
Just copy the ubuntu iso or isos over to the /boot/iso directory (create the ISO directory if needed)
For Linux:
sudo mkdir /media/boot1
sudo mount <boot partition dev name here> /media/boot1
sudo mkdir /media/boot1/boot
sudo mkdir /media/boot1/boot/iso
cp <path to ubuntu iso>/<ubuntu iso name>.iso /media/boot1/iso
Copy over the files from the Win7 iso to the root of the WindowsInstallerx64 directory. Mount your isos under windows and copy the files or follow the linux directions below.
For Linux:
sudo mkdir /media/win7install
sudo mount <device name for winows 7 installer> /media/win7install
sudo mount -o loop <path to iso>/<win7iso name>.iso /media/cdrom
cp -fr /media/cdrom/* /media/win7install/
PLEASE MAKE SURE YOU DO NOT HAVE A CDROM/DVDROM MOUNTED WHEN YOU RUN THE ABOVE COMMANDS.
Make NTFS Partition Bootable
Boot into windows
Start-->Run-->type cmd-->press ENTER
Find the drive letter for your WindowsInstallerx64 partition ( for instance H: )
H: <press enter>(where H: is YOUR drive letter)
cd boot
bootsect.exe /nt60 H:
Set Up Grub
Reboot into the Ubuntu LIVE ISO
Mount the boot partition
sudo mkdir /media/boot1
sudo mount <boot partition device name> /media/boot1
Install grub2 and Create grub.cfg
sudo grub-install --root-directory=/media/boot1 <your device id here>
if this command is successful
sudo gedit /media/boot1/boot/grub/grub.cfg
Save grub.cfg as soon as you make it. This is the trickiest part of the whole thing now. You will have to check over the grub.cfg and make your changes from the template I provide you below. Use your preferred method to get the UUID. You will need this so the hard drive will be bootable on other computers. You will have to use your UUID's in the grub.cfg. Use this program to get the UUID's and copy and paste them:
palimpsest
OR
sudo ls /dev/disk/by-uuid
grub.cfg template
# Timeout for menu
set timeout=10
# Set default boot entry as Entry 0
set default=0
# Entry 0 - WINDOWS7INSTALL
menuentry "Windows 7 Installer-64bit" {
search --set --fs-uuid <your UUID here>
chainloader +1
}
# Entry 1 - UBUNTU64INSTALL
menuentry "Ubuntu Live 9.10 64bit" {
loopback loop /boot/iso/<ubuntu iso filename here>.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/<ubuntu iso filename here>.iso noeject noprompt --
initrd (loop)/casper/initrd.lz
}
This is version 1.0 of the guide. Let me know the problems you have and I will do the best to address them (please PM me letting me know if you found an error). I hope this helps someone and saves them the time it took for me to set this up. You can damage your system with this if you mess up the drive letters/system ids. If you have problems booting from your hard drive and the grub menu loads make sure your file names/paths/uuids are properly set up.
Preface:
I created this guide after spending quite a while googling and getting help on irc, when I realized that there wasn't really a howto on this. This particular guide goes for Windows 7 Installer and Ubuntu 9.10 installers on the same disk. This guide assumes you have basic knowledge of how to partition your hard drive with your selected program, and that you are capable of using the appropriate letters/identifiers for your disk in windows and linux. YOU HAVE BEEN WARNED!
Materials You Need:
External Hard drive with at least 30 GB of free space
Partitioning Program - I like Acronis Disk director if your in windows, but GParted should work fine, and as you need at least an Ubuntu Live booting method, you will have to boot into Ubuntu by one way or another anyway.
Windows 7 ISO of your choice - I used the ultimate x64 bit version myself
Ubuntu ISO of your choice
Bootable ubuntu 9.10 flash drive or cd - if you don't have Ubuntu installed
A way to mount the Windows7 ISO in windows (this is native in linux)
Remember with the OS installers, you can put 32 bit and 64 bit version installers on the hard drive (the beauty of this).
The Steps
Partitioning the Hard Drive:
Warning: you will want to erase the entire disk for the first step so back up your data. If you have the space you can copy it back over afterwards. Here is how I partitioned my 200GB external drive.
Label - /boot - 2-5 GB+ - ext3 or ext4
This depends on how many linux ISO installers you will use, and how big they are. I do need to go into some depth on this partition though. Not all ISOs can be booted with GRUB2, it has to be supported by the ISO (so this is mostly linux ISOS at the moment).
Label - WindowsInstallerx64 - 10GB - NTFS
This of course is your windows installer, you can create other partitions for 32 bit and 64 bit versions or however you want to do this.
Label - Swap - 512 MB - swapfs
Label - Storage - NTFS/EXT3
Whatever is leftover and this is where you will copy your data you backed up back to.
Setting up the Installer Files:
Get the windows7 and ubuntu isos copied to the proper directories
Just copy the ubuntu iso or isos over to the /boot/iso directory (create the ISO directory if needed)
For Linux:
sudo mkdir /media/boot1
sudo mount <boot partition dev name here> /media/boot1
sudo mkdir /media/boot1/boot
sudo mkdir /media/boot1/boot/iso
cp <path to ubuntu iso>/<ubuntu iso name>.iso /media/boot1/iso
Copy over the files from the Win7 iso to the root of the WindowsInstallerx64 directory. Mount your isos under windows and copy the files or follow the linux directions below.
For Linux:
sudo mkdir /media/win7install
sudo mount <device name for winows 7 installer> /media/win7install
sudo mount -o loop <path to iso>/<win7iso name>.iso /media/cdrom
cp -fr /media/cdrom/* /media/win7install/
PLEASE MAKE SURE YOU DO NOT HAVE A CDROM/DVDROM MOUNTED WHEN YOU RUN THE ABOVE COMMANDS.
Make NTFS Partition Bootable
Boot into windows
Start-->Run-->type cmd-->press ENTER
Find the drive letter for your WindowsInstallerx64 partition ( for instance H: )
H: <press enter>(where H: is YOUR drive letter)
cd boot
bootsect.exe /nt60 H:
Set Up Grub
Reboot into the Ubuntu LIVE ISO
Mount the boot partition
sudo mkdir /media/boot1
sudo mount <boot partition device name> /media/boot1
Install grub2 and Create grub.cfg
sudo grub-install --root-directory=/media/boot1 <your device id here>
if this command is successful
sudo gedit /media/boot1/boot/grub/grub.cfg
Save grub.cfg as soon as you make it. This is the trickiest part of the whole thing now. You will have to check over the grub.cfg and make your changes from the template I provide you below. Use your preferred method to get the UUID. You will need this so the hard drive will be bootable on other computers. You will have to use your UUID's in the grub.cfg. Use this program to get the UUID's and copy and paste them:
palimpsest
OR
sudo ls /dev/disk/by-uuid
grub.cfg template
# Timeout for menu
set timeout=10
# Set default boot entry as Entry 0
set default=0
# Entry 0 - WINDOWS7INSTALL
menuentry "Windows 7 Installer-64bit" {
search --set --fs-uuid <your UUID here>
chainloader +1
}
# Entry 1 - UBUNTU64INSTALL
menuentry "Ubuntu Live 9.10 64bit" {
loopback loop /boot/iso/<ubuntu iso filename here>.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/<ubuntu iso filename here>.iso noeject noprompt --
initrd (loop)/casper/initrd.lz
}
This is version 1.0 of the guide. Let me know the problems you have and I will do the best to address them (please PM me letting me know if you found an error). I hope this helps someone and saves them the time it took for me to set this up. You can damage your system with this if you mess up the drive letters/system ids. If you have problems booting from your hard drive and the grub menu loads make sure your file names/paths/uuids are properly set up.