Create a raid using mdadm

Source: Internet
Author: User
1. Add five new disks to the Virtual Machine
2. fdisk/dev/SDB, add three 1g partitions and set the type to FD (Linux raid autodetect)
3. dd If =/dev/SDB of =/dev/sdx BS = 1024 COUNT = 1 (copy the Partition Table of SDB to another disk)
Fdisk/dev/sdx and save it by W (otherwise, the device files in the/dev/sdxx partitions do not exist)
4. Create a raid0
Mdadm-C/dev/md0-l0-N2/dev/sdb1/dev/sdc1
Disable md0
Mdadm-S/dev/md0
Enable md0
Mdadm-A/dev/md0/dev/sdb1/dev/sdc1
5. Create raid1
Mdadm-C/dev/md1-L1-N2/dev/sdb2/dev/sdc2
CAT/proc/mdstat
Personalities: [raid0] [raid1]
Md1: Active raid1 sdc2 [1] sdb2 [0]
987904 blocks [2/2] [UU] md0: Active raid0 sdb1 [0] sdc1 [1]
1975680 blocks 64 K chunks
Unused devices: <none>
Format and mount. If/dev/md1 is mounted, change the disk.
Mdadm/dev/md0-F/dev/sdb2 (set sdb2 to fail)
Mdadm/dev/md0-r/dev/sdb2 (remove sdb2)
Mdadm/dev/md0-A/dev/sdb3 (add sdb3)
CAT/proc/mdstat
6. Create RAID5
Mdadm-C/dev/MD5-L5-N3/dev/sdd1/dev/sde1/dev/sdf1-x1/dev/sdc3
Mdadm/dev/MD5-F/dev/sdd1
Mdadm/dev/MD5-r/dev/sdd1
CAT/proc/mdstat (automatically add sdc3 to RAID5)
Mdadm/dev/MD5-A/dev/sdd1 (sdd1 becomes a hot backup disk)
7. Save all configurations
Echo device/dev/SD * [1-9]>/dev/mdadm. conf
Mdadm-d-s>/dev/mdadm. conf mdadm usage reference (to) mdadm is a tool for managing software raid in Linux. The following content comes from the manpage: basic syntax: mdadm [mode] [Options] [mode] There are 7 types: assemble: adds an array previously defined to an existing array. Build: Build a legacy array, each device has no superblockscreate: Create a new array, each device has a superblocksmanage: Management array, such as add or removemisc: an operation can be performed on a device in the array, for example, removing superblocks or terminating an array in use. Follow or monitor: monitor the statuses of RAID, and multipath grow: Change the raid capacity or the number of devices in the array. Available [Options]:-A, -- assemble: add a previously defined array-B, -- Build: Build a legacy array without superblocks. -C, -- create: Create a new array-Q, -- Query: view a device and determine whether it is a MD device or a part of an MD array-D, -- detail: print the details of one or more MD devices-E, -- examine: print the content of the MD superblock on the device-F, -- follow, -- monitor: select the monitor mode-G, -- grow: change the size or form of the array in use-h, -- help: Help Information. After the preceding options are used, the options -- Help-options-V, -- version-V, -- verbose: Show Details-B, -- Brief: less details are displayed. Used for -- detail and -- Examine options-F, -- force-C, -- Config =: Specify the configuration file. The default value is/etc/mdadm. conf-S, -- Scan: scan the configuration file or/proc/mdstat to search for lost information. Configuration file/etc/mdadm. confcreate or build options:-C, -- chunk =: Specify chunk size of kibibytes. the default value is 64. -- rounding =: Specify rounding factor for Linear Array (= chunk size)-L, -- level =: Set the raid level. -- create available: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, RAID5, 5, raid6, 6, multipath, MP. -- Build available: linear, raid0, 0, stripe. -P,
-- Parity =: Set the RAID 5 parity rules: eft-asypolicric, left-semi Ric,
Right-asypolicric, right-connected Ric, La, Ra, ls, Rs. the default value is left-connected Ric -- layout =: similar to -- parity-N, -- raid-devices =: specify the number of available devices in the array. The value can only be changed to-X by -- grow, -- spare-devices =: specify the number of surplus devices in the initial array-Z, -- size =: total space obtained from each device after raid1/0/6 is set up -- assume-clean: currently, it is only used for -- Build option-R, -- run: when a part of the array appears in another array or file system, mdadm confirms the array. This option is not confirmed. -F, -- force: Generally, mdadm does not allow creating arrays with only one device, and a device is used as missing drive when creating RAID 5. This option is the opposite.

-A, -- Auto {= No, yes, MD, MDP, part, p} {NN }:

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.