help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safely removing unused Grub2 from MBRs & boot sectors, veirfying sti


From: Andrei Borzenkov
Subject: Re: Safely removing unused Grub2 from MBRs & boot sectors, veirfying still bootable?
Date: Sun, 16 Apr 2017 08:27:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

15.04.2017 22:33, address@hidden пишет:
> Now that I've got *install* figure out, and an upgraded BIS that reports my 
> system info correctly ...
> 
> I want to remove Grub2 from a couple of places on a system.  After reading a 
> bunch of 3rd party posts about it I'm 100% sure it's possible to BADLY screw 
> this up.
> 
> So I'm gonna <noob>ASK!</noob> here.
> 
> My system runs Grub2.  The OS is on a RAID-1 array.
> 
>       cat /proc/mdstat
>               Personalities : [raid1] 
>               md0 : active raid1 sdc1[1] sda1[0]
>                     1048512 blocks super 1.0 [2/2] [UU]
>                     bitmap: 0/1 pages [0KB], 65536KB chunk
> 
>               md1 : active raid1 sda2[0] sdc2[1]
>                     487205888 blocks super 1.2 [2/2] [UU]
>                     bitmap: 3/4 pages [12KB], 65536KB chunk
> 
> I've also got an additional drive used for LVM mounts.
> 
> I want to LEAVE Grub2 installed in the MBRs for the raid disks, /dev/sda & 
> /dev/sdc
> 
> I want to REMOVE Grub2 from:
> 
>       -- the boot sectors of the raid disks' partitions, /dev/sda1 & /dev/sdc1
>       -- the MBR of the nonOS, additional drive, /dev/sdb
> 

Did you install it there yourself? Check
/etc/default/grub_installdevice, this is where openSUSE keeps bootloder
location(s).

> And,  most importantly, I want to make sure that the system still boots 
> after, using "just" the MBR-installed Grub info on the RAID disks.
> 
> What's the recommended process for removing that unused data and verifying 
> that I'll still be bootable?
> 
> JerryG
> 
> Fyi, 'bootinfoscript' currently reports
> 
>       cat ~/RESULTS.txt 
>                                 Boot Info Script 0.76      [13 April 2017]
> 
> 
>               ============================= Boot Info Summary: 
> ===============================
> 
>                => Grub2 (v2.00) is installed in the MBR of /dev/sda and looks 
> at sector 1 of 
>                   the same hard drive for core.img. core.img is at this 
> location and looks 
>                   for (mduuid/f36d5988500d33cd1434cb8824a14c13)/grub2. It 
> also embeds 
>                   following components:
>                   
>                   modules
>                   
> ---------------------------------------------------------------------------
>                   fshelp ext2 part_msdos diskfilter mdraid1x biosdisk
>                   
> ---------------------------------------------------------------------------
>                => Grub2 (v2.00) is installed in the MBR of /dev/sdb and looks 
> at sector 1 of 
>                   the same hard drive for core.img. core.img is at this 
> location and looks 
>                   for (mduuid/f36d5988500d33cd1434cb8824a14c13)/grub2. It 
> also embeds 
>                   following components:
>                   
>                   modules
>                   
> ---------------------------------------------------------------------------
>                   fshelp ext2 part_msdos diskfilter mdraid1x biosdisk
>                   
> ---------------------------------------------------------------------------
>                => Grub2 (v2.00) is installed in the MBR of /dev/sdc and looks 
> at sector 1 of 
>                   the same hard drive for core.img. core.img is at this 
> location and looks 
>                   for (mduuid/f36d5988500d33cd1434cb8824a14c13)/grub2. It 
> also embeds 
>                   following components:
>                   
>                   modules
>                   
> ---------------------------------------------------------------------------
>                   fshelp ext2 part_msdos diskfilter mdraid1x biosdisk
>                   
> ---------------------------------------------------------------------------
> 

You apparently have GRUB installed in all existing MBR and it looks like
it is the same instance (at least it looks for the same /boot/grub) so
partition boot record should be irrelevant, as it is not used by GRUB in
this configuration unless you yourself explicitly chainload it.

>               sda1: 
> __________________________________________________________________________
> 
>                   File system:       linux_raid_member
>                   Boot sector type:  Grub2 (v1.99-2.00)
>                   Boot sector info:  Grub2 (v1.99-2.00) is installed in the 
> boot sector of 
>                                      sda1 and looks at sector 290367 of the 
> same hard drive 
>                                      for core.img, but core.img can not be 
> found at this 
>                                      location.
> 
>               sda2: 
> __________________________________________________________________________
> 
>                   File system:       linux_raid_member
>                   Boot sector type:  -
>                   Boot sector info: 
> 
>               sdb1: 
> __________________________________________________________________________
> 
>                   File system:       LVM2_member
>                   Boot sector type:  -
>                   Boot sector info: 
> 
>               sdc1: 
> __________________________________________________________________________
> 
>                   File system:       linux_raid_member
>                   Boot sector type:  Grub2 (v1.99-2.00)
>                   Boot sector info:  Grub2 (v1.99-2.00) is installed in the 
> boot sector of 
>                                      sdc1 and looks at sector 290367 of the 
> same hard drive 
>                                      for core.img, but core.img can not be 
> found at this 
>                                      location.
> 
>               sdc2: 
> __________________________________________________________________________
> 
>                   File system:       linux_raid_member
>                   Boot sector type:  -
>                   Boot sector info: 
> 
>               md1: 
> ___________________________________________________________________________
> 
>                   File system:       LVM2_member
>                   Boot sector type:  -
>                   Boot sector info: 
> 
>               md0: 
> ___________________________________________________________________________
> 
>                   File system:       ext4
>                   Boot sector type:  Grub2 (v1.99-2.00)
>                   Boot sector info:  Grub2 (v1.99-2.00) is installed in the 
> boot sector of 
>                                      md0 and looks at sector 290367 of the 
> same hard drive 
>                                      for core.img, but core.img can not be 
> found at this 
>                                      location.
>                   Operating System:  
>                   Boot files:        /grub2/grub.cfg /grub2/i386-pc/core.img
> 

I presume that at some point sda1 or sdc1 had GRUB installed in
partition, then were converted to Linux MD thus replicating partition
boot block. Boot block most likely points into partition (you
"helpfully" show only partial information) and since then core.img was
obviously re-created multiple times so this location is no more valid.

As you have ext4 which reserves the first block you can simply overwrite it:

dd if=/dev/zero of=/dev/md0 conv=notrunc count=1 bs=512

This will zero out both mirror pieces.

In principle you do not need to do it - this partition boot block does
not really hurt in any way, as long as you do not attempt to actually
use it.

As for sdb - you can simple remove MBR code if you want

dd if=/dev/zero of=/dev/sdb conv=notrunc bs=1 count=440

this won't remove core.img from the following blocks, but then again, it
does not really do harm to have it there.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]