Score:4

Does Linux md-raid store backup metadata anywhere on the disk?

us flag

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).

Score:10
ca flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.