Results 1 to 10 of 12

Thread: Grub 2 modifications

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Beans
    78

    Grub 2 modifications - Hide partitions in Grub 2

    Does anyone know how to "hide" a partition using Grub 2?

    http://grub.enbug.org/CommandList

    shows that 'hide' has now been replaced - Now a part of parttool

    What is parttool???

    I can't find anything on it.

    I have 2 windows installations, and 1 Ubuntu. When I am booted into one of the windows installations, I don't want it to be able to SEE the partition the other windows partition is on, and vice versa.

    Does anyone know how to do this with Grub 2????

    Thanks
    Last edited by GMHilltop; April 18th, 2010 at 11:52 PM. Reason: Title needs to be more specific to the post

  2. #2
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub 2 modifications

    Parttool is a command line tool for edit partition flags maybe other things.

    If you go into gparted and right click on the partition you can manage flags. Hidden is one of the flags but I have no idea what it does.
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.







  3. #3
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 modifications

    I have not used parttool in Grub2, but here is a quote from a BURG bug report. The user seems to be familiar with parttool and Grub2:
    I have a triple boot system set up (Ubuntu, Windows 7, Windows XP). When I boot into one of the windows-es, I have to hide the other's partition from it (for compatibility and security reasons). In grub2 I use the following commands:
    parttool (hd0,3) hidden+
    parttool (hd0,4) hidden-
    I would test them for you but don't currently have access to my dual-boot laptop.
    GRUB2

    Retired.

  4. #4
    Join Date
    Apr 2010
    Beans
    78

    Re: Grub 2 modifications

    Thank you, Thank you!

    That did the trick.

    For those who learn by seeing like I do, here is what I entered into my 40_custom file that is located in the /etc/grub.d/ directory:

    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the 'exec tail' line above.

    echo "Adding Windows OS to Grub 2 Menu"
    cat << EOF
    menuentry "Mom & Dads" {
    insmod chain
    insmod ntfs
    parttool (hd0,1) hidden-
    parttool (hd0,2) hidden+
    parttool (hd0,5) hidden-
    set root= (hd0,1)
    search --no-floppy --fs-uuid --set 9A7A430F7A42E819
    chainloader +1
    }

    menuentry "Kids Operating System" {
    insmod chain
    insmod ntfs
    parttool (hd0,2) hidden-
    parttool (hd0,1) hidden+
    parttool (hd0,5) hidden+
    set root= (hd0,2)
    search --no-floppy --fs-uuid --set 9A18464D18462919
    chainloader +1
    }

    menuentry "Ubuntu" {
    parttool (hd0,2) hidden-
    parttool (hd0,1) hidden-
    parttool (hd0,5) hidden-
    parttool (hd0,6) hidden-
    recordfail=1
    if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    set quiet=1
    insmod ext2
    set root=(hd0,3)
    search --no-floppy --fs-uuid --set 9a1e8016-a158-4e98-ae38-6da0fd528d9a
    linux /boot/vmlinuz-2.6.31-14-generic root=UUID=9a1e8016-a158-4e98-ae38-6da0fd528d9a ro quiet splash
    initrd /boot/initrd.img-2.6.31-14-generic
    }

    menuentry "Memory Test - Memtest86+" {
    linux16 /boot/memtest86+.bin
    }
    EOF

    FYI partition number 5 (hd0,5) is a partition that we have our stuff on, that I don't want the kids to be messing around with, so I have hidden it. Partition 6 (hd0,6) is theirs to save stuff on.

    I am still going to reorder stuff, but I needed to make it work first.

    In case anyone was wondering how I came up with the entry for the Ubuntu partition, I just opened the grub.cfg file and copied what was already written there and entered it into the 40_custom file . . . what can I say - it works, though some of it I don't understand. . . . I just wanted to be able to name it a little cleaner for the menu.

    Hope this helps others too.

  5. #5
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 modifications

    Thanks for sharing your solution.

    Explaining how and why you made it the way you did is very helpful, and using the 40_custom file makes it a simple way to get it into the Grub2 menu.

    When I find time I will try to incorporate your findings into the Grub2 Title Tweaks (with attribution of course). It's not really a title tweak but it's something that many users will find helpful.

    Edit: Done.
    Grub 2 Title Tweaks
    Last edited by drs305; April 19th, 2010 at 01:41 PM.
    GRUB2

    Retired.

  6. #6
    Join Date
    Jun 2009
    Location
    Chicago Suburbs
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub 2 modifications

    I do not think you want or need these lines in your 40_custom:

    echo "Adding Windows OS to Grub 2 Menu"
    cat << EOF

    I think they came from one original post or web site where the user was adding the lines to the file from a terminal.
    For info on UEFI boot install & repair:
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to close thread when/if answered completely.







Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •