{"id":92608,"date":"2024-05-05T15:18:10","date_gmt":"2024-05-05T07:18:10","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=92608"},"modified":"2024-05-05T15:18:10","modified_gmt":"2024-05-05T07:18:10","slug":"linux-raid5","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-raid5.html","title":{"rendered":"Linux\u4e0b\u6784\u5efaRAID5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n RAID 5 \u662f\u4e00\u79cd\u5b58\u50a8\u6027\u80fd\u3001\u6570\u636e\u5b89\u5168\u548c\u5b58\u50a8\u6210\u672c\u517c\u987e\u7684\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\u3002 RAID 5\u53ef\u4ee5\u7406\u89e3\u4e3a\u662fRAID 0\u548cRAID 1\u7684\u6298\u4e2d\u65b9\u6848\u3002RAID 5\u53ef\u4ee5\u4e3a\u7cfb\u7edf\u63d0\u4f9b\u6570\u636e\u5b89\u5168\u4fdd\u969c\uff0c\u4f46\u4fdd\u969c\u7a0b\u5ea6\u8981\u6bd4Mirror\u4f4e\u800c\u78c1\u76d8\u7a7a\u95f4\u5229\u7528\u7387\u8981\u6bd4Mirror\u9ad8\u3002RAID 5\u5177\u6709\u548cRAID 0\u76f8\u8fd1\u4f3c\u7684\u6570\u636e\u8bfb\u53d6\u901f\u5ea6\uff0c\u53ea\u662f\u591a\u4e86\u4e00\u4e2a\u5947\u5076\u6821\u9a8c\u4fe1\u606f\uff0c\u5199\u5165\u6570\u636e\u7684\u901f\u5ea6\u6bd4\u5bf9\u5355\u4e2a\u78c1\u76d8\u8fdb\u884c\u5199\u5165\u64cd\u4f5c\u7a0d\u6162\u3002\u540c\u65f6\u7531\u4e8e\u591a\u4e2a\u6570\u636e\u5bf9\u5e94\u4e00\u4e2a\u5947\u5076\u6821\u9a8c\u4fe1\u606f\uff0cRAID 5\u7684\u78c1\u76d8\u7a7a\u95f4\u5229\u7528\u7387\u8981\u6bd4RAID 1\u9ad8\uff0c\u5b58\u50a8\u6210\u672c\u76f8\u5bf9\u8f83\u4f4e\uff0c\u662f\u76ee\u524d\u8fd0\u7528\u8f83\u591a\u7684\u4e00\u79cd\u89e3\u51b3\u65b9\u6848\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4e00\u3001\u524d\u671f\u51c6\u5907<\/strong><\/div>\n

1.\u521b\u5efaRAID5\u81f3\u5c11\u9700\u89813\u5757\u540c\u6837\u5bb9\u91cf\u7684\u786c\u76d8<\/p>\n

2.Linux\u4e0b\u9700\u8981\u5b89\u88c5mdadm\u8f6f\u4ef6\u5305<\/p>\n

\u53ef\u4ee5\u4f7f\u7528<\/p>\n

rpm\u00a0-qa\u00a0|\u00a0grep\u00a0mdadm<\/pre>\n

\u547d\u4ee4\u786e\u8ba4mdadm\u8f6f\u4ef6\u662f\u5426\u5b89\u88c5<\/p>\n

\u4e8c\u3001\u5bf9\u78c1\u76d8\u8fdb\u884c\u5206\u533a<\/strong><\/div>\n

1.\u4f7f\u7528fdisk -l\u547d\u4ee4\u67e5\u770b\u5206\u533a\u60c5\u51b5\uff1b<\/p>\n

fdisk\u00a0-l<\/pre>\n

2.\u4f7f\u7528fdisk\u5bf9\u78c1\u76d8\u8fdb\u884c\u5206\u533a\uff0cRAID\u7ec4\u9700\u8981\u6bcf\u4e00\u4e2a\u5206\u533a\u5927\u5c0f\u4e00\u81f4\uff0c\u5206\u533a\u9ed8\u8ba4ID\u4e3a83\uff0c\u4f7f\u7528fd\u547d\u4ee4\u4fee\u6539\u3002<\/p>\n

fdisk<\/pre>\n
\u4e09\u3001\u521b\u5efaRAID5\u7ec4<\/strong><\/div>\n

1>\u521b\u5efaRAID5\u81f3\u5c11\u9700\u5c113\u5757\u540c\u6837\u5bb9\u91cf\u7684\u786c\u76d8\uff0c\u5efa\u8bae\u4f7f\u7528\u4e864\u4e2a\u4e00\u6837\u5927\u7684\u786c\u76d8\uff0c\u5176\u4e2d3\u4e2a\u786c\u76d8\u505aRAID5\uff0c\u4e00\u4e2a\u786c\u76d8\u7a7a\u95f2\u505a\u4e3a\u70ed\u5907\u3002<\/p>\n

mdadm -C \/dev\/md0 -l 5 -n 3 -x 1 \/dev\/sdb[1-4]<\/pre>\n

\u6ce8\uff1a-l RAID\u7ea7\u522b\uff0c\u8fd9\u91cc\u4e3a5\uff0c\u5373RAID5 -n RAID\u7ec4\u4e2d\u786c\u76d8\u6570\u91cf\uff0c\u8fd9\u91cc\u67093\u5757 -x \u70ed\u5907\u76d8\u6570\u91cf\uff0c\u8fd9\u91cf\u8bbe\u7f6e\u4e3a1\u5757 \/dev\/sdb[1-4] \u4f7f\u7528\u7684\u662f\u54ea\u4e9b\u786c\u76d8\uff0c\u8fd9\u91cc\u4f7f\u7528\/dev\/sdb1~\/dev\/sdb4\u4e00\u5171\u56db\u4e2a\u786c\u76d8\uff083\u5757\u5efaRAID5\uff0c1\u5757\u7528\u4e8e\u70ed\u5907\uff09\u3002
\n2>\u5c06RAID\u914d\u7f6e\u4fe1\u606f\u5199\u5165\u5230\u914d\u7f6e\u6587\u4ef6<\/p>\n

Mdadm --detail --scan --verbose \/dev\/md0 > \/etc\/mdadm.conf<\/pre>\n

\u6ce8\uff1aLinux\u542f\u52a8\u65f6\u4f1a\u81ea\u52a8\u8bfb\u53d6\/etc\/mdadm.conf\uff0c\u5bf9raid\u7ec4\u8fdb\u884c\u914d\u7f6e\u3002
\n3>\u67e5\u770bRAID\u4fe1\u606f
\na.\u67e5\u770bRAID\u7ec4\u7684\u8be6\u7ec6\u4fe1\u606f<\/p>\n

mdadm --detail \/dev\/md0<\/pre>\n

b.\u67e5\u770bRAID\u7ec4\u7684\u72b6\u6001\u4fe1\u606f<\/p>\n

cat \/proc\/mdstat<\/pre>\n

\"\"<\/p>\n

\u56db\u3001\u683c\u5f0f\u5316<\/strong><\/div>\n
mkfs.ext4 \/dev\/md0<\/pre>\n
\u4e94\u3001\u6302\u8f7d<\/strong><\/div>\n

\u6709\u4e24\u79cd\u65b9\u6cd5\u6302\u8f7d\uff1a<\/p>\n

vi \/etc\/fstab<\/pre>\n

\u5728\u6700\u540e\u9762\u52a0\u4e00\u884c\uff0c\u683c\u5f0f\u4e0e\u4e0a\u9762\u76f8\u540c\uff0c\u5982\uff1a \/dev\/md0 \/mnt_array ext4 defaults 0 0 RAID\u76d8 \u6620\u5c04\u76d8 \u683c\u5f0f \u9ed8\u8ba4\u914d\u7f6e \u8868\u793a\u5373\u4fbf\u6302\u8f7d\u5931\u8d25\u4e5f\u4e0d\u5f71\u54cd\u7cfb\u7edf\u542f\u52a8
\n2> \u76f4\u63a5\u6302\u8f7d\uff08\u6302\u8f7d\u4ec5\u5bf9\u5f53\u524d\u8fd0\u884c\u65f6\u6709\u6548\uff0c\u7cfb\u7edf\u91cd\u542f\u540e\uff0c\u6d88\u5931\uff0c\u5982\u9700\u8981\u4e00\u76f4\u6709\u6548\uff0c\u7528\u4e0a\u9762\u65b9\u6cd5\uff09<\/p>\n

mount \/dev\/md0 \/mnt_array<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/wenku.baidu.com\/view\/25dfe28ded3a87c24028915f804d2b160b4e868a.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/linux-raid5.html<\/a>\u7f16\u8f91\uff1aAtlantis_Yu\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb RAID 5 \u662f\u4e00\u79cd\u5b58\u50a8\u6027\u80fd\u3001\u6570\u636e\u5b89\u5168\u548c\u5b58\u50a8\u6210\u672c\u517c\u987e\u7684\u5b58\u50a8\u89e3\u51b3\u65b9\u6848\u3002 RAID 5\u53ef\u4ee5\u7406\u89e3\u4e3a\u662fRAID […]<\/p>\n","protected":false},"author":63,"featured_media":7783,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[109,166],"class_list":["post-92608","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread","tag-linux","tag-raid"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/92608","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=92608"}],"version-history":[{"count":10,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/92608\/revisions"}],"predecessor-version":[{"id":95090,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/92608\/revisions\/95090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/7783"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=92608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=92608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=92608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}