Book Image

CentOS 7 Server Deployment Cookbook

By : Timothy Boronczyk, IRAKLI NADAREISHVILI
Book Image

CentOS 7 Server Deployment Cookbook

By: Timothy Boronczyk, IRAKLI NADAREISHVILI

Overview of this book

CentOS is derived from Red Hat Enterprise Linux (RHEL) sources and is widely used as a Linux server. This book will help you to better configure and manage Linux servers in varying scenarios and business requirements. Starting with installing CentOS, this book will walk you through the networking aspects of CentOS. You will then learn how to manage users and their permissions, software installs, disks, filesystems, and so on. You’ll then see how to secure connection to remotely access a desktop and work with databases. Toward the end, you will find out how to manage DNS, e-mails, web servers, and more. You will also learn to detect threats by monitoring network intrusion. Finally, the book will cover virtualization techniques that will help you make the most of CentOS.
Table of Contents (18 chapters)
CentOS 7 Server Deployment Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Replacing a device in a RAID


When an array member fails, it's important to replace it as soon as possible because the failure of additional drives increases the chance of data loss. This recipe teaches you how to properly replace a bad drive and rebuild the array.

Getting ready

This recipe requires a CentOS system with administrative privileges provided by logging in with the root account or using sudo. It assumes that a RAID-1 configuration has been set up as described in the previous recipe and the drive that will be replaced is /dev/sdb.

How to do it...

Follow these steps to replace a failed disk in a RAID:

  1. Mark the failed partition as faulty with mdadm using the -f option:

    mdadm /dev/md/md0 -f /dev/sdb1
    
  2. Remove the partition from the RAID's configuration with -r:

    mdadm /dev/md/md0 -r /dev/sdb1
    
  3. Physically replace the faulty disk.

  4. Partition the new drive with cfdisk:

    cfdisk -z /dev/sdb
    
  5. Use the -a option to add the partition to the RAID:

    mdadm /dev/md/md0 -a /dev/sdb1
    

How it works...

It's important...