In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use mdadm to manage RAID array, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Mdadm is an abbreviation for multi-disk and device management Multiple Disk and Device Administration. It is a command-line tool that can be used to manage software RAID arrays on Linux. This article outlines the basics of using it.
The following five commands are the basic features for you to use mdadm:
Create a RAID array: mdadm-- create / dev/md/test-- homehost=any-- metadata=1.0-- level=1-- raid-devices=2 / dev/sda1 / dev/sdb1
Assemble (and start) RAID arrays: mdadm-- assemble / dev/md/test / dev/sda1 / dev/sdb1
Stop the RAID array: mdadm-- stop / dev/md/test
Delete RAID array: mdadm-- zero-superblock / dev/sda1 / dev/sdb1
Check the status of all combined RAID arrays: cat / proc/mdstat
Function description mdadm-create
The above creation command includes four parameters in addition to the-create parameter itself and the device name:
1.-homehost:
By default, mdadm saves your computer name as a property of the RAID array. If your computer name does not match the stored name, the array will not be automatically combined. This feature is useful in server clusters that share hard drives, because file system corruption usually occurs if multiple servers try to access the same drive at the same time. The name any is a reserved field and the-homehost restriction is disabled.
2.-metadata:
-mdadm reserves a small portion of space for each RAID device to store information about the RAID array itself. The-metadata parameter specifies the format and location of the information. 1.0 means to use the version 1 format and store the metadata at the end of the device.
3.-level:
The-level parameter specifies how data should be distributed among the underlying devices. Level 1 indicates that each device should contain a complete copy of all data. This level is also called disk mirroring.
4.-raid-devices:
The-raid-devices parameter specifies the number of devices that will be used to create the RAID array.
By using-level=1 (mirroring) with-metadata=1.0 (storing metadata at the end of the device), you can create an RAID1 array whose underlying devices will display normally if not accessed through the mdadm driver. This is useful in disaster recovery situations because you can access the device even if the new system does not support the mdadm array. It is also useful if the program needs to access the underlying device as read-only before the mdadm is available. For example, the UEFI firmware in your computer might need to read the boot loader from ESP before starting mdadm.
Mdadm-assemble
If the member device is lost or damaged, the above combination command will fail. To force the RAID array to assemble and start when one of its members is missing, use the following command:
# mdadm-- assemble-- run / dev/md/test / dev/sda1 other important notes
Avoid writing directly to devices whose underlying layer is RAID1. This causes devices to be out of sync, and mdadm will not know they are out of sync. If you access a RAID1 array that has been modified elsewhere, the file system may be corrupted. If you modify the RAID1 device elsewhere and need to force the array resynchronization, remove the mdadm metadata from the device you want to overwrite and then add it back to the array, as follows:
# mdadm-zero-superblock / dev/sdb1# mdadm-assemble-run / dev/md/test / dev/sda1# mdadm / dev/md/test-add / dev/sdb1
The above completely covers the content of sdb1 with the content of sda1.
To specify the RAID array that is automatically activated when the computer starts, create a / etc/mdadm.conf configuration.
For more information, see the man page:
Man mdadm$ man mdadm.conf Thank you for reading this article carefully. I hope the article "how to use mdadm to manage RAID Array" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.