Missing RAID 6 array + LVM volume after hard reboot
After a restart which stalled, I did a hard reboot and now mdadm can't see the RAID 6 array anymore, LVM can't find the volume which was on that raid array. I have looked into /etc/mdadm/mdadm.conf
, it doesn't contain my /dev/md2
(the RAID 6 array).
How can I restore the RAID 6 array and then the LVM volume without losing any data?
OK, so I did an mdadm --assemble --scan
and it re-assembled /dev/md2
, but it missed one of the drives. The missing drive seems to have been added to a new, inactive array:
md_d2 : inactive sdb1[3](S)
1953511936 blocks
Going to remove it now and add manually to /dev/md2
.
Still not sure about the missing LVM group & volume...
OK, after re-assembling the array, I got the LVM back:
root@freetunes:~# pvdisplay
--- Physical volume ---
PV Name /dev/md2
VG Name lvm-raid
PV Size 5.46 TiB / not usable 43.50 MiB
Allocatable yes (but full)
PE Size 256.00 MiB
Total PE 22356
Free PE 0
Allocated PE 22356
PV UUID sJxydW-lMTJ-fsQn-Bln1-z6Cj-Dt6F-OPxMtr
root@freetunes:~# lvdisplay
--- Logical volume ---
LV Name /dev/lvm-raid/lvm0
VG Name lvm-raid
LV UUID D7Wj1A-wiJk-NxlM-IDdH-0uM4-aF1r-Fbpjjr
LV Write Access read/write
LV Status available
# open 0
LV Size 5.46 TiB
Current LE 22356
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 1536
Block device 251:0
Solution 1:
Are you relying on the kernel to auto-assemble the array for you? If so, double check that the volumes on ALL of the drives are set to the proper type. That's 0xfd for msdos partition tables or the raid flag for gpt tables. Here are example of each partition type properly setup for auto-assembly.
# parted /dev/sda
GNU Parted 1.8.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA INTEL SSDSA2M080 (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 4194kB 273MB 268MB primary ext3 boot, raid
2 273MB 80.0GB 79.8GB primary raid
# parted /dev/sda
GNU Parted 2.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA WDC WD20EADS-32R (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 262kB 1074MB 1074MB ext3 boot raid
2 1074MB 35.4GB 34.4GB linux-swap(v1) swap raid
3 35.4GB 104GB 68.7GB ext4 root raid
4 104GB 2000GB 1896GB vg00 raid