• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mdadm: command not found

by admin

The mdadm command is a tool used to manage software-based RAID arrays. A redundant array of independent disks (RAID) is a set of vendor-independent specifications that support redundancy and fault tolerance for configurations on multiple-device storage systems. In a RAID array, data is stored across multiple physical storage devices, and those devices are combined into a single virtual storage device. This type of software-based RAID configuration is an alternative to using device mapper and DM-Multipath. The mdadm tool enables you to create, manage, and monitor RAID arrays.

mdadm has several modes of operation: Create, Build, Assemble, and Monitor. Each of these modes has its own command-line switch. In addition to these modes, there are many management features that operate independently.

Example usage

Let’s assume you added three disks to your virtual machine. Let’s create a RAID 0 device called /dev/md127 (just a random number that is not yet in use):

$sudo mdadm --create /dev/md127 --level 0 --raid-devices 3 /dev/sd{c,d,e} 

Verify the configuration:

$ cat /proc/mdstat
$ sudo mdadm --detail /dev/md127

Make the configuration persistent:

$ sudo mdadm --detail --scan --verbose >> /etc/mdadm.conf

Now you can use this device and format it with a filesystem. For instance:

$ sudo mkfs.ext4 -L data_mnt /dev/md127

If you encounter below error while running the mdadm command:


you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install mdadm
Ubuntu apt-get install mdadm
Alpine apk add mdadm
Arch Linux pacman -S mdadm
Kali Linux apt-get install mdadm
CentOS yum install mdadm
Fedora dnf install mdadm
Raspbian apt-get install mdadm

mdadm Command Examples

1. Create an array:

# mdadm --create /dev/md/MyRAID --level raid_level --raid-devices number_of_disks /dev/sdXN

2. Stop array:

# mdadm --stop /dev/md0

3. Mark disk as failed:

# mdadm --fail /dev/md0 /dev/sdXN

4. Remove disk:

# mdadm --remove /dev/md0 /dev/sdXN

5. Add a disk to array:

# mdadm --assemble /dev/md0 /dev/sdXN

6. Show RAID info:

# mdadm --detail /dev/md0

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to use fdisk to partition a disk in Linux
  2. CentOS / RHEL 6 : How to completely remove device mapper multipath (dm-multipath)
  3. pscp – ssh_init: Network error: Cannot assign requested address
  4. chkconfig: command not found
  5. efibootmgr Command Examples in Linux
  6. How to tar, untar files and view contents of tar file under Linux
  7. How to automate sftp file transfers using expect utility
  8. mycli: command not found
  9. What are SELinux Users and how to Map Linux Users to SELinux Users
  10. flashrom: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright