RAID superblock formats
From Linux Raid Wiki
(Difference between revisions)
(Add Sub-Version information for version-1 superblocks) |
|||
Line 3: | Line 3: | ||
They are known as v0.9 and v1.x Superblock formats. | They are known as v0.9 and v1.x Superblock formats. | ||
− | The | + | The "version-1" Superblock format is currently used in three different "sub-versions": |
<table border="1"> | <table border="1"> | ||
+ | <tr><th>Sub-Version</th><th>Superblock Position on Device</th></tr> | ||
+ | <tr><td>1.0</td><td>At the end of the device</td></tr> | ||
+ | <tr><td>1.1</td><td>At the beginning of the device</td></tr> | ||
+ | <tr><td>1.2</td><td>4K from the beginning of the device</td></tr> | ||
+ | </table> | ||
+ | |||
+ | The Format of the "version-1" Superblock itself is as follows: | ||
+ | |||
+ | <table border="1"> | ||
+ | <tr><th colspan="8">The "version 1" MD Superblock</th></tr> | ||
+ | <tr><th colspan="8">Size: 256 Bytes, plus 2 bytes per device in the array</th></tr> | ||
+ | <tr><td colspan="8"> </td></tr> | ||
<tr> | <tr> | ||
<th>Offset (Hex)</th> | <th>Offset (Hex)</th> | ||
Line 344: | Line 356: | ||
<tr><td colspan="8"> </td></tr> | <tr><td colspan="8"> </td></tr> | ||
<tr><th colspan="8">Section: Array-State Information area</th></tr> | <tr><th colspan="8">Section: Array-State Information area</th></tr> | ||
− | <tr><th colspan="8">64 Bytes, Offset 192- | + | <tr><th colspan="8">64 Bytes, Offset 192-255 (0xC0 - 0xFF)</th></tr> |
<tr> | <tr> | ||
<td>0xC0 - 0xC7</td> | <td>0xC0 - 0xC7</td> | ||
Line 406: | Line 418: | ||
zero when writing</td> | zero when writing</td> | ||
</tr> | </tr> | ||
− | |||
<tr><td colspan="8"> </td></tr> | <tr><td colspan="8"> </td></tr> | ||
− | <tr>< | + | <tr><th colspan="8">Section: Device-Roles (Positions-in-Array) area</th></tr> |
− | <tr>< | + | <tr><th colspan="8">(Variable length - 2 Bytes per Device in Array (including Spares/Faulty-Devs)</th></tr> |
+ | <tr><th colspan="8">?? Bytes, Offset 256-??? (0x100 - 0x???)</th></tr> | ||
<tr> | <tr> | ||
− | <td> | + | <td>Ox100 - 0x???</td> |
− | <td> | + | <td>256 - ???</td> |
− | <td> | + | <td>?</td> |
− | <td> | + | <td>dev_roles</td> |
<td>Fm</td> | <td>Fm</td> | ||
− | <td> | + | <td>__u16</td> |
− | <td> | + | <td>Role (Position) of each device in the array.<br>0xFFFF means "spare".<br>0xFFFE means "faulty".</td> |
− | <td> | + | <td></td> |
</tr> | </tr> | ||
</table> | </table> |
Revision as of 22:22, 22 February 2008
Currently, the Linux RAID subsystem recognizes two distinct variant superblocks.
They are known as v0.9 and v1.x Superblock formats.
The "version-1" Superblock format is currently used in three different "sub-versions":
Sub-Version | Superblock Position on 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 |
The Format of the "version-1" Superblock itself is as follows:
The "version 1" MD Superblock | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Size: 256 Bytes, plus 2 bytes per device in the array | |||||||||||||||||||||||||
Offset (Hex) | Offset (Dec) | Length (in bytes) |
Field Name | Usage/Meaning | Data Type | Data Value | Notes | ||||||||||||||||||
Section: Superblock/"Magic-Number" Identification area | |||||||||||||||||||||||||
16 Bytes, Offset 0-15 (0x00 - 0x0F) | |||||||||||||||||||||||||
0x00 - 0x03 | 0 - 3 | 4 | magic | "Magic Number" (Superblock ID) |
__u32 | 0xa92b4efc (little-endian) |
|||||||||||||||||||
0x04 - 0x07 | 4 - 7 | 4 | major_version | Major Version of the Superblock |
__u32 | 1 | |||||||||||||||||||
0x08 - 0x0B | 8 - 11 | 4 | feature_map | Feature Map | __u32 | 0 Bit-Mapped Field
|
|||||||||||||||||||
0x0C - 0x0F | 12 - 15 | 4 | pad0 | Padding Block 0 | __u32 | 0 | Always set to zero when writing |
||||||||||||||||||
Section: Per-Array Identification & Configuration area | |||||||||||||||||||||||||
48 Bytes, Offset 16-63 (0x10 - 0x3F) | |||||||||||||||||||||||||
0x10 - 0x1F | 16 - 31 | 16 | set_uuid | UUID for the Array(?) | __u8[16] | Set by user-space formatting util |
|||||||||||||||||||
0x20 - 0x3F | 32 - 63 | 32 | set_name | Name for the Array(?) | char[32] | Set and used by user-space utils |
Nt | ||||||||||||||||||
0x40 - 0x47 | 64 - 71 | 8 | ctime | Creation Time(?) | __u64 | low 40-bits are seconds high 24-bits are uSeconds |
|||||||||||||||||||
0x48 - 0x4B | 72 - 75 | 4 | level | RAID Level of the Array |
__u32 |
|
RAID-6 not mentioned in the mdadm source(?) |
||||||||||||||||||
0x4C - 0x4F | 76 - 79 | 4 | layout | layout of array (RAID5 only) |
__u32 | (?) | Only used for RAID5 |
||||||||||||||||||
0x50 - 0x57 | 80 - 87 | 8 | size | used-size of component devices | __u64 | size of component devices (in # of 512-byte sectors) |
|||||||||||||||||||
0x58 - 0x5B | 88 - 91 | 4 | chunksize | chunk-size of the array | __u32 | chunk-size of the array (in # of 512-byte sectors) |
|||||||||||||||||||
0x5C - 0x5F | 92 - 95 | 4 | raid_disks | (?)number of disks in array(?) | __u32 | # | |||||||||||||||||||
0x60 - 0x63 | 96 - 99 | 4 | bitmap_offset | # of sectors after superblock that bitmap starts (See note about signed value) |
__u32 | (signed) | This is only valid if feature_map[0] is set Signed value allows bitmap to appear before superblock on the disk |
||||||||||||||||||
Section: RAID-Reshape In-Process Metadata Storage/Recovery area | |||||||||||||||||||||||||
(Only contains valid data if feature_map bit '4' is set) | |||||||||||||||||||||||||
64 Bytes, Offset 100-163 (0x64 - 0x7F) | |||||||||||||||||||||||||
0x64 - 0x67 | 100 - 103 | 4 | new_level | (Used with RESHAPE) the new RAID level being reshaped-to |
__u32 | See field named "level" above |
|||||||||||||||||||
0x68 - 0x6F | 104 - 111 | 8 | reshape_position | (Used with RESHAPE) Next address of the array to reshape |
__u64 | current position of the reshape operation | |||||||||||||||||||
0x70 - 0x73 | 112 - 115 | 4 | delta_disks | (Used with RESHAPE) this holds the change in # of raid disks |
__u32 | change in # of raid disks | |||||||||||||||||||
0x74 - 0x77 | 116 - 119 | 4 | new_layout | (Used with RESHAPE) |
__u32 | new layout for array | |||||||||||||||||||
0x78 - 0x7B | 120 - 123 | 4 | new_chunk | (Used with RESHAPE) |
__u32 | new chunk size (See ) |
|||||||||||||||||||
0x7C - 0x7F | 124 - 127 | 4 | pad1 | Padding Block #1 | __u8[4] | 0 | Always set to zero when writing |
||||||||||||||||||
Section: This-Member-Device Information area | |||||||||||||||||||||||||
64 Bytes, Offset 128-191 (0x80 - 0xbf) | |||||||||||||||||||||||||
0x80 - 0x87 | 128 - 135 | 8 | data_offset | the sector # upon which data starts | __u64 | sector # where data begins (Often 0) |
|||||||||||||||||||
0x88 - 0x8F | 136 - 143 | 8 | data_size | sectors in the device that are used for data |
__u64 | # of sectors that can be used for data | |||||||||||||||||||
0x90 - 0x97 | 144 - 151 | 8 | super_offset | # of the sector upon which this superblock starts |
__u64 | # of the sector upon which this superblock starts |
|||||||||||||||||||
0x98 - 0x9F | 152 - 159 | 8 | recovery_offset | sectors before this offset (from data_offset) have been recovered |
__u64 | sector # | |||||||||||||||||||
0xA0 - 0xA3 | 160 - 163 | 4 | dev_number | Fm | __u32 | Permanent identifier of this device (Not its role in RAID(?)) | |||||||||||||||||||
0xA4 - 0xA7 | 164 - 167 | 4 | cnt_corrected_read | Number of read-errors that were corrected by re-writing | __u32 | Dv | |||||||||||||||||||
0xA8 - 0xB7 | 168 - 183 | 16 | device_uuid | UUID of the member-device | __u8[16] | Set by User-Space Ignored by kernel |
|||||||||||||||||||
0xB8 | 184 | 1 | devflags | Per-Device Flags (Bit-Mapped Field) |
__u8 | Bit-Mapped Field
|
WriteMostly1 indicates that this device should only be updated on writes, not read from. (Useful with slow devices in RAID1 arrays?) | ||||||||||||||||||
0xB9 - 0xBF | 185 - 191 | 7 | pad2 | Padding block 2 | __u8[7] | 0 | Always set to zero when writing |
||||||||||||||||||
Section: Array-State Information area | |||||||||||||||||||||||||
64 Bytes, Offset 192-255 (0xC0 - 0xFF) | |||||||||||||||||||||||||
0xC0 - 0xC7 | 192 - 199 | 8 | utime | Fm | __u64 | low 40-bits are seconds high 24-bits are uSeconds |
Nt | ||||||||||||||||||
0xC8 - 0xCF | 200 - 207 | 8 | events | Event Count for the Array | __u64 | # | Updated whenever the superblock is updated. Used by mdadm in re-assembly to detect failed/out-of-sync member-devices. |
||||||||||||||||||
0xD0 - 0xD7 | 208 - 215 | 8 | resync_offset | Offsets before this one (starting from data_offset) are 'known' to be in sync. | __u64 | Dv | |||||||||||||||||||
0xD8 - 0xDB | 216 - 219 | 4 | sb_csum | Checksum of this superblock up to devs[max_dev] | __u32 | # | This value will be different for each member-device's superblock. | ||||||||||||||||||
0xDC - 0xDF | 220 - 223 | 4 | max_dev | How many devices are part of (or related to) the array | __u32 | # | |||||||||||||||||||
0xE0 - 0xFF | 224 - 255 | 32 | pad3 | Padding Block 3 | __u8[32] | 0 | Always set to zero when writing |
||||||||||||||||||
Section: Device-Roles (Positions-in-Array) area | |||||||||||||||||||||||||
(Variable length - 2 Bytes per Device in Array (including Spares/Faulty-Devs) | |||||||||||||||||||||||||
?? Bytes, Offset 256-??? (0x100 - 0x???) | |||||||||||||||||||||||||
Ox100 - 0x??? | 256 - ??? | ? | dev_roles | Fm | __u16 | Role (Position) of each device in the array. 0xFFFF means "spare". 0xFFFE means "faulty". |