• 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

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. Ubuntu Linux – yED(Graph Editor) Alternate of Microsoft Office Visio
  2. mcopy Command in Linux
  3. UNIX / Linux : What Is a Shell? What are different Shells?
  4. Why Does “/var/log/messages” Report Martian Packets
  5. lxterminal: command not found
  6. flock: command not found
  7. po4a-updatepo: command not found
  8. Linux OS Service ‘microcode_ctl’
  9. light: command not found
  10. gdebi Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright