[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to safely switch grub booting in-place from one drive to a repla
From: |
Andrei Borzenkov |
Subject: |
Re: How to safely switch grub booting in-place from one drive to a replacement with RAID? |
Date: |
Thu, 23 Feb 2017 18:30:15 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
23.02.2017 05:59, address@hidden пишет:
> Hi,
>
> I have a linux machine running grub2.
>
> It's got one drive, partitioned as
>
> fdisk -l /dev/sda
> ...
> Device Boot Start End Sectors Size Id Type
> /dev/sda1 * 2048 2099199 2097152 1G 83 Linux
> /dev/sda2 2099200 1953525167 1951425968 930.5G 8e Linux
> LVM
>
> I want to switch the system to a RAID-1 array. Doing it as much as possible
> in-place.
>
> I added two drives, partitioned them them same, and assembled them into a
> RAID ARRAY
>
> fdisk -l /dev/sd[bc]
> ...
> Device Boot Start End Sectors Size Id Type
> /dev/sdb1 * 2048 2099199 2097152 1G 83 Linux
> /dev/sdb2 2099200 1953525167 1951425968 930.5G 8e Linux
> LVM
> ...
> Device Boot Start End Sectors Size Id Type
> /dev/sdc1 * 2048 2099199 2097152 1G 83 Linux
> /dev/sdc2 2099200 1953525167 1951425968 930.5G 8e Linux
> LVM
>
>
> cat /proc/mdstat
> Personalities : [raid1] [linear] [multipath] [raid0] [raid6]
> [raid5] [raid4] [raid10]
> md0 : active raid1 sdc1[1] sdb1[0]
> 1047552 blocks super 1.2 [2/2] [UU]
> bitmap: 0/1 pages [0KB], 65536KB chunk
>
> md1 : active raid1 sdb2[1] sda2[0]
> 975581888 blocks super 1.2 [2/2] [UU]
> bitmap: 2/8 pages [8KB], 65536KB chunk
>
> unused devices: <none>.
>
> Right now the system's booted from the 1st, single drive.
>
> I rsynced over all my data from the single drive, to similar partitions on
> the array.
>
> I know I need to set up grub2 correctly to boot from the array.
>
> I built new systems before directly onto an array and grub just got taken
> care of by the installer. But I never switched from one set of drives to
> another yet.
>
> What commands do I need to run in grub2 to SWITCH from the single drive to
> the RAID array?
>
> I want to be sure that when I reboot it reboots correcly from the new array
> only , and then I can unplug the first drive. And I'd like to avoid getting
> stuck in the grub "shell" which gave me nightmares awhile go :-{.
>
With /boot/grub on Linux MD you can install grub2 in MBR only. Run
grub-install (or grub2-install depending on your distribution) twice for
each disk
grub-install /dev/sda
grub-install /dev/sdb
You will also need to configure your distribution to use these locations
by default, so it automatically writes new version of grub into correct
location(s) during package update. How to do it is distribution-dependent.
You may also want to recreate grub.cfg as well.
Re: How to safely switch grub booting in-place from one drive to a replacement with RAID?, Xen, 2017/02/23