Mdadm command parameters
Mdadm is a tool for managing software RAID under Linux
Basic Syntax : mdadm [mode] [options]
[Mode] There are 7 kinds:
Assemble: Joins a previously defined array to the current array.
Build:build a Legacy arraywith no superblocks Per Device
Create: Creates a new array with superblocks for each device
Manage: managing arrays, such as add or remove
Misc: Allows a single device in the array to be manipulated, such as erasing superblocks or terminating the array in use.
Follow or monitor: monitor the status of raid 1,4,5,6 and multipath
Grow: Change The raid capacity or the number of device in the array
available for [Options]:
-A,--assemble: Add a previously defined array
-B,--Build:build a legacy array without superblocks.
-C,--Create: Creating a new array
-Q,--Query: View a device todetermine whether it is part of a mddevice or an MD array
-D,--Detail: Print more information for one or more MD device
-e,--examine: Print The contents of Mdsuperblock on device
-F,--Follow,--monitor: Select monitor mode
-G,--Grow: Change the size or shape of the array in use
-H,--help: Help information, when used with the above options, displays the option information
--help-options
-V,--version
-V,--verbose: Show Details
-B,--Brief: less detail. For --detail and --examine options
-F,--Force
-C,--config= : Specify configuration file, default is /etc/mdadm/mdadm.conf
-S,--Scan: Scans the configuration file or /proc/mdstat to search for lost information. Configuration file /etc/mdadm/mdadm.conf
Example:mdadm-d--scan >/etc/mdadm.conf
options used by create or build:
-C,--chunk=:specify chunk size of kibibytes. The default is 64.
--rounding=: Specify rounding Factor forlinear array (==chunk size)
-L,--level=: sets 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 raid5 parity rule : eft-asymmetric,left-symmetric, Right-asymmetric, Right-symmetric, LA, RA, ls, Rs. default is left-symmetric
--layout=: similar to --parity
-N,--raid-devices=: Specifies the number of available device in the array , which can only be modified by--grow
-X,--spare-devices= : Specifies the number of redundant device numbers for the initial array
-Z,--size=: The total amount of space taken from each device after the RAID1/4/5/6 isformed
--assume-clean: currently only available for --build options
-R,--Run: When a part of the array appears in another array or file system,Mdadm confirms the array. This option will not be confirmed.
-F,--force: typically mdadm does not allow an array to be created with only one device , and when the RAID5 is created, a device is used as the Missingdrive. This option is the opposite.
-A,--Auto{=no,yes,md,mdp,part,p}{nn}:
eg: Create a new partition and build three partitions into RAID5 mode and simulate a single disk error
Fdisk/dev/sdb
N/+2g/w
Command (M for help): n new partition
First cylinder (733-976, default 733): confirm
Using Default Value 733
Last cylinder or +size or +sizem or +sizek (733-976, default 976): +2g new capacity 2G
Command (M for help): w Save
The partition table has been altered!
Fdisk-l
Partprobe/dev/sdb
Mdadm-c/dev/md5-a yes-l 5-n 3/dev/sdb{1,2,3} three disks do RAID5
[Email protected] ~]# Cat/proc/mdstat
Personalities: [RAID0] [RAID6] [RAID5] [RAID4]
Md5:active RAID5 sdb3[2] sdb2[1] sdb1[0]
3919616blocks level 5, 64k chunk, Algorithm 2 [3/3] [UUU]
Mke2fs-j–e stride=16–b 4096/dev/md5 specify block size for faster access
Mount/dev/md5/mnt
[Email protected] mnt]# df-l
Filesystem 1k-blocks used Available use%mounted on
/DEV/MD5 3857992 73280 3588732 3%/mnt
mdadm-d/dev/md5 View more information
[[email protected] mnt]# mdadm/dev/md5-f/dev/sdb1 damage SDB1
MDADM:SET/DEV/SDB1 Faulty IN/DEV/MD5
[Email protected] mnt]# mdadm-d/DEV/MD5
[[email protected] mnt]# mdadm/dev/md5-a/dev/sdb5 add SDB5 to RAID5
MDADM–S/DEV/MD5 abort MD5
Rm/dev/md5 removing MD5
[[email protected] mnt]# mdadm-d/dev/md5 after removal view details
MDADM:MD DEVICE/DEV/MD5 does not appear to beactive.
[Email protected] mnt]# Cat/proc/mdstat
Personalities: [RAID0] [RAID6] [RAID5] [RAID4]
Unused devices: <none>
[[email protected] mnt]# mdadm-a/dev/md5/dev/sdb2/dev/sdb3 reconstruction DM5
Mdadm:/dev/md5 have been started with 2 drives (Outof 3). There were only two plates before the reconstruction .
[[email protected] ~]# mdadm-d--scan >/etc/mdadm.conf save RAID Information
[[email protected] ~]# cat/etc/mdadm.conf view RAID Information
ARRAY/DEV/MD5 LEVEL=RAID5 num-devices=3metadata=0.90 uuid=f2c02e1e:88bb9492:b7d4176f:52a9308e
This article is from the "Wind No Trace" blog, please be sure to keep this source http://wangfx.blog.51cto.com/1697877/1765836
Mdadm Command Parameters