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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. How to test a PHP script
  2. How to Configure an NFSv4-only Client using nfsconf in CentOS/RHEL 8
  3. How to Create Yum Repository For System Packages Installation in CentOS/RHEL
  4. How to Setup SSH keys for “passwordless” SSH Login on CentOS/RHEL
  5. chattr Command Examples to Change File Attributes (Make files immutable)
  6. How to resolve the error “-bash: xclock: command not found” in CentOS / RHEL
  7. “kernel: INFO: task {PROCESS}:{PID} blocked for more than 120 seconds.” – CentOS/RHEL Troubleshooting
  8. CentOS / RHEL 7 : How to set date, time / NTP and timezone using timedatectl
  9. Managing iSCSI Timeouts Settings in Linux
  10. Audit Log And Messages File Not Rotating on CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8
  • FATAL: Error inserting rds_rdma
  • Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  • How To Add Timestamps To dmesg Kernel Boot Log in CentOS/RHEL
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary