Article Title: master advanced: Introduction to soft array Management in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In the eyoolinux installation disk, the soft array is implemented through the mdadm command. The advantage of using mdadm is that you do not need to pay attention to the configuration file, which is very convenient to use.
(1) Creation of soft Arrays
Prepare and format and partition the disk of the array. For example, to create an array of/dev/hda and/dev/hdb ide disks/dev/md0, format/dev/hda and/dev/hdb to/dev/hda1, /dev/hdb1 two large partitions. Then, run the following command to construct the/dev/md0 array:
Mdadm -- create/dev/md0 -- level = 0 -- raid-devices = 2/dev/hd [AB] 1 (*)
Where
-- Create indicates creating an array./dev/md0 indicates the name of the array to be created.
-- Level = 0 indicates that the array level is raid0.
-- Raid-devices = 2 indicates that the array contains two disk partitions, And/dev/hd [AB] 1 indicates the specific partition.
/Dev/hda1 and/dev/hdb1
This command can also be abbreviated
Mdadm-C/dev/md0-l0-n2/dev/hd [AB] 1
The meaning is the same (*).
(2) Enabling and disabling soft Arrays
When you use mdadm to enable a soft array, you need to use its configuration file. This configuration file is generated by running the following two commands when creating an array:
Echo "DEVICE/dev/hd [AB] 1">/etc/md0.conf
Mdadm -- detail -- scan>/etc/md0.conf
/Dev/md0 is the name of the array device created in the previous step, and/etc/md0.conf is the configuration file of/dev/md0.
After creating a new array, run the preceding command to obtain its configuration file. Otherwise, the array cannot be enabled after it is disabled.
Now, you can operate the array through the configuration file.
Deprecated array: mdadm-S/dev/md0
Enable the array: mdadm-A/dev/md0-c/etc/md0.conf
-C indicates the configuration file (configure)
(3) array formatting and mounting
It is recommended to format the array after it is just created.
Mkfs. ext3/dev/md0
Like mounting a partition, mounting an array is done with mount.
Mkdir-p/dir
Mount/dev/md0/dir
Based on the above steps, more Arrays can be created, provided that the partitions are well divided.
For example, mdadm-c/dev/md1-l0-n2/dev/hd [AB] 2 creates a/dev/md1 array, it occupies two partitions:/dev/hda2/dev/hdb2.