How to Use the Linux program mdadm to create a software RAID1 soft Array

Source: Internet
Author: User
Tags arch linux dmesg linux mint

How to Use the Linux program mdadm to create a software RAID1 soft Array

Disk redundancy array (RAID) is a technology that combines multiple physical disks into one logical disk. This technology can improve disk fault tolerance and improve disk read/write speed. Based on the data storage arrangement (such as strip storage, image storage, parity, or their combination), several different levels of RAID (RAID-0, RAID-1, RAID-5, etc ). Disk Arrays can be implemented using software or hardware. In modern Linux, the basic software RAID function is installed by default.

This article describes how to build a RAID-1 array (Image array) using software. RAID-1 writes the same data to different devices. Although RAID-1 can be implemented using two partitions of the same disk, if the disk breaks down, data will be lost, so it makes no sense. In fact, this is why most RAID levels use multiple physical disks to provide redundancy. When a single disk fails, the operation of the entire array is not affected, and the disk can be replaced online, the most important thing is that data will not be lost. However, arrays cannot replace regular backups of external storage.

Because the size of the RAID-1 array is the minimum disk size in the array, two disks of the same size should be used to form RAID-1.

Use mdadm for software RAID in Linux

How to build a RAID 10 array on Linux

Debian soft RAID Installation notes-use mdadm to install RAID1

Common RAID technology introduction and demo (Multi-chart)

The most common disk array in Linux-RAID 5

RAID0 + 1 and RAID5 Performance Test Results

Getting started with Linux: disk array (RAID)

Install mdadm

We will use the mdadm (Multi-disk management) tool to create, assemble, manage, and monitor the software RAID-1. In releases such as Fedora, CentOS, RHEL, or Arch Linux, mdadm is installed by default. In Debian-based releases, you can use aptitude or apt-get to install mdadm.

Fedora, CentOS or RHEL

Because adadm is pre-installed, we only need to enable the RAID daemon and configure it as boot:

  1. # Systemctl start mdmonitor
  2. # Systemctl enable mdmonitor

For CentOS/RHEL 6 systems, run the following command:

  1. # Service mdmonitor start
  2. # Chkconfig mdmonitor on
Debian, Ubuntu or Linux Mint

In Debian or Debian-like systems, mdadm can be installed using aptitude or apt-get:

  1. # Aptitude install mdadm

In Ubuntu, you are required to configure Postfix MTA to send email notifications. You can jump over.

In the Debian system, the installer displays the following explanation to help us determine whether to install the root directory to the RAID array. All the operations below depend on this step, so read it carefully.

We do not use RAID-1 in the root directory, so leave it blank.

When you are prompted whether to start the array, select "yes ". Note: Add an entry to the/etc/fstab file so that the array is correctly mounted when the system starts.

Hard Disk partitioning

Now, prepare the hard disks required to create an array. Insert two 8 GB usb disks here and use the dmesg command to display the device/dev/sdb and/dev/sdc

  1. # Dmesg | less

[60.014863] sd 3: 0: 0: 0: [sdb] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB) [75.066466] sd 4: 0: 0: 0: [sdc] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB)

We use fdisk to create a primary partition of 8 GB for each disk. The following steps describe how to create a partition on/dev/sdb, assuming that the disk has never been partitioned (if there are other partitions, you can delete it ):

  1. # Fdisk/dev/sdb

Press the p key to output the current partition table:

(If there is a partition, you can use option d to delete it, option w to apply the change ).

There is no partition on the disk, so we use the command ['n'] to create a primary partition ['P'], assign the Partition Number ['1'] and specify the size. You can press enter to use the default value or enter a value you want to set. For example:

Use the same method to partition/dev/sdc.

If we have two hard disks of different capacities, such as 750 GB and 1 TB, we need to separate a GB primary partition on each disk, and the remaining space on the dashboard can be used for other purposes, do not add a disk array.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.