0

I just changed /sda system disk in SW RAID using following steps, simply put:

sfdisk -d /dev/sdb | sfdisk /dev/sda
mdadm --manage /dev/md0 --add /dev/sda2

Now disk is initializing chcked by:

cat /proc/mdstat 

All looks fine

md0 : active raid1 sda2[2] sdb2[1]
      244056192 blocks super 1.2 [2/2] [UU]
      bitmap: 2/2 pages [8KB], 65536KB chunk

lsblk

sda                        8:0    0 232.9G  0 disk  
|-sda1                     8:1    0     9M  0 part  
`-sda2                     8:2    0 232.9G  0 part  
  `-md0                    9:0    0 232.8G  0 raid1 
    |-vg.system-lv.root  253:0    0    40G  0 lvm   /
    `-vg.system-lv.cache 253:1    0   160G  0 lvm   /mnt/cdn-cache
sdb                        8:16   0 232.9G  0 disk  
|-sdb1                     8:17   0     9M  0 part  
`-sdb2                     8:18   0 232.9G  0 part  
  `-md0                    9:0    0 232.8G  0 raid1 
    |-vg.system-lv.root  253:0    0    40G  0 lvm   /
    `-vg.system-lv.cache 253:1    0   160G  0 lvm   /mnt/cdn-cache

What iam worried about is: Is there GRUB installed on sda1? I checked cfdisk /dev/sda and sda1 is set as type BIOS boot. When i try to do

grub-install /dev/sda1 

i get error

grub-install: error: unable to identify a filesystem in hostdisk//dev/sda; safety check can't be performed.

Iam not really sure that way i am doing it is the right path, but iam sure that i need to make sure the server boots in case any of the 2 disks fails, it boots. So what would be the correct way to check/install grub on the new disk? I just updated initramfs, but i dont think thats all i need to do. The topic around grub is bit convoluted and all over the place and i cant pinpoint the "sure" way, as iam not facing any bug or unforeseen issue, just lack of exact knowledge.

0

Install GRUB as MBR-"wide" boot loader so just /dev/sda, not its partition.

  • Thank you now i see Installing for i386-pc platform. Installation finished. No error reported. So this is all, i was worried to install it on the disk as whole, the GRUB is anyway in the 9M part? it autodetcts where it should be stored? – J B Jan 3 at 15:40
  • It has some default settings described in its manual, but it's possible to customise (some of?) them as well. If you'd use GPT instead grub would require special boot partition with type 0xEF02. – poige Jan 3 at 15:48
  • @JB On a BIOS system, GRUB is installed along with the partition table at the very beginning of the whole disk. If you try to install GRUB on a disk that has no partition table, or an empty one, it fails the way you have experienced. Same thing if you install to a partition (I'm assuming your /dev/sda1 doesn't host a PT). However, the whole GRUB cannot fit into the small dedicated space in the PT, so a substantial part of the boot loader is installed after it, if MBR is used, or in a dedicated "BIOS boot" partition, if GPT is used. And yes, grub-install auto-detect this. – fra-san Jan 3 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.