Creating the ultimate Grub2 setup: Windows installer + Live, Linux installer + live +
A year ago I tried to make the perfect memory stick - to once and for all throw away all the CD-s and to make it the perfect rescue, install and fixing tool suiting my special needs. I tried, and I failed. The problem was getting Grub to load all those different CD's of mine.
Now, with GRUB2, I hope my dream has come possible:
I want to install GRUB2 to a USB Memory Stick, with 16-32 GB capacity or so, and make it able to load:
- Windows 7 installer
- Different versions: 32- and 64-bit, some modified, slipstreamed and tweaked etc
- Windows XP installer
- Windows PXE ("live" windows)
- Puppy Linux ("live" linux)
- Ubuntu installer
- Arch installer
- Hirens boot CD
- Ultimate boot CD
I remember I was able to get W7 installer and Puppy linux on the same stick, but from thereon the problems kept piling up. And now I need your help!
- AFAIK Ubuntu and Arch installer should be no hassle to add to GRUB2
- Hirens boot CD is able to boot Windows PXE using GRUB, therefore I know it's possible
- I got GRUB to load W7 installer, but when trying to get different Windows (XP, W7 32, W7 64, W7 modified) installers onto the stick I ran into problems.
- Both Hirens boot CD and Ultimate boot CD uses GRUB afaik, therefore it would be possible to load them without loading GRUB twice
Thank you! I hope there are some intelligent minds out there who can help me solve my problem.
Why do you want a Win7 installer? You can only legaly uswe it on one computer.
Nope, I have some installers where I can choose between Home, Premium, Ultimate etc and then I can easily (and legally) reinstall Win 7 on laptops with the serial located underneath (on a sticker) the laptop, on my own computers, computers with serials from MSDNAA etc.
What make you think Grub2 can boot a MS Windows installer?
Grub2 only boots another boot loader. If that boot loader is NTLDR then you can fire up Win2k and/or Xp. If the boot loader is bootmgr then you can fire up Vista and Win7 and all the 32-bit and 64-bit versions of them. However it is always the operating system's own boot loader that boots its master!
Grub1 and Grub2 can't even read a text file inside a ntfs partition or load an .exe file.
Grub can only boot an operating system "directly" if Grub has been designed to support it, like Linux and Unix.
For Grub to boot a MS system "indirectly", this is to say for Grub to pass the control to another boot loader, you need to have the installer installed inside the USN jump drive with its boot loader residing in the boot sector.
I atleast got Grub to boot bootmgr which booted a Windows 7 installer, but the trick was to get it to boot a bootmgr which was able to boot several different Win 7 instalations which was on the same disc.
So the problem is:
1: Configuring bootmgr to boot several different Windows installers located on the same memory stick
2: Configuring grub to boot different Linux distros including puppy (live) and installers (like Arch and Ubuntu), which means that I have to redirect grub to subdirectories
3: Having bootmgr and NTDLR on the same memory stick
4: Making NTDLR able to boot both XP installer and PXE
5: Beeing able to isolate Hirens Boot CD so I can boot it directly from Grub, OR chainloading Grub to boot Hirens Boot CD Grub which includes PXE, solving problem #4
5b: Making Grub beeing able to boot grub on the same disc ...
Is partitioning the Memory stick a solution?
Partition A (active): Grub + Linux distros (Puppy live + Arch and Ubuntu installers)
Partition B: Grub which is able to load Hirens boot CD and Win PXE
Partition C: BootMGR which is able to load several different Win 7 installers? Maybe slipstreaming and modifying a single ISO which is able to install both X86 and X64 and all the different versions would solve much of the problem.
Can BootMGR boot from logical partitions? Can GRUB? How many primary can I have on a memory stick?
Thanks for the help guys!
For a hard disk this is easy.
I have Grub installed in a Dos Fat32 partition which also houses NTLDR as well as bootmgr.
Therefore one Grub boots one Dos, 4 Windows and about 35 Linux.
To boot Dos Grub passes the control to bootmgr, which then fire up NTLDR which load the Dos
To boot Win2k/Xp is exactly like booting up the Dos
To boot Vsita or Win7 Grub passes the control to bootmgr which fire up Vista or Win7.
To boot Linux Grub passes the control to the boot loader of the selected Linux which may have Grub1, Grub2 or Lilo.
To do it in a USB jump drive the same procedure applies "but"
All MS Windows do not support booting from a USB device! I believe a USB device, even with an external hard disk, has to be affixed to a controller which MS systems do not entertain.
It may be possible to execute some .exe files from a USB devices but you need to install a MS system on the jump drive first. The nearest system I know that can go into a jump drive and boot from it is Freedos.
bootmgr can boot Xp, Win2k, Vista and Win7 from logical partitions if the boot loaders reside in a primary partition. All MS system MBRs work by searching the 4 primaries and boot up the one that marked "bootable". That is why MS boot loaders must be in one of the 4 primaries first and their actual systems can be anywhere else.
Grub pays no attention to the type of partition it is asked to boot.
I think since Linux detects the hard disk by linATA since 2.6.28 kernel there should be no limit on the number of partitions in a USB disk, which is looked upon same as a SCSI, IDE and Sata disk. However all Linux programs have been written to support up to 15 partitions. Some partitioning tools are unable to display more than 63 partitions. The maximum number I have tried on a hard disk is 130 partition using sfdisk with a bash script. Beyond this barrier gparted can be used as I have booted Linux as far as from the 137th partition.
In gpt partitioning Linux and MS Windows support 128 partitions in a hard disk but USB device being classified as movable cannot have gpt partitions.
An demonstration of that 130 partitions is possible in a USB jump drive.
I plugged in a 16Gb USB jump drive. For demonstration I delete all the partition so that it is reported empty first by "fdisk" and then "sfdisk" - my instructions are marked in red.
I instructed sfdisk to partition the pen drive /dev/sdb and use the input from the file "a2".
Thank you for your input.
I have now ordered Lexar 16 GB USB Flash Drive Retrax for the sum of 16.8 GBP included world wide shipping (20 % off everything this weekend + 55 % off product!).
I do however wonder one thing: Does the partitions from sdb5 and up reside in the extended sdb4? Is it possible to just create like 10 primary partitions, not extended?
It would make it a lot simpler.
Then I could have 1 partition for each thing I wanted to boot, and their respective boot loader inside of it.
The reason why we only have 4 primaries in a Msdos hard disk is because between the 447 and the 510th bytes in the MBR there are only 64 bytes reserved for the partition table.
The 64 bytes is dived into 4x 16 bytes so each partition is defined by 16 bytes and they are called the primary partitions.
If you want more partition you must give up one of the 4 primaries, which can be any of the four, and use it for an extended partition.
An extended partition, like a primary partition tells the Bios the boundary of the partition in the hard disk, typically something like partition 1 occupies from 1st to 3024th cylinder.
The extended partition works differently to a primary by having a set of logical partitions. Due to the 16 bytes limitation it carries only the address of the 1st logical partition. Each logical partition has its own partition table and in it the next logical partition address can be found. The last logical partition address match the boundary stated in the extended partition.
As the Bios only read the first 512 bytes, called the MBR, from the disk it couldn't possibly know the addresses of the logical partitions. MS system's own MBR works by checking the 4 primaries and boot the one with the booting flag switched on. That is why all MS Windows must be initially booted from a primary partition.
Therefore you are only day dreaming if you think you can find more than 4 primaries in a hard disk partitioned with the Msdos scheme which just about the common partition table used by Linux, MS Windows, BSD and Solaris.
Linux reserves sda5 and upward for logical partitions.
If you create no primary and insist the first partition in the hard disk to be a logical partition then it will be called sda5. Unknown to you the sda1 is immediately used up as the extended partition. You partition table then still has no sda2, sda3 or sda5.
You should try to partition your hard disk in Linux using "cfdisk" as it is the best teacher in partitioning!
It really cleared things up.
I do however have some more questions for you:
1: Can I have bootmgr and ntdlr on the same (primary) partition?
Or can bootmgr on a primary partition chainload ntdlr on a logical, extended partition?
2: Can bootmgr and ntdlr, located on primary partitions, boot Windows installers or live CD's (PXE) on logical, extended partitions?
2b: Or, is it possibly to have different Windows installers on the same partition?
3: Is there a problem of having many linux-installers or live CD's (Puppy) on the same partition?
4: How did you chainload GRUB to load another GRUB?
5: Do you think Grub1 or Grub2 or Grub4dos would be the easiest one to set up for this purpose?
6: How do I manually copy Ubuntu-CDs onto the memory stick and make them bootable in Grub(1/2/4dos)? Unetinboot have a tendency to screw things up when dealing with multiple thing on the memory stick
I guess the solution would be to extract the CD onto the memory stick, and DL seperate kernels for this purpose. I know atleast Ubuntu have special boot kernels for this purpose
7: How do I manually copy Windows-CDs onto the memory stick and make them bootable in Grub(1/2/4dos)? PowerIso have a tendency to screw things up when dealing with multiple thing on the memory stick
I guess the solution would be to extract the CD onto the memory stick in a logical, extended partition and install bootmgr and ntdlr onto a primary partition and modify the bootmgr/ntdlr to boot my logical partitions.
I would have to have Grub to chainload a Win7 installer using bootmgr, and then modify bootmgr to be able to boot different Win7 installers.
1. Read Post #6
2 MBR boots the boot sector. Boot sector loads NTLDR or bootmgr. For bootmgr or NTLDR to boot a system in a logical partition you need to have installed it there first.
3. Read this . It means yes and no because many installer use the same folder names and filenames so you overwriting each other. Yes if you are careful and able to separate each.
4. The command "chainloader +1", used by both Grub1 and Grub2, instructs Grub to cut its head off and paste it at the "+1" position of the next boot loader defined previously by the "root" statement" and then bugger off. The "+1" position mean from the second sector.
5. You may be dreaming of something that is technically not possible at the moment but Grub1 is most versatile, Grub2 can reach areas Grub1 can't (like booting beyond 1TB location in the hard disk and gpt partitions. Grub4Dos is just using Grub inside a Dos partition. I keep Grub in floppies and CD so I could boot anything "installed" system. There is a big difference in booting an installed system and an installer. With the latter you have to boot up an operating system that runs the installer.
6. Answer to (3) refers.
7. That requires boot up an operating system, like a Dos, that can run the Windows installer. Standard MS system do not support installation in a USB device so it is not technically supported by M$. Never tried it myself but Freedos can be installed in a USB device so may be you can have a go with it. I reported Freedos bootable in a USN hard disk here.
Ok, but there is still some things that confuse me:
sda1 - Grub1 - ext3 - active - primary
sda2 - extended
sda3 - Puppy linux (booted directly from Grub) - ext4 - logical
sda4 - Backtrack Linux Live CD (booted directly from Grub - ext4 - logical
sda5 - Arch Linux installation CD (booted directly from Grub - ext3/4 - logical
sda6 - Ubuntu Linux installation CD (booted directly from Grub - ext3/4 - logical
sda7 - Windows XP installer (booted by NTLDR which is located on the same partition which is chainloaded by Grub) - ntfs - logical
sda8 - Windows PXE (booted by NTLDR which is located on the same partition which is chainloaded by Grub) - ntfs - logical
sda9 - Windows 7 installer (booted by bootmgr which is located on the same partition which is chainloaded by Grub) - ntfs - logical
sda10 - Hirens Boot CD (booted by Grub which is located on the same partition which is chainloaded by Grub on sda1) - ntfs I guess - logical
sda11 - Ultimate Boot CD - no idea how to boot this but i'll figure it out.
This solution is the easiest and cleanest because a) If I add or remove installers etc I only have to edit main GRUB, not 2-3 loaders (Grub which chainloads bootmgr which chainloads ntldr). It also makes it easier because every OS(installer) have it's own partition, which eliminates the problem of making bootmgr booting Windows installers located in subfolders.
However, if bootmgr cannot be installed on a logical partition and chainloaded by grub I need to figure out how to configure bootmgr to boot different Windows installers, chainload NTLDR and boot Windows installers located in subfolders.
OK since you have an interest in it I might as well tell you what I am aware of.
First thing first all MS systems start from the MBR.
All MS system MBR as I said are blind persons. They only go into the MBR and search the 4 primaries and load the boot sector of the one with booting flag switched on. Inside that partition it can be a system not belonging to M$. I have used this feature to get Vista's MBR to boot up Grub.
Therefore to boot any MS system you must start either a MS's MBR (from a hoot boot) or an active primary partition (Linux calls a partition = MS Windows calls it active, even though Linux never has a need to use this feature) fired up by another boot loader like Grub1, Grub2 or Lilo.
All MS Windows must be placed in the first primary partition detected by their boot loaders. This is to say, as I have proved it myself, a Dos (or a NTFS partition), add NTLDR and bootmgr inside plus Grub. You can then use them to boot virtually any number of NT version of MS Windows or later because these versions can be installed in logical partition. I use a Dos fat partition because both Dos Grub can be placed inside. For booting a data-only NTFS partition will work equally well.
All MS Windows installed in logical partitions do not have a boot loader inside! This applies to those in the primaries other than the "c" drive. The boot loaders are all inside the "C" drive. Got it?
If you have Dos, NTLDR, bootmgr and Grub1 inside a Dos primary partition there is only one boot sector and it is used by bootmgr. When you have Grub, in the MBR or in a floppy or in a CD/DVD directed to boot this primary partition then Grub simply passes the control to the boot sector code. The bootmgr is then active and loads its menu. You will find NTLDR being one of the menu entry for booting Win2k, Xp and Dos because bootmgr does not deal with them directly.
The above is the strategy M$ adopted for multi boot their own systems in a consistent fashion.
Your dream of controlling Grub has the following flaws
(1) Many Linux installers have been written to fetch the system files from a CD/DVD device. They would freeze in waiting for you to load the CD/DVD instead of looking into the USB device to get the files. I couldn't confirm if this will be the case for the MS installers because I haven't been far enough to find this out. An installer is just a computer program. Most bugs are inside the installers.
(2) It is possible that some MS boot sector codes use the system interrupts directly assuming the installation will be on "fixed" disk. Movable disk like a USB device will simply be missed out. I have tried to put bootmgr boot sector code inside a USB jump drive but it doesn't load as it does in a fixed disk.
(3) bootmgr (also NTLDR) works according the booting menu configuration file. It is in binary for bootmge and NTLDR uses boot.ini. Their menus boot only installed systems and not "installers" using a referencing system to identify the partitions.
Personally my view is you may have underestimated M$ corporation and think you have discovered uncharted areas that they know nothing about. Things are done for a reason. If M$ do not want their systems bootable from a USB device they would have done enough to make sure of it.
Well, it is possible to start both Linux installers and Windows installers (which uses bootmgr) from a USB jump drive, and there are certainly a lot of ways to do it. Microsoft has tools for making system installers bootable from USB devices. PXE is designed to run from a CD so that is no problem.
The problem is getting them all into the same jump drive and booting each one of them, how do you think I should do it due to the limitations of bootmgr/NTLDR? Dont worry about Windows installers - they load just like installed Windows systems (bootmgr).
I have not investigated into the technique MS installers booting from a USB but I am aware it has been done.
The technique is simply copy the files from the installation CD/DVD onto the jump drive and change the CD/DV-based boot loader to the one used for the hard disk. With Linux that is easy because Grub can load the kernel directly as well as passing the control to another boot loader.
I will need to do some investigation before I could answer your question.
|All times are GMT -5. The time now is 08:09 AM.|