0

Background

I am setting up a server with software RAID1. This includes the /boot partition being mirrored (mapped to md0). My aim is that if one of the two hard drives containing the OS (sdc and sdd) were to fail, I would still be able to boot using grub2.

The Issue

I have tested my current setup by removing one of the hard drives physically. When I do this I am unable to boot as grub is looking for the md0 partition which seems to only be available when both drives are present and working. Here is the error message:

Volume group "vg_testfs" not found
Cannot process volume group vg_testfs
lvmetad is not active yet, using direct activation during sysinit
Cannot process volume group vg_testfs

WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
Reading all physical volumes. This may take a while...
/run/lvm/lvmetad.socket: connect failed: no such file or directory.

What I attempted

After reading through some documentation I attempted creating the following script file which didn't work after running grub-update:

cat /etc/grub.d/11_recovery1

#!/bin/sh -e
echo "Adding recovery 1"
cat << EOF
menuentry "recovery 1 - bootable when 1 disk fails" {
set root=(hd0,1)
linux /boot/vmlinuz root=/dev/sdc1
initrd /boot/initrd.img 
}
EOF

Potential Solutions

I am wondering if it is possible to configure grub to have additional entries to boot into a single software RAIDed drive when the other is not present. If not, should I just build the system from scratch without utilising RAID1 for the /boot partition, and instead have seperate grub files on each of the drives /boot partitions?

I have never used grub before and am finding it challenging to know where to begin! Any help would be much appreciated. Thanks

More Information

lsblk -f

NAME                      FSTYPE            LABEL    UUID                                   MOUNTPOINT
sda                                                                                         
sdb                                                                                         
sdc                                                                                         
├─sdc1                    linux_raid_member testfs:0 4efe8212-0000-0000-0000-000000000001   
│ └─md0                   ext4                       04d5c4d4-0000-0000-0000-000000000002   /boot
├─sdc2                                                                                      
└─sdc5                    linux_raid_member testfs:1 7d1b235d-0000-0000-0000-000000000003   
  └─md1                   crypto_LUKS                41e69905-0000-0000-0000-000000000004   
    └─md1_crypt           LVM2_member                7wHoCZ-0000-0000-0000-00000000000005 
      ├─vg_testfs-lv_swap swap                       8112ce83-0000-0000-0000-000000000006   [SWAP]
      └─vg_testfs-lv_root ext4                       bbe5d21b-0000-0000-0000-000000000007   /
sdd                                                                                         
├─sdd1                    linux_raid_member testfs:0 4efe8212-0000-0000-0000-000000000001   
│ └─md0                   ext4                       04d5c4d4-0000-0000-0000-000000000002   /boot
├─sdd2                                                                                      
└─sdd5                    linux_raid_member testfs:1 7d1b235d-0000-0000-0000-000000000003   
  └─md1                   crypto_LUKS                41e69905-0000-0000-0000-000000000004   
    └─md1_crypt           LVM2_member                7wHoCZ-0000-0000-0000-00000000000005 
      ├─vg_testfs-lv_swap swap                       8112ce83-0000-0000-0000-000000000006   [SWAP]
      └─vg_testfs-lv_root ext4                       bbe5d21b-0000-0000-0000-000000000007   /

fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdc: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3c424eec

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdc1  *      2048    976895    974848   476M fd Linux RAID autodetect
/dev/sdc2       978942 234452991 233474050 111.3G  5 Extended
/dev/sdc5       978944 234452991 233474048 111.3G fd Linux RAID autodetect


Disk /dev/sdd: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x33a774c6

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdd1  *      2048    976895    974848   476M fd Linux RAID autodetect
/dev/sdd2       978942 234452991 233474050 111.3G  5 Extended
/dev/sdd5       978944 234452991 233474048 111.3G fd Linux RAID autodetect


Disk /dev/md0: 475.7 MiB, 498794496 bytes, 974208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md1: 111.3 GiB, 119471603712 bytes, 233342976 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/md1_crypt: 111.3 GiB, 119469506560 bytes, 233338880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_testfs-lv_swap: 11.2 GiB, 11999903744 bytes, 23437312 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg_testfs-lv_root: 100.1 GiB, 107466457088 bytes, 209895424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
  • What Linux distribution is this? Were you asked to decrypt your volumes when you booted? – Michael Hampton Jan 18 '18 at 1:05
  • OS: ubuntu-16.04.2-server-amd64. When both drives are present, yes I am asked to enter a password. "Please unlock disk md1_crypt:" prompt on boot – GustavMahler Jan 18 '18 at 1:08
  • 1
    Those aren't grub messages. Grub has booted your system and now something appears to be wrong with LVM. – psusi Jan 18 '18 at 1:30
  • Ah, I'll look into LVM. Any pointers as to what in particular I should research to solve this? – GustavMahler Jan 18 '18 at 1:39

Your Answer

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

Browse other questions tagged or ask your own question.