{"id":7917,"date":"2020-06-13T15:39:00","date_gmt":"2020-06-13T07:39:00","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=7917"},"modified":"2022-05-17T11:57:08","modified_gmt":"2022-05-17T03:57:08","slug":"mdadm","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/mdadm","title":{"rendered":"mdadm\u547d\u4ee4 – \u7ba1\u7406RAID\u78c1\u76d8\u9635\u5217\u7ec4"},"content":{"rendered":"\n

mdadm\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cmultiple devices admin\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406RAID\u78c1\u76d8\u9635\u5217\u7ec4\u3002\u4f5c\u4e3aLinux\u7cfb\u7edf\u4e0b\u8f6fRAID\u8bbe\u5907\u7684\u7ba1\u7406\u795e\u5668\uff0cmdadm\u547d\u4ee4\u53ef\u4ee5\u8fdb\u884c\u521b\u5efa\u3001\u8c03\u6574\u3001\u76d1\u63a7\u3001\u5220\u9664\u7b49\u5168\u5957\u7ba1\u7406\u64cd\u4f5c\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>mdadm [\u53c2\u6570] \u8bbe\u5907\u540d<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-D<\/td>\u663e\u793aRAID\u8bbe\u5907\u7684\u8be6\u7ec6\u4fe1\u606f<\/td><\/tr>
-A<\/td>\u52a0\u5165\u4e00\u4e2a\u4ee5\u524d\u5b9a\u4e49\u7684RAID<\/td><\/tr>
-B<\/td>\u521b\u5efa\u4e00\u4e2a\u6ca1\u6709\u8d85\u7ea7\u5757\u7684RAID\u8bbe\u5907<\/td><\/tr>
-F<\/td>\u9009\u9879\u76d1\u63a7\u6a21\u5f0f<\/td><\/tr>
-G<\/td>\u66f4\u6539RAID\u8bbe\u5907\u7684\u5927\u5c0f\u6216\u5f62\u6001<\/td><\/tr>
-I<\/td>\u6dfb\u52a0\u8bbe\u5907\u5230RAID\u4e2d\uff0c\u6216\u4eceRAID\u4e2d\u5220\u9664\u8bbe\u5907<\/td><\/tr>
-z<\/td>\u7ec4\u5efaRAID1\u3001RAID4\u3001RAID5\u3001RAID6\u540e\u4ece\u6bcf\u4e2aRAID\u6210\u5458\u83b7\u53d6\u7684\u7a7a\u95f4\u5bb9\u91cf<\/td><\/tr>
-s<\/td>\u626b\u63cf\u914d\u7f6e\u6587\u4ef6\u6216\/proc\/mdstat\u4ee5\u641c\u5bfb\u4e22\u5931\u7684\u4fe1\u606f<\/td><\/tr>
-C<\/td>\u628aRAID\u4fe1\u606f\u5199\u5165\u6bcf\u4e2a\u6210\u5458\u8d85\u7ea7\u5757\u4e2d<\/td><\/tr>
-v<\/td>\u663e\u793aRAID\u521b\u5efa\u8fc7\u7a0b\u4e2d\u7684\u8be6\u7ec6\u4fe1\u606f<\/td><\/tr>
-B<\/td>\u4e0d\u628aRAID\u4fe1\u606f\u5199\u5165\u6bcf\u4e2a\u6210\u5458\u7684\u8d85\u7ea7\u5757\u4e2d<\/td><\/tr>
-l<\/td>\u6307\u5b9aRAID\u7684\u7ea7\u522b<\/td><\/tr>
-n<\/td>\u6307\u5b9aRAID\u4e2d\u6d3b\u52a8\u8bbe\u5907\u7684\u6570\u76ee<\/td><\/tr>
-f<\/td>\u628aRAID\u6210\u5458\u5217\u4e3a\u6709\u95ee\u9898\uff0c\u4ee5\u4fbf\u79fb\u9664\u8be5\u6210\u5458<\/td><\/tr>
-r<\/td>\u628aRAID\u6210\u5458\u79fb\u51faRAID\u8bbe\u5907<\/td><\/tr>
-a<\/td>\u5411RAID\u8bbe\u5907\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u6210\u5458<\/td><\/tr>
--re-add<\/td>\u628a\u6700\u8fd1\u79fb\u9664\u7684RAID\u6210\u5458\u91cd\u65b0\u6dfb\u52a0\u5230RAID\u8bbe\u5907\u4e2d<\/td><\/tr>
-E<\/td>\u67e5\u770bRAID\u6210\u5458\u8be6\u7ec6\u4fe1\u606f<\/td><\/tr>
-c<\/td>\u521b\u5efa\u4e00\u4e2aRAID\u8bbe\u5907\u65f6\u9ed8\u8ba4\u4e3a512kb<\/td><\/tr>
-R<\/td>\u5f00\u59cb\u90e8\u5206\u7ec4\u88c5RAID<\/td><\/tr>
-S<\/td>\u505c\u7528RAID\u8bbe\u5907\uff0c\u91ca\u653e\u6240\u6709\u8d44\u6e90<\/td><\/tr>
-x<\/td>\u6307\u5b9a\u521d\u59cbRAID\u8bbe\u5907\u7684\u5907\u7528\u6210\u5458\u7684\u6570\u91cf<\/td><\/tr>
--zero-superblock<\/td>\u5982\u679cRAID\u8bbe\u5907\u5305\u542b\u4e00\u4e2a\u6709\u6548\u7684\u8d85\u7ea7\u5757\uff0c\u8be5\u5757\u4f7f\u7528\u96f6\u8986\u76d6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u4f7f\u7528\u56db\u5757\u786c\u76d8\u8bbe\u5907\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u540d\u79f0\u7684\uff0c\u7ea7\u522b\u4e3aRAID10\u7684\u78c1\u76d8\u9635\u5217\u7ec4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm -Cv \/dev\/md0 -n 4 -l 10 \/dev\/sdb \/dev\/sdc \/dev\/sdd \/dev\/sde<\/strong>\r\nmdadm: layout defaults to n2\r\nmdadm: layout defaults to n2\r\nmdadm: chunk size defaults to 512K\r\nmdadm: size set to 20954112K\r\nmdadm: Defaulting to version 1.2 metadata\r\nmdadm: array \/dev\/md0 started.<\/pre>\n\n\n\n

\u67e5\u770b\u6307\u5b9aRAID\u78c1\u76d8\u9635\u5217\u7ec4\u8bbe\u5907\u7684\u7b80\u8981\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm -Q \/dev\/md0<\/strong>\r\n\/dev\/md0: 39.97GiB raid10 4 devices, 0 spares. Use mdadm --detail for more detail.<\/pre>\n\n\n\n

\u67e5\u770b\u6307\u5b9aRAID\u78c1\u76d8\u6574\u5217\u7ec4\u8bbe\u5907\u7684\u8be6\u7ec6\u4fe1\u606f\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm -D \/dev\/md0<\/strong>\r\n\/dev\/md0:\r\n           Version : 1.2\r\n     Creation Time : Wed Jan 13 08:24:58 2021\r\n        Raid Level : raid10\r\n        Array Size : 41908224 (39.97 GiB 42.91 GB)\r\n     Used Dev Size : 20954112 (19.98 GiB 21.46 GB)\r\n      Raid Devices : 4\r\n     Total Devices : 4\r\n       Persistence : Superblock is persistent\r\n\r\n       Update Time : Thu Jan 14 04:49:57 2021\r\n             State : clean \r\n    Active Devices : 4\r\n   Working Devices : 4\r\n    Failed Devices : 0\r\n     Spare Devices : 0\r\n\r\n            Layout : near=2\r\n        Chunk Size : 512K\r\n\r\nConsistency Policy : resync\r\n\r\n              Name : localhost.localdomain:0  (local to host linuxprobe.com)\r\n              UUID : 289f501b:3f5f70f9:79189d77:f51ca11a\r\n            Events : 17\r\n\r\n    Number   Major   Minor   RaidDevice State\r\n       0       8       16        0      active sync set-A   \/dev\/sdb\r\n       1       8       32        1      active sync set-B   \/dev\/sdc\r\n       2       8       48        2      active sync set-A   \/dev\/sdd\r\n       3       8       64        3      active sync set-B   \/dev\/sde<\/pre>\n\n\n\n

\u5c06\u6307\u5b9a\u7684\u786c\u76d8\u4eceRAID\u78c1\u76d8\u9635\u5217\u7ec4\u4e2d\u505c\u6b62\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm \/dev\/md0 -f \/dev\/sdb<\/strong>\nmdadm: set \/dev\/sdb faulty in \/dev\/md0\n[root@linuxcool ~]# mdadm \/dev\/md0 -r \/dev\/sdb<\/strong>\r\nmdadm: hot removed \/dev\/sdb from \/dev\/md0<\/pre>\n\n\n\n

\u5c06\u6307\u5b9a\u7684\u786c\u76d8\u6dfb\u52a0\u81f3RAID\u78c1\u76d8\u9635\u5217\u7ec4\u4e2d\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm \/dev\/md0 -a \/dev\/sdb<\/strong>\r\nmdadm: added \/dev\/sdb<\/pre>\n\n\n\n

\u5f7b\u5e95\u505c\u7528\u4e00\u4e2aRAID\u78c1\u76d8\u9635\u5217\u7ec4\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# mdadm --stop \/dev\/md0<\/strong>\r\nmdadm: stopped \/dev\/md0<\/pre>\n","protected":false},"excerpt":{"rendered":"

mdadm\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cmultiple devices admin\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406RAID\u78c1 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/7917"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=7917"}],"version-history":[{"count":13,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/7917\/revisions"}],"predecessor-version":[{"id":9778,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/7917\/revisions\/9778"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=7917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=7917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=7917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}