2 minutes
mdraid and how to fix the superblock
If you’re using a disk that has been part of a RAID and you can’t find the dev device after a re-format & re-partition then it may need to have it’s superblock erased.
How To Check The Super Block Using Mdadm
By running the following command, you can see that it is still apart of a raid, even after a format and erasing all the partitions.
mdadm -Evvv /dev/sda
/dev/sda:
Magic : xxxx
Version : 1.2
Feature Map : 0x1
Array UUID : xxxx
Name : node1:0
Creation Time : Wed Jul 31 22:26:03 2019
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 488132976 (232.76 GiB 249.92 GB)
Array Size : 234297344 (223.44 GiB 239.92 GB)
Used Dev Size : 468594688 (223.44 GiB 239.92 GB)
Data Offset : 264192 sectors
Super Offset : 8 sectors
Unused Space : before=264112 sectors, after=19538288 sectors
State : clean
Device UUID : xxxx
Internal Bitmap : 8 sectors from superblock
Update Time : Sun Jun 26 10:49:28 2022
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : e379e3b5 - correct
Events : 67497329
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
How To Fix It?
You can run the following command against the entire disk and zero out the superblock, above, you can see that there is a raid set against the disk. Once we run the fix you’ll see my output, the raid is gone.
mdadm --zero-superblock /dev/sda
/dev/sda:
MBR Magic : xxxx
Partition[0] : 468858880 sectors at 2048 (type fd)
While This Was A Quick Fix. Always Use A Clean Disk, You Could Easily Mess Up A Raid By Importing The Wrong Disk.
290 Words
2022-06-26 22:44
Read other posts