How to ignore a particular hd within the 'find' command
#1
Posted 03 October 2012 - 04:50 PM
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr
to load windows but I need grub4dos to skip hd0 because there is a bootmgr there. The correct bootmgr is on another disk.
Is there a way to do this?
I already tried --ignore-hd0 but no joy.
#2
Posted 03 October 2012 - 05:09 PM
I'm trying to use the command
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr
to load windows but I need grub4dos to skip hd0 because there is a bootmgr there. The correct bootmgr is on another disk.
Is there a way to do this?
I already tried --ignore-hd0 but no joy.
If I may, it is the approach that is IMHO - and no offence intended - wrong.
You "search" if you do not already know where something is (or how you can easily identify it).
There are TWO easy ways to identify a Volume/partition in grub4dos, using a "unique" "tag file" or using UUID (which is actually unique).
Read the grub4dos read_me to learn more, and/or see:
http://reboot.pro/4799/
http://www.911cd.net...ndpost&p=169150
http://reboot.pro/14640/
Other (IMHO UNneededly complex) solution on the doubled thread:
http://reboot.pro/17588/
Wonko
#3
Posted 03 October 2012 - 06:33 PM
The page was stuck so I pressed 'Post' again and it created another thread.
Sorry.
Is there a way to delete one of the threads?
Apologies.
Wonko, I only know that hd0 is the one I don't want. Then the boot file could be in 'hd1,0', 'hd1,1', etc. and I cannot change these drives so the tag won't do. That said, one temporary remedy might be to find a useless file that is present in both xp and win7 and delete it from hd0.
#4
Posted 03 October 2012 - 07:32 PM
Maybe you can exchange drives.Wonko, I only know that hd0 is the one I don't want. Then the boot file could be in 'hd1,0', 'hd1,1', etc. and I cannot change these drives so the tag won't do. That said, one temporary remedy might be to find a useless file that is present in both xp and win7 and delete it from hd0.
What happens if you do:
map (hd0) (hd15) map (hd1) (hd0) map --hook find --set-root /bootmgr
Wonko
#5
Posted 03 October 2012 - 08:11 PM
'map (hd0) (hd15)' alone did the trick.
#6
Posted 04 October 2012 - 03:26 AM
(hd0) (hd15)map
Good invention/innovation.
'map (hd0) (hd15)' alone did the trick.
It should NOT work for you.
"map (hd0) (hd15)" will only create a new virtual drive (hd15) which is a duplicate of (hd0). Note that the original (hd0) will be untouched and still there. So the the next find command will find your bootmgr on (hd0).
Perhaps sometimes you need this
map --mem (md)+8 (hd0) <---------- simply map a useless/invalid (hd0) in memory.
map --hook <-------------- now (hd0) is the virtual drive in memory.
find --set-root --ignore-floppies --ignore-cd /bootmgr <-------------- find will find nothing on the virtual (hd0).
map (hd0) (hd0) <------------ this will unmap (hd0) and restore the original real (hd0) of BIOS.
map --rehook <-------- (hd0) is now actually restored to its original state.
or in this way:
map --disable-chs-mode --disable-lba-mode (hd0) (hd0) <----------- this will disable access to (hd0).
map --hook <------- now (hd0) is virtual and read/write access to (hd0) will result in failure.
find --set-root --ignore-floppies --ignore-cd /bootmgr <-------------- find will find nothing on the virtual (hd0).
map (hd0) (hd0) <------------ this will unmap (hd0) and restore the original real (hd0) of BIOS.
map --rehook <-------- (hd0) is now actually restored to its original state.
#7
Posted 04 October 2012 - 08:17 AM
this way you have "two times" (hd1) (once mapped as 0 and one the "original 1")map (hd0) (hd15)
map (hd1) (hd0)
The approach by tinybit sounds "better" to me. as after the set of commands the correct root is established but the drive mapping is exactly as it was originally.
The suggestion/request for a "SHIFT" (disks) command still stands, however:
http://reboot.pro/8498/
I presume that now that we have batch capabilities in grub4dos it is possible to "fake it" with a subroutine...
@tinybit
is the rehook needed or is it just "formally more correct" (and a second "hook" is OK?)
Wonko
#8
Posted 04 October 2012 - 10:45 AM
This approach works well!map --mem (md)+8 (hd0) <---------- simply map a useless/invalid (hd0) in memory.
map --hook <-------------- now (hd0) is the virtual drive in memory.
find --set-root --ignore-floppies --ignore-cd /bootmgr <-------------- find will find nothing on the virtual (hd0).
map (hd0) (hd0) <------------ this will unmap (hd0) and restore the original real (hd0) of BIOS.
map --rehook <-------- (hd0) is now actually restored to its original state.
for a more generic case (hd, zip or floppy or cd boot)
title Boot to Windows from internal hard disk map --mem (md)+8 (bd) map --hook find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr map (bd) (bd) map --rehook chainloader /bootmgr || chainloader /ntldr
#9
Posted 04 October 2012 - 12:46 PM
is the rehook needed or is it just "formally more correct" (and a second "hook" is OK?)
in the above code, rehook can be replaced with hook for later grub4dos versions.
But with some early grub4dos versions, the second hook might fail since it already get hooked.
The suggestion/request for a "SHIFT" (disks) command still stands, however: http://reboot.pro/8498/ I presume that now that we have batch capabilities in grub4dos it is possible to "fake it" with a subroutine...
Sorry I really did not keep track of chenall's work and I think it is possible that chenall might have done it in a way(?), hopefully.
#10
Posted 04 October 2012 - 02:04 PM
Yep , though by now everyone should be using "newish" versions the "right" syntax is always good.But with some early grub4dos versions, the second hook might fail since it already get hooked.
I have found no traces of something like that, but the documentation is not at all easy to find (even is actually existing).Sorry I really did not keep track of chenall's work and I think it is possible that chenall might have done it in a way(?), hopefully.
Wonko
#11
Posted 14 October 2012 - 09:20 PM
All other suggestions worked fine too, thanks.
Also I found another that was supposed to do this:
find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr || rootnoverify (hd0) && chainloader +1 && boot map () (hd0) && map (hd0) () && map --rehook find --set-root --devices=h /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr chainloader /bootmgr || chainloader /ntldr
but I guess it must be for an older version as '--devices' is not on the command list.
Edited by rfloubo, 14 October 2012 - 09:21 PM.
#12
Posted 15 October 2012 - 12:08 PM
Sometimes reading readme_grub4dos.txt may help:but I guess it must be for an older version as '--devices' is not on the command list.
******************************************************************************
*** Conditional find ***
******************************************************************************
The new find syntax allows to find a device conditionally.
find [OPTIONS] [FILENAME] [CONDITION]
CONDITION is a normal grub command which returns TRUE or FALSE.
OPTIONS:
--set-root set the current root device.
--set-root=DIR set current root device and working directory to DIR.
please also see "Notation For The Current Root Device".
--ignore-cd skip search on (cd).
--ignore-floppies bypass all floppies.
--devices=DEVLIST specify the search devices and order.
DEVLIST u->(ud)
n->(nd)
p->(pd)
h->(hdx)
c->(cd)
f->(fdx)
default: upnhcf
Example 1:
find
This will list all partitions, all floppies and the (cd).
Example 2:
find +1
This will list all devices with a known filesystem.
Example 3:
find checkrange 0xAF parttype
This will list all partitions with ID=0xAF.
Example 4:
find /ntldr checkrange 0x07 parttype
This will list all partitions with ID=0x07 and existing /ntldr.
Example 5:
find --set-root /ntldr
This will set the first device it finds to current root device.
Example 6:
find --set-root --devices=h /bootmgr
Same of Example 5.but search on hard disk only.
Example 7:
find --set-root --devices=h makeactive --status
This will set current root device to first active partition.
Wonko
#13
Posted 21 October 2012 - 05:19 PM
I have now succeded with a different version I found somewhere with different capabilities. grldr is 265KB but I don't know its version. 0.4.4 is 212KB
#14
Posted 21 October 2012 - 05:32 PM
Since a LOT of time:
http://reboot.pro/14/
http://reboot.pro/14..._25#entry133739
the reference is ALWAYS (unless expressly stated differently) LATEST grub4dos (non-ALPHA, non-TestOnly) by chenall :
http://code.google.c.../downloads/list
Version of grub4dos (besides in the name of the zip/7z) is shown when booting in top of screen.
Wonko
#15
Posted 21 October 2012 - 06:26 PM
Googling grub4dos goes to the 0.4.4 dead end but the East seems indeed to be the trend thanks also to chenall .
Edited by rfloubo, 21 October 2012 - 06:26 PM.
#16
Posted 21 October 2012 - 06:54 PM
Well, the hours are not bad, it's the actual minutes that are pretty lousy, except some of the shouting that I quite like :Alright. Alright. I may not be in the loop but I can hear perfectly fine, thank you.
Googling grub4dos goes to the 0.4.4 dead end but the East seems indeed to be the trend thanks also to chenall .
http://www.clivebank...HGTTGradio2.htm
JFYI, since day one grub4dos "comes from the East" besides current "main" developer chenall, previous devopers/contributors, tinybit (former "main" developer), climbing, bean123 are all coming from China (sorry if I omitted listed any other of the good guys that contributed and contributes to grub4dos ).
Wonko
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users