Jump to content











Photo

USB boot from hard drive

xboot usb hdd boot windows

  • Please log in to reply
6 replies to this topic

#1 Sirbu

Sirbu
  • Members
  • 4 posts
  •  
    United Kingdom

Posted 23 July 2019 - 09:50 AM

Created a multi-application bootable usb drive with Xboot.  First (Grub4dos) menu option is "Boot from hard drive" which I assume means boot the OS on the computer's hard drive, in this case Windows XP on a Sony Vaio.  However, selecting this option boots the Vaio Recovery Center, presumably from the Recovery partition on the hard drive.  Can the Xboot Grub4dos menu be changed to boot from the System partition on the hard drive?

 

Menu code is as follows.

 

### MENU START
title Boot from hard drive
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0,2)
### MENU END

 



#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14945 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 23 July 2019 - 12:08 PM

Created a multi-application bootable usb drive with Xboot.  First (Grub4dos) menu option is "Boot from hard drive" which I assume means boot the OS on the computer's hard drive, in this case Windows XP on a Sony Vaio.  However, selecting this option boots the Vaio Recovery Center, presumably from the Recovery partition on the hard drive.  Can the Xboot Grub4dos menu be changed to boot from the System partition on the hard drive?

 

Menu code is as follows.

 

### MENU START
title Boot from hard drive
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0,2)
### MENU END

Most probably yes.

 

Breakdown of the above:

 

map (hd0) (hd1) -> map the first disk (that since you have booted from it is the USB) to second disk
map (hd1) (hd0) -> map the second disk (that since you have booted from USB is the internal disk) to first disk
map --hook -> hook the mapping, i.e. make it "definitive"

 

 

 what happens till now is that everything is reverted to the same situation it would have been if you had booted from the internal disk

 

chainloader (hd0,2) -> chainload the bootsector (or PBR) of the third partition on first disk (the internal one)

 

boot -> implied at the end of a menu.lst entry, otherwise needed on command line

 

When you boot, press "c" to get to command line, then enter manually:

 

map (hd0) (hd1) [ENTER]

map (hd1) (hd0) [ENTER]

map --hook [ENTER]

 

then try:

chainloader (hd0,0) [ENTER]

boot [ENTER]

 

or:

 

chainloader (hd0,1) [ENTER]

boot [ENTER]

 

or:

 

chainloader (hd0) [ENTER]

boot [ENTER]

 

The above three sets of commands attempt:

1) to chainload the PBR of first partition on first disk

2) to chainload the PBR of second partition on first disk

3) to chainload the MBR of first disk

 

Particularly, #3 should work as it simply replicates the normal boot sequence of the PC (without any USB device attached), i.e.:

BIOS->MBR of first hard disk-> whatever the code in the MBR does

is replicated as:

BIOS->grub4dos on USB disk->re-mapping of disks as if no USB is present->MBR of first hard disk-> whatever the code in the MBR does

 

A "better" way (if none of the above work) is

root (hd0,0) [ENTER]

chainloader +1 [ENTER]

boot [ENTER]

or

 

root (hd0,1) [ENTER]

chainloader +1 [ENTER]

boot [ENTER]

or

 

rootnoverify (hd0) [ENTER]

chainloader +1 [ENTER]

boot [ENTER]

 

On some hardware/OS it is needed to establish root to the boot device or partition.

 

Once you are satisfied with results on command line you can edit the menu.lst entry with the successfully tested commands.

 

:duff:

Wonko


  • antonino61 likes this

#3 Sirbu

Sirbu
  • Members
  • 4 posts
  •  
    United Kingdom

Posted 24 July 2019 - 08:53 PM

Thanks for the reply.  I had great difficulty accessing the Grub command line until I selected the "Help!" option from the Xboot menu, then pressed "F10" and then pressed "c".  However entering "map (hd0)(hd1)" gave an Error 11 and a message about a missing filename.  Tried the suggested "root" options such as "root (hd0,0)" which went back to the Xboot menu on the USB stick and "root (hd0,1)" which failed with unrecognised partition, there being only one partition on the USB stick.  I assume that "hd0" is the USB stick and "hd1" is the internal HDD.  The question is where is the bootloader for Windows located and how can it be initiated via Grub?



#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14945 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 25 July 2019 - 07:26 AM

Maybe there is an issue with spaces, it is not:

"map (hd0)(hd1)"

it is:

map[SPACE](hd0)[SPACE](hd1)[ENTER}

 

Usually (not always-always but often enough) when you select to boot from the USB stick in BIOS, the disk order is changed, putting the USB as first disk, hence the need to remap, so yes, (hd0) is the first disk when you do not boot from USB, but when you boot from USB, the USB device becomes (hd0) and the internal disk becomes (hd1), maybe on your particular computer something else happens.

 

You can check "which is which" and the actual partitions on the devices with:

geometry (hd0)

and

geometry (hd1)

 

