Jump to content











Photo
- - - - -

Grub4dos - run it from hdd

run hdd linux grub4dos

  • Please log in to reply
13 replies to this topic

#1 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 23 September 2016 - 09:06 PM

Greetings,

I am currently using RMPrepUSB to run Linux on a laptop which is not mine, it's from my employer.

The laptop came with Windows 7 Pro SP1 with 3 partitions - 1 hidden for boot manager, 1 for windows OS/applications and finally 1 for storing data.

Using a USB disk I can run Linux without having to touch the OS. With persistence turned on, I can run a Linux liveCD and make "permanent" changes to the OS which is something that everybody usually needs.

But using a 20MB/s USB pendisk it can be very sluggish. The persistence file can easily reach the 3 or 4 GB (updates, new apps, etc)...

Due to that, sometimes the experience can become a bit frustrating especially when you're dealing with a whole lot of small files that keep getting written/read to and from the USB drive.

Running it from the hdd would be easier and a whole lot faster, I'm sure. But doing that would be like installing Linux with Grub2 on dualboot, which is something that I am not much inclined to do because I wouldn't like my boss to find out that I have tweaked the computer.

Then I remembered that once I saw someone saying that we can install grub4dos by simply renaming grldr to ntldr and copying that to the boot partition of the hdd.

Would that work?

If so, what is the exact procedure?

Would that be:

- extract grub4dos to the boot partition of windows, using a linux livecd to be able to see that partition

- rename "ntldr" to "ntldr.original" and renaming "grldr" to "ntldr"

- what about the menu.lst? What entry would I need in order to boot the Windows OS?

Thanks in advance.

Cheers



#2 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 24 September 2016 - 12:19 AM

I don't know if this is what you want.

 

1.   Copy grldr or grub.exe to the directory where NTLDR and BOOT.INI resides.

2.   Append a line of C:\GRLDR="grldr" or C:\GRUB.EXE="grub.exe"

3.   Set timeout=1

 

And, the 2nd way to do this work:

 

1.   Copy grldr to the directory where NTLDR and BOOT.INI resides.

2.   Install the WEE boot sectors to the MBR+62 sectors, you may use a script to boot up ntldr first, for example, this script:

find --set-root  /ntldr
ntldr
grldr

3.   Each time on boot, you quickly press the Insert key. this will single-step trace the execution of the script. Then you may disable ntldr and enable grldr to run.

 

Similarly, the 3rd way ------ use a title'd script for WEE

timeout 1
default 0
title boot ntldr
find --set-root  /ntldr
ntldr
title boot grldr
find --set-root  /grldr
grldr

And, the 4th way:

 

1.   Insert your USB key to boot up grldr (Note GRLDR is not installed on the hard drive).

2.   Use grldr to boot up linux that has been installed on the hard drive.



#3 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 24 September 2016 - 01:54 AM

That's not exactly what I had in mind.
So I kept searching and searching and now I found this.
I guess this is exactly what I was looking for. Well, if it even works because I am yet to try...
But thanks for your input.
Cheers

#4 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 September 2016 - 08:43 AM

That's not exactly what I had in mind.
So I kept searching and searching and now I found this.
I guess this is exactly what I was looking for. Well, if it even works because I am yet to try...
But thanks for your input.
Cheers

You are running Windows 7.

Windows 7 does NOT use NTLDR, it uses BOOTMGR.

It won't work, unless you change the bootsector from the one invoking BOOTMGR to the one invoking NTLDR (and you add NTLDR from XP or Server 2003).

 

Additionally it is seriously frowned upon to rename grldr as it may break some functionailities.

 

Do as you were suggested, see also here:

http://reboot.pro/to...sults/?p=184060

it is easier and safer, it involves adding a single text file that you can create with Notepad, and even if you make a mistake there is no risk of damages.

Get a decently recent version of grub4dos, NOT one from 2009, deprecated, see also:
http://reboot.pro/to...iling-grub4dos/

 

:duff:

Wonko



#5 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 24 September 2016 - 11:30 AM

Ok, got it.
Thank you both for your input. :-)

Edited by john3voltas, 24 September 2016 - 11:33 AM.


#6 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 24 September 2016 - 01:52 PM

@Wonko the Sane
I've gone and read this article that you linked here.
http://reboot.pro/to...sults/?p=184060
In the 1st step you tell me to "copy to the root of the device a grldr (and it's menu.lst)".
I feel confused with the use of the word "root" in Windows but by looking at the boot.ini file you posted with "default=C:\grldr" I guess it's safe to assume we're talking about C:.
Also I would like to download the latest/best version of grub4dos. Could you please confirm if this is the best place to download an up-to-date grub4dos?
http://grub4dos.chenall.net/
If so, which version should I download? 0.4.6a? 0.4.5c? 0.4.5b? Etc.

I've just downloaded 0.4.6a from September and I can't find a grldr inside. What gives?

TIA

Cheers



#7 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 September 2016 - 02:24 PM

Yes, normally (but not necessarily) the boot partition gets drive letter C:.

In the case of a Windows 7, it may depend on HOW EXACTLY it has been installed.

If you install Windows 7 and partiion the disk manually , you will normally make a partition for the OS, and that partition will be BOTH "boot" and "system" and will contain the BOOTMGR and the \boot\BCD.

If you install Windows 7 on a unpartitioned disk it will make two partitions, the first (small) one (which is the "boot" partition, that MS calls "System") that will contain the BOOTMGR and the \boot\BCD that will be later hidden and given NOT a drive letter, the second (large) one (which is the "system" partition, i.e. the one where the Operating System files reside, that MS calls "Boot") will get (normally) a drive letter C:.

If you are in this case, you need to manually assign a drive letter to the boot partition to be able to copy to it the BOOT.INI file, the grldr and the menu.lst.

The "C:\" in "C:\grldr" (ask MS about this) actually means "<same volume where the BOOT.INI is>" :frusty:

So the BOOT.INI, grldr and menu.lst need to go on the same volume where BOOTMGR and \boot\BCD are (the active partition in the MBR).

 

About grub4dos on Chenall, you maybe :unsure: downloaded the Source (and not the compiled release) see:
http://reboot.pro/to...b4dos/?p=187114

 

Get latest 0.4.6a:
http://grub4dos.chen....6a-2016-09-20/

http://dl.grub4dos.c...a-2016-09-20.7z

 

Only if you have issues with it, get latest 0.4.5c:

http://grub4dos.chen....5c-2015-12-31/

http://dl.grub4dos.c...c-2015-12-31.7z

 

:duff:

Wonko


  • john3voltas likes this

#8 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 24 September 2016 - 02:48 PM

Wow!
So, my system seems to have been installed without any partitions on it. The word "seems" enters here because I didn't install the PC, it was the IT dept of the company I work for.
In such sense, Windows installer automatically created a 100MB "system" partition and a 490GB "boot" partition. Notice that I am now using the MS partition naming. ;-)
The IT team has apparently made some tweaking and split the "boot" partition into two 240GB partitions, one with the actual OS and the other one for loose data and "backups". How can someone call backups something that stays on the same hardware for weeks. Oh well...
In this scenario I have:
500GB sata drive
|
|__ 100MB (system - no drive letter)
|__ 250GB (boot - drive letter C:)
|__ 240GB (data/baks - drive letter D:)
 
So, where will I put my grldr/menu.lst/boot.ini?
Does it need to go into the 100MB system partition? If so, do I really need to give it a drive letter? I could easily boot linux, mount that partition and copy the files there.
If I really need to give it a drive letter to the system partition (lets say letter F: because E: is already taken by the dvd unit)  what happens with the boot.ini file?
default=C:\grldr
C:\grldr="grub4dos"
Do I need to change that into:
default=F:\grldr
F:\grldr="grub4dos"
I guess it would be a whole lot easier if every file related to grub4dos (grldr/menu.lst/boot.ini) could stay in the C: boot partition.

As for the missing grldr file, you're right, I was downloading the sources instead of the actual binary 7z file...
I think that website is not very easy to browse and I didn't pay enough attention to what I was doing. ;-)

#9 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 September 2016 - 04:34 PM

So, where will I put my grldr/menu.lst/boot.ini?
Does it need to go into the 100MB system partition? If so, do I really need to give it a drive letter? I could easily boot linux, mount that partition and copy the files there.

Yes, it needs to go on that 100 Mb partition (because that one is the partition that is booted and contains the BOOTMGR and \boot\BCD.

And no, you don' t *need* to assign a letter to it (it is only the way to copy those files under Windows, and in any case you would re-remove the letter afterwards) if you use Linux.

 

 


...  what happens with the boot.ini file?
default=C:\grldr
C:\grldr="grub4dos"

Any difficult part :unsure: in:

 

The "C:\" in "C:\grldr" (ask MS about this) actually means "<same volume where the BOOT.INI is>"  :frusty:

So the BOOT.INI, grldr and menu.lst need to go on the same volume where BOOTMGR and \boot\BCD are (the active partition in the MBR).

 

Seriously, leave it as is, it should work fine (more or less at the time the file is parsed the C:\ means "active partition", I know it does sound "strange" but more or less that entry corresponds to the way NTLDR was used to dual boot between NT 3.1 and DOS, it is some sort of historical setting ).

 

:duff:

Wonko


  • john3voltas likes this

#10 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 24 September 2016 - 08:58 PM

Excellent. I am already writing from linux dual booting with grub4dos. This thing is really amazing.

A couple of questions:

- I'd like to tidy up the files by leaving the boot.ini in the root of the system partition but moving menu.lst and grldr to a folder named grub4dos inside the system partition. Would that be possible? If so, what changes on boot.ini would I need to do?

- Also wondering if it's possible to cascade various menu.lst. That way I'd leave a menu.lst in the system partition just pointing to a menu.lst on the data/baks partition which is where I am going to be running the OSes. That way I could remove the drive letter from the system partition making it invisible again.

 

I have some other related questions but that I am still going to search first to see if they've already been answered. If they haven't been answered.

Thanks for all the help you guys have been giving me. This forum is just great. :-)

Cheers


Edited by john3voltas, 24 September 2016 - 09:00 PM.


#11 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 September 2016 - 08:51 AM

C:\myfolder\grldr="grub4dos"

 

BUT that will only chainload the grldr inside the \myfolder.

The path to menu.lst is hard coded inside grldr.

Open grldr with Wordpad (or from a Linux text editor) and check at the very end of it.

You will find something like:

 

 

pxe detect
configfile
default 0
timeout 1

title find /menu.lst, /boot/grub/menu.lst, /grub/menu.lst
errorcheck off
configfile /boot/grub/menu.lst
configfile /grub/menu.lst
if "%@root%"=="(ud)" && calc *0x82A0=*0x82b9&0xff
if "%@root:~1,1%"=="f" && find --set-root --devices=f /menu.lst && configfile /menu.lst
find --set-root --ignore-floppies --ignore-cd /menu.lst && configfile /menu.lst
find --set-root --ignore-floppies --ignore-cd /boot/grub/menu.lst && configfile /boot/grub/menu.lst
find --set-root --ignore-floppies --ignore-cd /grub/menu.lst && configfile /grub/menu.lst
configfile http://b.chenall.net/menu.lst
errorcheck on
commandline

title commandline
commandline

title reboot
reboot

title halt
halt

i.e. grldr has already an "embedded" menu.lst that looks for and attempts to load the "external" menu.lst.

You can modify that "tail" with your own menu.lst and have it look for the external menu.lst wherever you like.

And you have also just met the configfile command.





grub> help configfile 
 configfile: configfile FILE
     Load FILE as the configuration file.

BTW maybe there has been a misunderstanding, you can remove the drive letter assigned to the small boot partition alright and make it invisible, the letter assignment is only to be able to copy the files and edit them if needed.

 

There are some tools capable of editing the embedded menu.lst, but you will have to test them to see if they actually work with latest releases:

http://reboot.pro/to...ded-grldr-menu/

 

But you can use any editor, as long as it preserves when saving the earlier "binary" part.

Or "strip" the old menu and re-attach a new one...

 

Please also note that the menu.lst is looked for on all devices, as

\menu.lst

\boot\grub\menu.lst

\grub\menu.lst

and the first one found is loaded, so if you are okay to have it in any of the above paths, you can put it also on another volume, it will be found alright, and you will avoid modifying the grldr, the only difference might be that you will have an initial slight increase in time to load the menu, as the grldr will first scan the small boot partition before - not finding it there - attempt looking for it on the second one. 

 

:duff:

Wonko



#12 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 25 September 2016 - 02:58 PM

Hey Wonko.

Thanks for your tips.

I won't try to tweak the grldr into using my folder naming. That way I'd end up with a non-standard installation that wouldn't survive grub4dos updates without re-tweaking future grldr.

But the good news is that I can just use the 1st-level grub folder without tweaking the grldr. So, right now my boot.ini is in the root of the system partition and grldr/menu.lst are inside the grub folder and everything is working properly.

...that is, with booting windows and booting an ubuntu 16.04.1 livecd. But when I try to add persistence to the ubuntu iso through the initramfs options it fails miserably on me by simply booting without the persistence file mounted.

I will now open a new topic to see if someone can help me with this.

Thanks a lot for all the help you guys have been giving me.

Cheers

 

PS: is there a mark as solved here in the forum?


Edited by john3voltas, 25 September 2016 - 03:03 PM.


#13 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 25 September 2016 - 05:55 PM

To be picky, as I am BTW ;), you could have a further improvement.

 

From:

BOOTMGR

BOOT.INI

\boot <- you already have this one, as it contains the BCD

grldr

menu.lst

 

You went to:

BOOTMGR

BOOT.INI

\boot

\grub

 

If you use \boot\grub\ you save another entry in root:

 

BOOTMGR

BOOT.INI

\boot <- here you add the sub-directory \grub\ and in it grldr and menu.lst

 

:duff:

Wonko



#14 john3voltas

john3voltas

    Member

  • Members
  • 97 posts
  •  
    Portugal

Posted 25 September 2016 - 06:37 PM

Nah, I would never mix windows' boot directories with grub4dos' directories.

This way even if Microsoft ever runs an update on their bootloader I will have a better chance of grub4dos still working because they didn't erase it. :D







Also tagged with one or more of these keywords: run, hdd, linux, grub4dos

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users