Jump to content











Photo
- - - - -

Exclude drives from find output in Grub4DOS


  • Please log in to reply
7 replies to this topic

#1 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 22 October 2016 - 05:56 PM

Hi guys. For the sake of our discussion, say I have two operating systems: one installed on first fixed HDD, and one installed on my portable USB drive. I want to chainload bootmgr from the fixed drive using the find --set-root command.

 

For instance:

find --set-root /windows/boot/pcat/bootmgr

The above command will find my USB drive first and it will chainload to it rather than finding my fixed drive.

Is there someway to exclude my USB drive from the search? Or is there another possibility of doing what I need in a different way?

 

Thank you!



#2 steve6375

steve6375

    Platinum Member

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

Posted 23 October 2016 - 01:22 PM

The usual way is to use find to look for a tag file on the disk that you want to find...

find --set-root /hdd.tag

If you have booted from a USB drive it will be hd0, so another way is to map out the USB drive by mapping a ramdrive there instead...

e.g.

map (rd) (hd0)
map --hook
find --set-root /windows/boot/pcat/bootmgr
map --unhook

  • Uneitohr likes this

#3 steve6375

steve6375

    Platinum Member

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

Posted 07 January 2017 - 02:07 PM

P.S. A feature of the grub4dos find command is that it always look in the current root drive first (even if you specify different devices using --devices=xyz).

 

If you don't want it looking at the current root device first, try setting the root to something invalid...

rootnoverify (rd)
find --set-root --devices=cfh /myfile.txt

  • Uneitohr likes this

#4 steve6375

steve6375

    Platinum Member

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

Posted 08 January 2017 - 04:38 PM

P.S.

# Ignore boot device and boot to Windows XP, Vista, 7 or 8 from the internal hard disk
# This works by mapping the boot device (bd) which may have bootmgr or ntldr on it, to a virtual memory drive so that files on it are not found by the find command
title Boot to Windows from an 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


  • Uneitohr likes this

#5 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 08 January 2017 - 07:33 PM

I like the idea of mapping the (bd) to something else :), but wouldn't:

map --unhook

do instead of:
 

map (bd) (bd)
map --rehook

:dubbio:

 

Also, it seems to me that newish (0.4.6a) versions of grub4dos somehow do not list floppies already :unsure:, but in any case:

find --set-root --ignore-floppies --ignore-cd

wouldn't be "easier" as:
 

find --devices=h --set-root

:duff:

Wonko 


  • Uneitohr likes this

#6 steve6375

steve6375

    Platinum Member

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

Posted 08 January 2017 - 10:26 PM

map --unhook would undo all previous mappings (e.g. isos mapped to (0xff) or image mapped to a (fd), etc. by the user)


  • Uneitohr likes this

#7 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 09 January 2017 - 10:42 AM

map --unhook would undo all previous mappings (e.g. isos mapped to (0xff) or image mapped to a (fd), etc. by the user)

I see, so if there is no mapping one can use unhook, but not if other mappings were made before :).

 

:duff:

Wonko


  • Uneitohr likes this

#8 Uneitohr

Uneitohr

    Frequent Member

  • Advanced user
  • 219 posts

Posted 10 January 2017 - 06:19 PM

P.S.

# Ignore boot device and boot to Windows XP, Vista, 7 or 8 from the internal hard disk
# This works by mapping the boot device (bd) which may have bootmgr or ntldr on it, to a virtual memory drive so that files on it are not found by the find command
title Boot to Windows from an 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

 

Beautiful piece of code, Steve.

Thank you.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users