The instructions I gave you till now are for attempting to boot as if the USB wasn't connected, but you can try to chainload directly the Windows bootloader.

For WINNT up to XP the bootloader is NTLDR

For Vista and later it is BOOTMGR

From the command line you run either:

 

find --set-root /ntldr

or

find --set /root /bootmgr

 

then you run only

root

 

the first command sets root to the partition where the file is found, the "root" command will display "current root", i.e. something like:

(hd1,1)

 

Then you use this piece of info as follows (example for Vista and later):

chainloader (hd1,1)/bootmgr

 

grub4dos will return a message *like* "Will boot ..... from drive=0x8n, , partition=0xn(hidden sectors=0xnn)"

 

then:

boot

 

The potential  issue with the above is that grub4dos will set root to the FIRST instance of /bootmgr it finds, which might (or might not be) the right one, if you do not remap the disks, and if there is a BOOTMGR in root of the USB stick/drive it will establish root there.

 

 

The grub4dos command line is not much different from a DOS or *nix command line, it needs some minimal time to get used to it, the generic approach is:

COMMAND [Options] [parameter1] [parameter2] [parameter ...]

each part is separated by [SPACE] and is executed by [ENTER]

 

:duff:

Wonko



#5 Sirbu

Sirbu
  • Members
  • 4 posts
  •  
    United Kingdom

Posted 25 July 2019 - 05:02 PM

Thanks again.  There was indeed a problem with SPACES and having got that sorted and with a bit more trial and error with your suggestions the following sequence of commands enabled me to boot into Windows on the internal hard drive via Grub.

 

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

root (hd0,2)

chainloader +1

boot

 

Howwver, while this worked from Grub (accessed as in my previous post) it didn't work when I amended the Xboot menu.lst file with these commands in the Menu option for Booting from Hard Drive.  That option continued to boot the Recovery Center in the first partition on the internal hard drive.

 

Further inspection revealed that the Xboot syslinux code  for this option does not access the relevant menu in the menu.lst file but seems to be coded to access directly the first partition on the internal hard drive.  The code is

 

.com32 chain.c32 hd1 1 swap

 

Simply changing this to

 

.com32 chain c32 hd1 3 swap

 

then enables Windows to boot since it is located on the 3rd partition on the system disk on my computer.

 

I don't know if it would be easy to edit Xboot to make this change permanent but it doesn't really address the issue.  What is required is to access and therefor boot from the Boot from Hard Drive menu in the menu.lst file.  This could then be easily edited in Xboot to suit other computers. So, any ideas how to do that?



#6 Sirbu

Sirbu
  • Members
  • 4 posts
  •  
    United Kingdom

Posted 25 July 2019 - 05:44 PM

Doh!  It's obvious now - Xboot boots from a Syslinux menu.  Easily amended and all working satisfactorily now.  Let me know if you have any other comments or advice.  Otherwise many thanks for your help.



#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14945 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 25 July 2019 - 06:51 PM

Good. :)

I was fooled by your initial reference to menu.lst, and I assumed (my memory is not as good as it was) that XBOOT chainloaded grub.exe (like in the link I post below JFYI)

 

Talking of Xboot (as a program) is particularly difficult.

 

The Author, who was a promising (but IMHO very far from "production ready") young programmer, Shamur,  passed away in 2011, being only twentish (I seem to remember 21 or 22) :(:

http://reboot.pro/to...riam-of-shamur/

 

The program - even if it generally (but not always) works just fine - is actually a mish-mash of several tools, quickly assembled together, partially without a proper "plan" and released at an early stage of development (and using IMHO a completely "wrong" environment, i.e. .NET framework vs 4 ).

 

The code was never released so noone can correct the bugs/issues, and the tool shows - besides its age - also some "basic" shortcomings, partly because it was in development, partly for the lack of experience of the Author, whatever.

 

For some strange reasons, even if it is not developed since 8 years or so, it is still seemingly pretty much popular, even if it uses very old versions of the actual booting tools (both Syslinux and grub4dos, particularly the latter, have greatly evolved since).

 

It is essentially what I call a "Pareto principle" program ;) :

https://en.wikipedia...areto_principle

something that is extremely easy (and works just fine) in 80% of cases but sucks (and sucks big) in the remaining 20%.

 

Depending on the actual thing that needs to be booted, XBOOT does some "non-sensical" things, you are maybe the first user in three years that posted here attempting to understand/modify a menu.lst (and/or Syslinux.cfg) made by XBOOT, if you are interested check the process used to boot a parted magic .iso:

 

http://reboot.pro/to...bsyslinux-work/

 

Nowadays, besides using directly  "pure" Syslinux  or grub4dos (personally I prefer the latter), there are IMHO much better tools for making bootable USB sticks, I would suggest mainly RUFUS (which is very good where other programs fail but that is not - at least last time I checked it particularly suited to multi-boot sticks) and Easy2boot.

 

 

:duff:

Wonko







Also tagged with one or more of these keywords: xboot, usb, hdd boot windows

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users