Jump to content











Photo
- - - - -

How to ignore a particular hd within the 'find' command


  • Please log in to reply
15 replies to this topic

#1 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 03 October 2012 - 04:50 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.

#2 Wonko the Sane

Wonko the Sane

    The Finder

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

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/


:cheers:
Wonko

#3 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 03 October 2012 - 06:33 PM

Oh blasted!
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 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 03 October 2012 - 07:32 PM

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.

Maybe you can exchange drives.
What happens if you do:

map (hd0) (hd15)

map (hd1) (hd0)

map --hook

find --set-root /bootmgr

:unsure:

:cheers:
Wonko

#5 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 03 October 2012 - 08:11 PM

Thanks Wonko : ).
'map (hd0) (hd15)' alone did the trick.

#6 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

Posted 04 October 2012 - 03:26 AM

map (hd0) (hd15)



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 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 04 October 2012 - 08:17 AM

Yes, it doesn't sound "right", you should need both the:

map (hd0) (hd15)
map (hd1) (hd0)

this way you have "two times" (hd1) (once mapped as 0 and one the "original 1")

The approach by tinybit sounds "better" to me. :thumbsup: 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?)

:cheers:
Wonko

#8 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 October 2012 - 10:45 AM

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.

:good: This approach works well!

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 tinybit

tinybit

    Gold Member

  • Developer
  • 1175 posts
  •  
    China

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 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 04 October 2012 - 02:04 PM

But with some early grub4dos versions, the second hook might fail since it already get hooked.

Yep :), though by now everyone should be using "newish" versions the "right" syntax is always good.

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.

I have found no traces of something like that, but the documentation is not at all easy to find (even is actually existing).

:cheers:
Wonko

#11 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 14 October 2012 - 09:20 PM

You were right. 'map (hd0) (hd15)' alone was not enough indeed. I accidentally changed another command that pointed to hd1.
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 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 15 October 2012 - 12:08 PM

but I guess it must be for an older version as '--devices' is not on the command list.

Sometimes reading readme_grub4dos.txt may help:

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



:cheers:
Wonko

#13 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 21 October 2012 - 05:19 PM

Well spoted Wonko. Which version is that? The 0.4.4 readme doesn't have that. There is a newer one out there, isn't there?

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 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 21 October 2012 - 05:32 PM

Are you JOKING or WHAT? :unsure:

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

:cheers:
Wonko

#15 rfloubo

rfloubo

    Member

  • Members
  • 37 posts
  •  
    United Kingdom

Posted 21 October 2012 - 06:26 PM

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

Edited by rfloubo, 21 October 2012 - 06:26 PM.


#16 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 21 October 2012 - 06:54 PM

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

Well, the hours are not bad, it's the actual minutes that are pretty lousy, except some of the shouting that I quite like ;):
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 :blush:).

:cheers:
Wonko




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users