Does Linux md-raid store backup metadata anywhere on the disk?
I know that with ext2/3/4 and other filesystems, copies of the superblock are stored throughout the disk in case the primary superblock is corrupted (https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout).
With md-raid (software raid), the superblock is stored either at the beginning or end of the disk, depending on which metadata version is used (https://raid.wiki.kernel.org/index.php/RAID_superblock_formats#Sub-versions_of_the_version-1_superblock)
Sub-Version | Superblock Position on Device |
---|---|
0.9 | At the end of the device |
1.0 | At the end of the device |
1.1 | At the beginning of the device |
1.2 | 4K from the beginning of the device |
Suppose there is a disk failure and the md superblock is corrupted. Does md-raid store a backup superblock anywhere on the disk?
(My guess would be "no", because this would require cooperation between md-raid and the filesystem. Filesystems have come a long way since raid support was added to Linux, so it seems plausible someone might have come up with a way to make this work).
Solution 1:
Your guess is only partially right: MDRAID does not store a backup superblock on the same disk, but the superblock on the other disks describe the same array geometry, effectively serving as a backup in the case a disk fails.
You can examine each disk superblock via mdadm -E /dev/your_disk
, while an array-wide description can be dumped via mdadm -D /dev/md_array