Forrest logo
back to the mdadm tool

mdadm:tldr:9e182

mdadm: Reset disk by deleting RAID metadata.
$ sudo mdadm --zero-superblock ${-dev-sdXN}
try on your machine

This command is used to zero out the superblock of a specified device using the mdadm command with superuser privileges (sudo).

Here's a breakdown of the command components:

  • sudo: A command used in Unix-like systems to execute a command with superuser (or root) privileges, allowing the user to perform actions that require administrative rights.

  • mdadm: A utility tool in Linux and other Unix-like systems used for managing software RAID arrays. It allows the user to create, manage, monitor, and repair RAID arrays.

  • --zero-superblock: This flag instructs mdadm to zero out the superblock of the specified device. The superblock is a metadata structure that provides information about a RAID array, such as the version, layout, and state. By zeroing it out, you effectively remove any existing RAID configuration on the device.

  • ${-dev-sdXN}: This is a placeholder for the device you want to zero out the superblock for. sdXN refers to a specific partition or entire disk on your system, where sdX denotes the disk (e.g., sda, sdb) and N refers to a partition number (e.g., 1, 2, 3). You would replace ${-dev-sdXN} with the actual device path, such as /dev/sda1 or /dev/sdb2.

So, effectively, running this command with the appropriate device path will remove any previous RAID configuration stored in the superblock of that device.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mdadm tool