LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Creating the ultimate Grub2 setup: Windows installer + Live, Linux installer + live + (http://www.linuxquestions.org/questions/linux-general-1/creating-the-ultimate-grub2-setup-windows-installer-live-linux-installer-live-813544/)

todda7 06-11-2010 07:48 AM

Creating the ultimate Grub2 setup: Windows installer + Live, Linux installer + live +
 
Hello!

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!

Notes:
- 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.

Bratmon 06-11-2010 08:12 AM

Why do you want a Win7 installer? You can only legaly uswe it on one computer.

todda7 06-11-2010 08:16 AM

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.

saikee 06-11-2010 02:44 PM

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.

todda7 06-12-2010 09:02 AM

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?
Like this:
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!

saikee 06-12-2010 09:12 AM

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.

saikee 06-12-2010 10:15 AM

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.
Code:

root@saikee-desktop-1:/home/saikee# fdisk -l /dev/sdb

Disk /dev/sdb: 16.2 GB, 16173236224 bytes
64 heads, 32 sectors/track, 15424 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x2c6b7369

  Device Boot      Start        End      Blocks  Id  System
root@saikee-desktop-1:/home/saikee# sfdisk -l /dev/sdb

Disk /dev/sdb: 15424 cylinders, 64 heads, 32 sectors/track
Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/sdb1          0      -      0          0    0  Empty
/dev/sdb2          0      -      0          0    0  Empty
/dev/sdb3          0      -      0          0    0  Empty
/dev/sdb4          0      -      0          0    0  Empty

I then wrote a bash script and put the output into a file called "a2" which would be my commands I would have to type in sfdisk to create 130 partitions.
Code:

echo ",10,c" >a2 ; echo ",10,c" >>a2 ; echo ",10,83" >>a2 ; echo ",,E" >>a2 ; for ((i=1;i<=130;i++)); do echo ",10,83"; done >>a2
Basically I created all partitions in 10 clyinders large. The first two have type c for fat32, the third one is Linux with type 83 and then convert the 4th primary into an extended partition with a loop to generate a further set of 130 partitions. If the script works it should create 134 partitions but sfdisk has a limit accepting no more than 130.

I instructed sfdisk to partition the pen drive /dev/sdb and use the input from the file "a2".
Code:

root@saikee-desktop-1:/home/saikee# sfdisk /dev/sdb < a2
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 15424 cylinders, 64 heads, 32 sectors/track
Old situation:
Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/sdb1          0      -      0          0    0  Empty
/dev/sdb2          0      -      0          0    0  Empty
/dev/sdb3          0      -      0          0    0  Empty
/dev/sdb4          0      -      0          0    0  Empty
too many partitions
New situation:
Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/sdb1          0+      9      10-    10239+  c  W95 FAT32 (LBA)
/dev/sdb2        10      19      10      10240    c  W95 FAT32 (LBA)
/dev/sdb3        20      29      10      10240  83  Linux
/dev/sdb4        30  15423  15394  15763456    5  Extended
/dev/sdb5        30+    39      10-    10239+  83  Linux
/dev/sdb6        40+    49      10-    10239+  83  Linux
/dev/sdb7        50+    59      10-    10239+  83  Linux
/dev/sdb8        60+    69      10-    10239+  83  Linux
/dev/sdb9        70+    79      10-    10239+  83  Linux
/dev/sdb10        80+    89      10-    10239+  83  Linux
/dev/sdb11        90+    99      10-    10239+  83  Linux
/dev/sdb12      100+    109      10-    10239+  83  Linux
/dev/sdb13      110+    119      10-    10239+  83  Linux
/dev/sdb14      120+    129      10-    10239+  83  Linux
/dev/sdb15      130+    139      10-    10239+  83  Linux
/dev/sdb16      140+    149      10-    10239+  83  Linux
/dev/sdb17      150+    159      10-    10239+  83  Linux
/dev/sdb18      160+    169      10-    10239+  83  Linux
/dev/sdb19      170+    179      10-    10239+  83  Linux
/dev/sdb20      180+    189      10-    10239+  83  Linux
/dev/sdb21      190+    199      10-    10239+  83  Linux
/dev/sdb22      200+    209      10-    10239+  83  Linux
/dev/sdb23      210+    219      10-    10239+  83  Linux
/dev/sdb24      220+    229      10-    10239+  83  Linux
/dev/sdb25      230+    239      10-    10239+  83  Linux
/dev/sdb26      240+    249      10-    10239+  83  Linux
/dev/sdb27      250+    259      10-    10239+  83  Linux
/dev/sdb28      260+    269      10-    10239+  83  Linux
/dev/sdb29      270+    279      10-    10239+  83  Linux
/dev/sdb30      280+    289      10-    10239+  83  Linux
/dev/sdb31      290+    299      10-    10239+  83  Linux
/dev/sdb32      300+    309      10-    10239+  83  Linux
/dev/sdb33      310+    319      10-    10239+  83  Linux
/dev/sdb34      320+    329      10-    10239+  83  Linux
/dev/sdb35      330+    339      10-    10239+  83  Linux
/dev/sdb36      340+    349      10-    10239+  83  Linux
/dev/sdb37      350+    359      10-    10239+  83  Linux
/dev/sdb38      360+    369      10-    10239+  83  Linux
/dev/sdb39      370+    379      10-    10239+  83  Linux
/dev/sdb40      380+    389      10-    10239+  83  Linux
/dev/sdb41      390+    399      10-    10239+  83  Linux
/dev/sdb42      400+    409      10-    10239+  83  Linux
/dev/sdb43      410+    419      10-    10239+  83  Linux
/dev/sdb44      420+    429      10-    10239+  83  Linux
/dev/sdb45      430+    439      10-    10239+  83  Linux
/dev/sdb46      440+    449      10-    10239+  83  Linux
/dev/sdb47      450+    459      10-    10239+  83  Linux
/dev/sdb48      460+    469      10-    10239+  83  Linux
/dev/sdb49      470+    479      10-    10239+  83  Linux
/dev/sdb50      480+    489      10-    10239+  83  Linux
/dev/sdb51      490+    499      10-    10239+  83  Linux
/dev/sdb52      500+    509      10-    10239+  83  Linux
/dev/sdb53      510+    519      10-    10239+  83  Linux
/dev/sdb54      520+    529      10-    10239+  83  Linux
/dev/sdb55      530+    539      10-    10239+  83  Linux
/dev/sdb56      540+    549      10-    10239+  83  Linux
/dev/sdb57      550+    559      10-    10239+  83  Linux
/dev/sdb58      560+    569      10-    10239+  83  Linux
/dev/sdb59      570+    579      10-    10239+  83  Linux
/dev/sdb60      580+    589      10-    10239+  83  Linux
/dev/sdb61      590+    599      10-    10239+  83  Linux
/dev/sdb62      600+    609      10-    10239+  83  Linux
/dev/sdb63      610+    619      10-    10239+  83  Linux
/dev/sdb64      620+    629      10-    10239+  83  Linux
/dev/sdb65      630+    639      10-    10239+  83  Linux
/dev/sdb66      640+    649      10-    10239+  83  Linux
/dev/sdb67      650+    659      10-    10239+  83  Linux
/dev/sdb68      660+    669      10-    10239+  83  Linux
/dev/sdb69      670+    679      10-    10239+  83  Linux
/dev/sdb70      680+    689      10-    10239+  83  Linux
/dev/sdb71      690+    699      10-    10239+  83  Linux
/dev/sdb72      700+    709      10-    10239+  83  Linux
/dev/sdb73      710+    719      10-    10239+  83  Linux
/dev/sdb74      720+    729      10-    10239+  83  Linux
/dev/sdb75      730+    739      10-    10239+  83  Linux
/dev/sdb76      740+    749      10-    10239+  83  Linux
/dev/sdb77      750+    759      10-    10239+  83  Linux
/dev/sdb78      760+    769      10-    10239+  83  Linux
/dev/sdb79      770+    779      10-    10239+  83  Linux
/dev/sdb80      780+    789      10-    10239+  83  Linux
/dev/sdb81      790+    799      10-    10239+  83  Linux
/dev/sdb82      800+    809      10-    10239+  83  Linux
/dev/sdb83      810+    819      10-    10239+  83  Linux
/dev/sdb84      820+    829      10-    10239+  83  Linux
/dev/sdb85      830+    839      10-    10239+  83  Linux
/dev/sdb86      840+    849      10-    10239+  83  Linux
/dev/sdb87      850+    859      10-    10239+  83  Linux
/dev/sdb88      860+    869      10-    10239+  83  Linux
/dev/sdb89      870+    879      10-    10239+  83  Linux
/dev/sdb90      880+    889      10-    10239+  83  Linux
/dev/sdb91      890+    899      10-    10239+  83  Linux
/dev/sdb92      900+    909      10-    10239+  83  Linux
/dev/sdb93      910+    919      10-    10239+  83  Linux
/dev/sdb94      920+    929      10-    10239+  83  Linux
/dev/sdb95      930+    939      10-    10239+  83  Linux
/dev/sdb96      940+    949      10-    10239+  83  Linux
/dev/sdb97      950+    959      10-    10239+  83  Linux
/dev/sdb98      960+    969      10-    10239+  83  Linux
/dev/sdb99      970+    979      10-    10239+  83  Linux
/dev/sdb100      980+    989      10-    10239+  83  Linux
/dev/sdb101      990+    999      10-    10239+  83  Linux
/dev/sdb102      1000+  1009      10-    10239+  83  Linux
/dev/sdb103      1010+  1019      10-    10239+  83  Linux
/dev/sdb104      1020+  1029      10-    10239+  83  Linux
/dev/sdb105      1030+  1039      10-    10239+  83  Linux
/dev/sdb106      1040+  1049      10-    10239+  83  Linux
/dev/sdb107      1050+  1059      10-    10239+  83  Linux
/dev/sdb108      1060+  1069      10-    10239+  83  Linux
/dev/sdb109      1070+  1079      10-    10239+  83  Linux
/dev/sdb110      1080+  1089      10-    10239+  83  Linux
/dev/sdb111      1090+  1099      10-    10239+  83  Linux
/dev/sdb112      1100+  1109      10-    10239+  83  Linux
/dev/sdb113      1110+  1119      10-    10239+  83  Linux
/dev/sdb114      1120+  1129      10-    10239+  83  Linux
/dev/sdb115      1130+  1139      10-    10239+  83  Linux
/dev/sdb116      1140+  1149      10-    10239+  83  Linux
/dev/sdb117      1150+  1159      10-    10239+  83  Linux
/dev/sdb118      1160+  1169      10-    10239+  83  Linux
/dev/sdb119      1170+  1179      10-    10239+  83  Linux
/dev/sdb120      1180+  1189      10-    10239+  83  Linux
/dev/sdb121      1190+  1199      10-    10239+  83  Linux
/dev/sdb122      1200+  1209      10-    10239+  83  Linux
/dev/sdb123      1210+  1219      10-    10239+  83  Linux
/dev/sdb124      1220+  1229      10-    10239+  83  Linux
/dev/sdb125      1230+  1239      10-    10239+  83  Linux
/dev/sdb126      1240+  1249      10-    10239+  83  Linux
/dev/sdb127      1250+  1259      10-    10239+  83  Linux
/dev/sdb128      1260+  1269      10-    10239+  83  Linux
/dev/sdb129      1270+  1279      10-    10239+  83  Linux
/dev/sdb130      1280+  1289      10-    10239+  83  Linux
/dev/sdb131      1290+  1299      10-    10239+  83  Linux
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

When sfdisk is asked to display the content of sdb it reports 130 partitions
Code:

root@saikee-desktop-1:/home/saikee# sfdisk -l /dev/sdb

Disk /dev/sdb: 15424 cylinders, 64 heads, 32 sectors/track
too many partitions - ignoring those past nr (507)
Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start    End  #cyls    #blocks  Id  System
/dev/sdb1          0+      9      10-    10239+  c  W95 FAT32 (LBA)
/dev/sdb2        10      19      10      10240    c  W95 FAT32 (LBA)
/dev/sdb3        20      29      10      10240  83  Linux
/dev/sdb4        30  15423  15394  15763456    5  Extended
/dev/sdb5        30+    39      10-    10239+  83  Linux
/dev/sdb6        40+    49      10-    10239+  83  Linux
/dev/sdb7        50+    59      10-    10239+  83  Linux
/dev/sdb8        60+    69      10-    10239+  83  Linux
/dev/sdb9        70+    79      10-    10239+  83  Linux
/dev/sdb10        80+    89      10-    10239+  83  Linux
/dev/sdb11        90+    99      10-    10239+  83  Linux
/dev/sdb12      100+    109      10-    10239+  83  Linux
/dev/sdb13      110+    119      10-    10239+  83  Linux
/dev/sdb14      120+    129      10-    10239+  83  Linux
/dev/sdb15      130+    139      10-    10239+  83  Linux
/dev/sdb16      140+    149      10-    10239+  83  Linux
/dev/sdb17      150+    159      10-    10239+  83  Linux
/dev/sdb18      160+    169      10-    10239+  83  Linux
/dev/sdb19      170+    179      10-    10239+  83  Linux
/dev/sdb20      180+    189      10-    10239+  83  Linux
/dev/sdb21      190+    199      10-    10239+  83  Linux
/dev/sdb22      200+    209      10-    10239+  83  Linux
/dev/sdb23      210+    219      10-    10239+  83  Linux
/dev/sdb24      220+    229      10-    10239+  83  Linux
/dev/sdb25      230+    239      10-    10239+  83  Linux
/dev/sdb26      240+    249      10-    10239+  83  Linux
/dev/sdb27      250+    259      10-    10239+  83  Linux
/dev/sdb28      260+    269      10-    10239+  83  Linux
/dev/sdb29      270+    279      10-    10239+  83  Linux
/dev/sdb30      280+    289      10-    10239+  83  Linux
/dev/sdb31      290+    299      10-    10239+  83  Linux
/dev/sdb32      300+    309      10-    10239+  83  Linux
/dev/sdb33      310+    319      10-    10239+  83  Linux
/dev/sdb34      320+    329      10-    10239+  83  Linux
/dev/sdb35      330+    339      10-    10239+  83  Linux
/dev/sdb36      340+    349      10-    10239+  83  Linux
/dev/sdb37      350+    359      10-    10239+  83  Linux
/dev/sdb38      360+    369      10-    10239+  83  Linux
/dev/sdb39      370+    379      10-    10239+  83  Linux
/dev/sdb40      380+    389      10-    10239+  83  Linux
/dev/sdb41      390+    399      10-    10239+  83  Linux
/dev/sdb42      400+    409      10-    10239+  83  Linux
/dev/sdb43      410+    419      10-    10239+  83  Linux
/dev/sdb44      420+    429      10-    10239+  83  Linux
/dev/sdb45      430+    439      10-    10239+  83  Linux
/dev/sdb46      440+    449      10-    10239+  83  Linux
/dev/sdb47      450+    459      10-    10239+  83  Linux
/dev/sdb48      460+    469      10-    10239+  83  Linux
/dev/sdb49      470+    479      10-    10239+  83  Linux
/dev/sdb50      480+    489      10-    10239+  83  Linux
/dev/sdb51      490+    499      10-    10239+  83  Linux
/dev/sdb52      500+    509      10-    10239+  83  Linux
/dev/sdb53      510+    519      10-    10239+  83  Linux
/dev/sdb54      520+    529      10-    10239+  83  Linux
/dev/sdb55      530+    539      10-    10239+  83  Linux
/dev/sdb56      540+    549      10-    10239+  83  Linux
/dev/sdb57      550+    559      10-    10239+  83  Linux
/dev/sdb58      560+    569      10-    10239+  83  Linux
/dev/sdb59      570+    579      10-    10239+  83  Linux
/dev/sdb60      580+    589      10-    10239+  83  Linux
/dev/sdb61      590+    599      10-    10239+  83  Linux
/dev/sdb62      600+    609      10-    10239+  83  Linux
/dev/sdb63      610+    619      10-    10239+  83  Linux
/dev/sdb64      620+    629      10-    10239+  83  Linux
/dev/sdb65      630+    639      10-    10239+  83  Linux
/dev/sdb66      640+    649      10-    10239+  83  Linux
/dev/sdb67      650+    659      10-    10239+  83  Linux
/dev/sdb68      660+    669      10-    10239+  83  Linux
/dev/sdb69      670+    679      10-    10239+  83  Linux
/dev/sdb70      680+    689      10-    10239+  83  Linux
/dev/sdb71      690+    699      10-    10239+  83  Linux
/dev/sdb72      700+    709      10-    10239+  83  Linux
/dev/sdb73      710+    719      10-    10239+  83  Linux
/dev/sdb74      720+    729      10-    10239+  83  Linux
/dev/sdb75      730+    739      10-    10239+  83  Linux
/dev/sdb76      740+    749      10-    10239+  83  Linux
/dev/sdb77      750+    759      10-    10239+  83  Linux
/dev/sdb78      760+    769      10-    10239+  83  Linux
/dev/sdb79      770+    779      10-    10239+  83  Linux
/dev/sdb80      780+    789      10-    10239+  83  Linux
/dev/sdb81      790+    799      10-    10239+  83  Linux
/dev/sdb82      800+    809      10-    10239+  83  Linux
/dev/sdb83      810+    819      10-    10239+  83  Linux
/dev/sdb84      820+    829      10-    10239+  83  Linux
/dev/sdb85      830+    839      10-    10239+  83  Linux
/dev/sdb86      840+    849      10-    10239+  83  Linux
/dev/sdb87      850+    859      10-    10239+  83  Linux
/dev/sdb88      860+    869      10-    10239+  83  Linux
/dev/sdb89      870+    879      10-    10239+  83  Linux
/dev/sdb90      880+    889      10-    10239+  83  Linux
/dev/sdb91      890+    899      10-    10239+  83  Linux
/dev/sdb92      900+    909      10-    10239+  83  Linux
/dev/sdb93      910+    919      10-    10239+  83  Linux
/dev/sdb94      920+    929      10-    10239+  83  Linux
/dev/sdb95      930+    939      10-    10239+  83  Linux
/dev/sdb96      940+    949      10-    10239+  83  Linux
/dev/sdb97      950+    959      10-    10239+  83  Linux
/dev/sdb98      960+    969      10-    10239+  83  Linux
/dev/sdb99      970+    979      10-    10239+  83  Linux
/dev/sdb100      980+    989      10-    10239+  83  Linux
/dev/sdb101      990+    999      10-    10239+  83  Linux
/dev/sdb102      1000+  1009      10-    10239+  83  Linux
/dev/sdb103      1010+  1019      10-    10239+  83  Linux
/dev/sdb104      1020+  1029      10-    10239+  83  Linux
/dev/sdb105      1030+  1039      10-    10239+  83  Linux
/dev/sdb106      1040+  1049      10-    10239+  83  Linux
/dev/sdb107      1050+  1059      10-    10239+  83  Linux
/dev/sdb108      1060+  1069      10-    10239+  83  Linux
/dev/sdb109      1070+  1079      10-    10239+  83  Linux
/dev/sdb110      1080+  1089      10-    10239+  83  Linux
/dev/sdb111      1090+  1099      10-    10239+  83  Linux
/dev/sdb112      1100+  1109      10-    10239+  83  Linux
/dev/sdb113      1110+  1119      10-    10239+  83  Linux
/dev/sdb114      1120+  1129      10-    10239+  83  Linux
/dev/sdb115      1130+  1139      10-    10239+  83  Linux
/dev/sdb116      1140+  1149      10-    10239+  83  Linux
/dev/sdb117      1150+  1159      10-    10239+  83  Linux
/dev/sdb118      1160+  1169      10-    10239+  83  Linux
/dev/sdb119      1170+  1179      10-    10239+  83  Linux
/dev/sdb120      1180+  1189      10-    10239+  83  Linux
/dev/sdb121      1190+  1199      10-    10239+  83  Linux
/dev/sdb122      1200+  1209      10-    10239+  83  Linux
/dev/sdb123      1210+  1219      10-    10239+  83  Linux
/dev/sdb124      1220+  1229      10-    10239+  83  Linux
/dev/sdb125      1230+  1239      10-    10239+  83  Linux
/dev/sdb126      1240+  1249      10-    10239+  83  Linux
/dev/sdb127      1250+  1259      10-    10239+  83  Linux
/dev/sdb128      1260+  1269      10-    10239+  83  Linux
/dev/sdb129      1270+  1279      10-    10239+  83  Linux
/dev/sdb130      1280+  1289      10-    10239+  83  Linux
root@saikee-desktop-1:/home/saikee#

These partitions are operable. I have once in another occasion filled everyone of the 126 logical partitions in a large internal hard disk with the same copy of Xp and boot up each one successfully to prove these partitions did function in practice. I needed to hide all the logical partitions and unhide the one I wanted to boot. Everything was done by script and batch files.

todda7 06-13-2010 05:06 AM

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.

saikee 06-13-2010 07:09 AM

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!

todda7 06-13-2010 07:44 AM

Thank you!
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.

saikee 06-13-2010 08:26 AM

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.

todda7 06-13-2010 09:52 AM

Ok, but there is still some things that confuse me:
Quote:

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.
and then you say
Quote:

For bootmgr or NTLDR to boot a system in a logical partition you need to have installed it there first.
Can GRUB chainload BootMGR located on a logical partition? If so, the BootMGR would be able to boot Win7 (the installer too, I guess). If this is possible (to have bootmgr / NTLDR located on a logical partition and chainloaded by GRUB) the simplest and cleanest solution seems to be:
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.

saikee 06-13-2010 10:44 AM

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.

todda7 06-13-2010 11:04 AM

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).

saikee 06-13-2010 11:41 AM

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 09:00 PM.