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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL : How to remove a mirror with mdadm

by admin

The post describes the procedure to remove the mirror with mdadm. The example used here has RAID1 created with devices /dev/sdb and /dev/sdc. We are going to remove the device /dev/sdb. To start with lest create the RAID1 mirror first.

Steps

1. Create a raid1 device with the disks /dev/sdb and /dv/sdc :

# mdadm -Cv /dev/md0 -l1 -n2 /dev/sdb /dev/sdc
mdadm: /dev/sdb appears to contain an ext2fs file system
    size=2097152K  mtime=Wed May  8 12:39:49 2013
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: /dev/sdc appears to contain an ext2fs file system
    size=2097152K  mtime=Wed May  8 12:39:53 2013
mdadm: size set to 2096116K
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

2. Check the md device status :

# cat /proc/mdstat 
Personalities : [raid1] 
md0 : active raid1 sdc[1] sdb[0]
      2096116 blocks super 1.2 [2/2] [UU]

unused devices: <none>

3. Mark the /dev/sdb disk as failed in the mirror:

# mdadm /dev/md0 --fail /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0

4. Remove the /dev/sdb disk from the mirror :

# mdadm /dev/md0 --remove /dev/sdb
mdadm: hot removed /dev/sdb from /dev/md0

5. Check the md device status again :

# cat /proc/mdstat 
Personalities : [raid1] 
md0 : active raid1 sdc[1]
      2096116 blocks super 1.2 [2/1] [_U]

unused devices: <none>

Filed Under: Linux

Some more articles you might also be interested in …

  1. deluser: command not found
  2. bitcoin-cli Command Examples (Command-line client to interact with the Bitcoin daemon via RPC calls)
  3. mate-screenshot: command not found
  4. qjoypad: command not found
  5. CentOS / RHEL 5 : dm-multipath file /etc/sysconfig/mkinitrd/multipath explained
  6. aura Command Examples
  7. How to Boot KVM Guest into a Rescue shell
  8. How to Set Proxy Settings on Linux command line or Terminal
  9. virsh Command Examples in Linux
  10. kotlinc Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright