Short version: Is it safe to do

mdadm --zero-superblock /dev/sdd

on a disk with a partition (dev/sdd1), filesystem and data? Will the partition be mountable and the data still there?

Longer version: I used to have a raid6 array but decided to dismantle it. The disks from the array are now used as non-raid disks. The superblocks were cleared:

sudo mdadm --zero-superblock /dev/sdd

The disks were repartitioned with fdisk and filesystems created with mfks.ext4. All disks where mounted and everything worked fine.

Today, a couple of weeks later, one of the disks is failing to be recognized when trying to mount it, or rather the single partition on it.

sudo mount /dev/sdd1 /mnt/tmp
mount: special device /dev/sdd1 does not exist

fdisk claims there to be a partition on it:

sudo fdisk -l /dev/sdd

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb06f6341

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      243201  1953512001   83  Linux

Of course mount is right, the device /dev/sdd1 is not there, I'm guessing udev did not create it because of the mdadm data still on it:

sudo mdadm --examine /dev/sdd
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : b164e513:c0584be1:3cc53326:48691084
           Name : pringle:0  (local to host pringle)
  Creation Time : Sat Jun 16 21:37:14 2012
     Raid Level : raid6
   Raid Devices : 6

 Avail Dev Size : 3907027120 (1863.02 GiB 2000.40 GB)
     Array Size : 15628107776 (7452.06 GiB 8001.59 GB)
  Used Dev Size : 3907026944 (1863.02 GiB 2000.40 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : 3ccaeb5b:843531e4:87bf1224:382c16e2

    Update Time : Sun Aug 12 22:20:39 2012
       Checksum : 4c329db0 - correct
         Events : 1238535

         Layout : left-symmetric
     Chunk Size : 512K

   Device Role : Active device 3
   Array State : AA.AAA ('A' == active, '.' == missing)

My mdadm --zero-superblock apparently didn't work. Can I safely try it again without losing data? If not, are there any suggestion on what do to? Not starting mdadm at all on boot might be a (somewhat unsatisfactory) solution.


Zeroing superblock on a linux raid volume does not touche the actual payload. In fact, the payload is offset from the superblock a considerable amount (which equals 2048 sectors in recent mdadm, and less in mdadm <= version 3.0).

But in your case, (as long as you really did the mfks.ext4 /dev/sdd1) the partition superblock was already blanked. So the only way of explaining what you describe is to assume, that the superblock has been re-added afterwards, which means that your data are already corrupt (I hope the fsck will be able to correct it afterwards).

The most probable scenario of what happened is that you did the mfks.ext4 /dev/sdd1 before stopping the md device. Or you are a victim (just as I was) of the bug described here: A Nasty md/raid bug which effectively allows Linux to re-write the bitmap on the md device which is not active.

So, in short, zeroing the superblock is irrelevant. You should rather stop that device, clear the part in /etc/mdadm/mdadm.conf that describes it, and run fsck (first try in read-only mode to make sure that there actually is something that resembles the ext4 filesystem) on that device.


  • I really did the mkfs.ext4 /dev/sdd1, I used the drive for a couple of weeks. If zeroing the superblock doesn't touch the payload, how could re-adding it do? – Kjell Andreassen Sep 23 '12 at 14:49
  • The raid config is commented in /etc/mdadm/mdadm.conf but mdadm tries to create it at reboot anyway. fsck can't find /dev/sdd1, onfly fdisk seems to recognize it. – Kjell Andreassen Sep 23 '12 at 14:55
  • In that case, the superblock was put there overwriting the actual filesystem. In this case, just as I wrote, it doesn't really matter whether you zero it or not. I would rather make sure the md device associated with /dev/sdd1 is not running, and then fsck. – Adam Ryczkowski Sep 23 '12 at 15:28
  • The superblock doesn't seem to have overwritten the filesystem. I reconfigured mdadm to not automatically assemble arays on boot. Now my partition is recognized and everything seems fine. I will try zeroing the superblock to verify that it doesn't destroy anything, even though what you write and what I have seen indicates that it shouldn't. – Kjell Andreassen Sep 23 '12 at 16:00
  • Doing mdadm --zero-superblock /dev/sdd did not seem to destroy neither partition nor data. – Kjell Andreassen Sep 23 '12 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.