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

Re: grub-install problem after trixie upgrade



Hi,

On Mon, Aug 11, 2025 at 02:13:42AM +0100, Alain D D Williams wrote:
> I have a clue ... If I run on the 2 disks "fdisk -l" I see a difference in
> layout that I had not noticed before. The start of partition 1 is not in the
> same place. On sda it is at 64 (not 2048) which might be the "short MBR gap":
> 
> sda:
> Device     Boot      Start        End    Sectors  Size Id Type
> /dev/sda1  *            64    1024063    1024000  500M fd Linux raid autodetect
> /dev/sda2          1024064 4294961684 4293937621    2T fd Linux raid autodetect
> /dev/sda3       4294963200 7814035455 3519072256  1.6T fd Linux raid autodetect
> 
> sdb:
> Device     Boot      Start        End    Sectors  Size Id Type
> /dev/sdb1  *          2048    1026047    1024000  500M fd Linux raid autodetect
> /dev/sdb2          1026048 4294961684 4293935637    2T fd Linux raid autodetect
> /dev/sdb3       4294963200 7814035455 3519072256  1.6T fd Linux raid autodetect
> 
> So ... on sda I could delete partition 1 so that it starts at 2048, but there
> is not enough room as the start of partition 2 is closer to the start of disk,
> so I would need to make it smaller on sdb as well.

You don't need /boot to be a separate partition and grub can read MD
RAID-1 so you could "just":

 0. Have backups
 1. Copy contents of /boot/ to /tmp/boot/
 2. Unmount /boot/
 3. mdadm --stop /dev/md0
 4. wipefs -a /dev/sda1
 5. wipefs -a/dev/sdb1
 6. Remove /boot from /etc/fstab
 7. Delete sda1 and sdb1 partitions
 8. mkdir /boot
 9. Copy /tmp/boot/ to /boot/ (now a part of your root fs)
10. grub-install /dev/sda
11. grub-install /dev/sdb

Not sure if update-grub is needed as well but won't harm anything to do
that.

Alternatively if you can find a way to shrink the filesystem and RAID
for sd{a,b}3 you could make an sd{a,b}4 and a new MD device there for
/boot, as /boot does not need to be at the start of the disk. Depending
on what you've done with sd{a,b}3 you might not be able to do this one
without booting into a live/rescue system.

As ypu say you could fail out all partitions on sda. Remove all those
partitions then wipefs the sda disk before creating new ones that match
sdb and add them back into each RAID. Has the advantage of all being
done online pretty straightforward. Disadvantage of leaving you with a
500M /boot but I think you'll push the problem quite far down the road
even if the recommendation is now 768M. Don't forget to grub-install
/dev/sda afterwards!

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: