{"id":3984,"date":"2013-11-19T14:05:42","date_gmt":"2013-11-19T06:05:42","guid":{"rendered":"https:\/\/www.icocean.com\/wp\/?p=3984"},"modified":"2013-11-19T14:05:42","modified_gmt":"2013-11-19T06:05:42","slug":"linux-%e8%bd%afraid-1%e5%a6%82%e4%bd%95%e8%a7%84%e5%88%92%e4%b8%8e%e7%81%be%e9%9a%be%e6%81%a2%e5%a4%8d%e6%96%b9%e6%a1%88","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=3984","title":{"rendered":"Linux \u8f6fraid 1\u5982\u4f55\u89c4\u5212\u4e0e\u707e\u96be\u6062\u590d\u65b9\u6848"},"content":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u90fd\u5341\u5206\u6068\u6709\u4e00\u53f0\u786c\u4ef6\u7684raid\u670d\u52a1\u5668\u6765\u5b66\u4e60\uff0c\u5927\u5bb6\u90fd\u77e5\u9053\u4f5c\u4e3a\u4e00\u4e2aIT\u4eba\u4e0d\u53ef\u80fd\u4e0d\u61c2\u786c\u4ef6\u5427\uff1f<br \/>\n\u53ef\u662f\u81ea\u5df1\u7684\u5de5\u4f5c\u6ca1\u6709\u673a\u4f1a\u78b0\u5230\u786c\u4ef6\u7684\u7ef4\u62a4\u3002<\/p>\n<p>1.\u4e3a\u4f55\u662f\u8f6fraid\u5462\uff1f<\/p>\n<p>Linux \u5341\u5206\u9002\u5408\u5728\u4e2d\u5c0f\u4f01\u4e1a\u5e94\u7528\uff0c\u56e0\u4e3a\u4ef7\u683c\u3001\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u3001\u786c\u4ef6\u7684\u6210\u672c\u6bd4\u8d77\u5176\u5b83\u64cd\u4f5c\u7cfb\u7edf\u90fd\u662f\u5341\u5206\u6709\u4f18\u52bf\u7684\uff0c\u4f46\u662f\u7ba1\u7406Linux\u7684\u4eba\u624d\u6bd4\u8f83\u7f3a\uff0c\u6216\u8005\u8fd9\u4e48\u8bf4\u5427\u4e2d\u5c0f\u4f01\u4e1a\u8981\u8bf7\u4e2aLinux\u7ba1\u7406\u5458\u4e0d\u597d\u627e\u3002\uff08\u5f53\u7136\u662f\u85aa\u91d1\u7684\u95ee\u9898\uff09\u5176\u5b9e\u8f6fraid\u5bf9\u4e8eCPU\u7684\u6027\u80fd\u8981\u6c42\u6bd4\u8f83\u5389\u5bb3\uff0c\u4f46\u4ee5\u73b0\u5728\u7684\u786c\u4ef6\u53d1\u5c55\u901f\u5ea6\uff0c\u8f6fraid\u7edd\u5bf9\u6709\u4f18\u52bf\u3002<\/p>\n<p>2.\u8f6fraid\u7684\u4f18\u70b9<\/p>\n<p>\u6211\u603b\u7ed3\u4e86\u8f6fraid\u7684\u4e00\u4e9b\u4f18\u70b9\uff1a\u5ec9\u6d01\u7684\u6570\u636e\u5b89\u5168\u65b9\u6848\u3001\u9002\u5408\u5404\u79cd\u786c\u4ef6\u8bbe\u5907\u3001Linux\u6838\u5fc3\u81ea\u5e26\u529f\u80fd\uff0c\u4e0d\u50cf\u786craid\u91cd\u65b0\u5b89\u88c5\u542f\u52a8\u7a0b\u5e8f\uff0c\u4e0d\u7528\u5f53\u5fc3\u662f\u5426\u652f\u6301\u64cd\u4f5c\u7cfb\u7edf\u3001\u6709\u7ba1\u7406\u5de5\u5177\u67e5\u770b\u8f6fraid\u7684\u72b6\u6001\u3002<\/p>\n<p>3.\u8f6fraid\u7684\u7f3a\u70b9<\/p>\n<p>CPU\u5360\u7528\u7387\u9ad8\u3001\u8bfb\u5199\u901f\u5ea6\u4e0d\u5982\u786craid\u3001\u707e\u96be\u6062\u590d\u590d\u6742\u3001\u707e\u96be\u6062\u590d\u901f\u5ea6\u4e0d\u5982\u786craid\u3002<!--more--><\/p>\n<p>\u4e00  \u4ee5\u8f6fraid1\u65b9\u5f0f\u5b89\u88c5EMOS 1.5 \uff08\u5185\u90e8\u7248\u672c\uff09<\/p>\n<p>\u5148\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\uff0c\u6211\u89c9\u5f97\u8fd8\u4e0d\u9519\u54e6~~<\/p>\n<p>http:\/\/blog.chinaunix.net\/u2\/82278\/showart_2018616.html<\/p>\n<p>\u770b\u770b\u6211\u7684\u5206\u533a<\/p>\n<p>\u6211\u5728VirtualBox\u4e0b\u865a\u62df\u4e86\u4e24\u4e2a10G\u786c\u76d8\u6253\u7b97\u5b89\u88c5Extmail\u90ae\u4ef6\u7cfb\u7edf\uff0c\u5212\u5206\u5982\u4e0b\u3002<\/p>\n<p>\/dev\/sda1   \/boot<br \/>\n\/dev\/sdb4   \/boot1<\/p>\n<p>\/dev\/md0   (swap)   [\/dev\/sda2(512MB)]  [\/dev\/sdb3 (512MB)]<br \/>\n\/dev\/md1   (\/)          [\/dev\/sda3(2GB)]      [\/dev\/sdb2(2GB)]<br \/>\n\/dev\/md2   (\/home) [\/dev\/sda4(7.2GB)]   [\/dev\/sdb1(7.2GB)]<\/p>\n<p>Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sda1   *        1293        1305      104422+  83  Linux<br \/>\n\/dev\/sda2            1228        1292      522112+  fd  Linux raid autodetect<br \/>\n\/dev\/sda3             967        1227     2096482+  fd  Linux raid autodetect<br \/>\n\/dev\/sda4               1         966     7759363+  fd  Linux raid autodetect<\/p>\n<p>Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sdb1               1         966     7759363+  fd  Linux raid autodetect<br \/>\n\/dev\/sdb2             967        1227     2096482+  fd  Linux raid autodetect<br \/>\n\/dev\/sdb3            1228        1292      522112+  fd  Linux raid autodetect<br \/>\n\/dev\/sdb4   *        1293        1305      104422+  83  Linux<\/p>\n<p>\u4e8c \u5907\u4efdboot loder<\/p>\n<p># dd if=\/dev\/sda1 of=\/dev\/sdb4<\/p>\n<p>\u4e09 \u6a21\u62df\u78c1\u76d8\u6545\u969c<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u6a21\u62df\u7b2c\u4e00\u652f\u786c\u76d8\u6545\u969c\u574f\u6389\u4e86\uff0c\u6211\u4eec\u7684 \u201c\/&#8221; &#8220;\/home&#8221; \u90fd\u5236\u4f5c\u4e86raid1 \u6240\u4ee5\u5982\u679c\u7b2c\u4e00\u652f\u786c\u76d8\u6545\u969c\u574f\u6389\u5bf9\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u662f\u6ca1\u6709\u7279\u522b\u5f71\u54cd\u3002<\/p>\n<p>mdadm &#8211;manage \/dev\/md1 -f \/dev\/sda3<br \/>\nmdadm &#8211;manage \/dev\/md1 -r \/dev\/sda3<\/p>\n<p>mdadm &#8211;manage \/dev\/md2 -f \/dev\/sda4<br \/>\nmdadm &#8211;manage \/dev\/md2 -r \/dev\/sda4<\/p>\n<p>umount \/boot<\/p>\n<p>\u54c8\u54c8~~\u5f7b\u5e95\u628a\u7b2c\u4e00\u53ea\u786c\u76d8\u641e\u6b7b\u4e86\uff0c\u7136\u540e\u505a\u7684\u662f\u6539\u53d8grub\u542f\u52a8<\/p>\n<p># groub<br \/>\n> root (hd1,3)<br \/>\n> setup (hd1)<br \/>\n>quit<\/p>\n<p># shutdown -h now<\/p>\n<p>\u628a\u574f\u6389\u7684\u7b2c\u4e00\u53ea\u786c\u76d8\u62d4\u6389\uff0c\u7136\u540e\u628a\u540e\u5907\u7684\u786c\u76d8\uff08\u540c\u6837\u662f10G\u7684\uff09\u5b89\u88c5\u4e0a\u53bb\u3002\u8fd9\u65f6\u5019\u78c1\u76d8\u5982\u4e0b<\/p>\n<p>\/dev \/sda (\u5168\u65b0\u7684\u786c\u76d8)<br \/>\n\/dev \/sdb  (\u539f\u6765\u7684\u786c\u76d8)<\/p>\n<p>\u542f\u52a8\u670d\u52a1\u5668\uff0c\u8fdb\u5165bios \u9009\u62e9\u7531\u7b2c\u4e8c\u5757\u786c\u76d8\/dev \/sdb\u542f\u52a8\u7cfb\u7edf<\/p>\n<p>\u5728\u5f00\u673a\u83dc\u5355\u4e2d\u628a root (hd0,0) => root (hd1,3)<\/p>\n<p>\u4f46\u4f60\u4f1a\u53d1\u73b0\u7cfb\u7edf\u51fa\u73b0\u9519\u8bef\uff1a(\u539f\u56e0\u662f\u521a\u521a\u6302\u4e0a\u7684\u65b0\u786c\u76d8\u8fd8\u672a\u8fdb\u884c\u5206\u533a\uff0c\u56fa\u7136\u6ca1\u6709\/dev\/sda1\u7ed9\u4f60\u62a5\u9519\u5566~)<\/p>\n<p>\u8f93\u5165root \u5bc6\u7801\u8fdb\u5165\u5355\u4eba\u7ef4\u62a4<\/p>\n<p># mount -n -o remount,rw \/<\/p>\n<p># vi \/etc\/fstab<\/p>\n<p>\/dev\/md1                \/                       ext3    defaults        1 1<br \/>\n\/dev\/md2                \/home                   ext3    defaults        1 2<br \/>\n\/dev\/sda1               \/boot                   ext3    defaults        1 2<br \/>\n\/dev\/sdb4               \/boot1                   ext3    defaults        1 2<br \/>\n\u6539\u4e3a<br \/>\n\/dev\/md1                \/                       ext3    defaults        1 1<br \/>\n\/dev\/md2                \/home                   ext3    defaults        1 2<br \/>\n\/dev\/sdb4               \/boot                   ext3    defaults        1 2<\/p>\n<p># \u7136\u540e\u91cd\u542f\u670d\u52a1\u5668<\/p>\n<p>#\u8fd9\u65f6\u4f60\u53ef\u4ee5\u5b8c\u5168\u6b63\u5e38\u5730\u8fdb\u5165\u64cd\u4f5c\u7cfb\u7edf<\/p>\n<p>\u53d1\u73b0\u73b0\u5728\u7684raid\u72b6\u6001\u5982\u4e0b\uff1a<\/p>\n<p>Personalities : [raid1] [raid0]<br \/>\nmd2 : active raid1 sdb1[1]<br \/>\n7759296 blocks [2\/1] [_U]<\/p>\n<p>md0 : inactive sdb3[1]<br \/>\n522048 blocks<\/p>\n<p>md1 : active raid1 sdb2[1]<br \/>\n2096384 blocks [2\/1] [_U]<\/p>\n<p>unused devices: <none><\/p>\n<p>md1 md2 \u90fd\u518d\u7f3a\u786c\u76d8\u7684\u72b6\u6001<\/p>\n<p>md0 \u5df2\u7ecf\u6302\u6389\u4e86 \u201cinactive\u201d<\/p>\n<p>\u628a\u65b0\u6302\u4e0a\u7684\u786c\u76d8\u5b89\u88c5\u4e4b\u524d\u7684\u987a\u5e8f\u5206\u533a\uff0c\u7136\u540e\u91cd\u65b0rebuid raid<\/p>\n<p>fdisk \/dev\/sda<\/p>\n<p>Device Boot      Start         End      Blocks   Id  System<br \/>\n\/dev\/sda1   *        1293        1305      104422+  83  Linux<br \/>\n\/dev\/sda2            1228        1292      522112+  fd  Linux raid autodetect<br \/>\n\/dev\/sda3             967        1227     2096482+  fd  Linux raid autodetect<br \/>\n\/dev\/sda4               1         966     7759363+  fd  Linux raid autodetect<\/p>\n<p>#partprobe<\/p>\n<p>1. \u628a rebuid raid &#8220;\/&#8221;  \/dev\/md1<\/p>\n<p>#mdadm &#8211;manage \/dev\/md1 -a \/dev\/sda3<\/p>\n<p># mdadm -D \/dev\/md1<\/p>\n<p>Rebuild Status : 26% complete<\/p>\n<p>Number   Major   Minor   RaidDevice State<br \/>\n2       8        3        0      spare rebuilding   \/dev\/sda3<br \/>\n1       8       18        1      active sync   \/dev\/sdb2<\/p>\n<p>2. \u628a rebuid raid &#8220;\/home&#8221;  \/dev\/md2<\/p>\n<p>#mdadm &#8211;manage \/dev\/md2 -a \/dev\/sda4<\/p>\n<p>#mdadm -D \/dev\/md1<\/p>\n<p>Rebuild Status : 4% complete<\/p>\n<p>Number   Major   Minor   RaidDevice State<br \/>\n2       8        4        0      spare rebuilding   \/dev\/sda4<br \/>\n1       8       17        1      active sync   \/dev\/sdb1<\/p>\n<p>3. \u91cd\u65b0\u5efa\u7acb&#8221;swap&#8221; raid<\/p>\n<p># mdadm -S \/dev\/md0<\/p>\n<p># mdadm -Cv \/dev\/md0 &#8211;level=0 &#8211;raid-devices=2 \/dev\/sda2 \/dev\/sdb3<\/p>\n<p># mkswap \/dev\/md0<\/p>\n<p># swapon \/dev\/md0<\/p>\n<p># free -m<\/p>\n<p>total       used       free     shared    buffers     cached<br \/>\nMem:          4054        354       3700          0          3        106<br \/>\n-\/+ buffers\/cache:        244       3810<br \/>\nSwap:         1019          0       1019<\/p>\n<p>4. \u540c\u6b65&#8221;\/boot&#8221; \u5206\u533a<\/p>\n<p># dd if=\/dev\/sdb4 of=\/dev\/sda1<\/p>\n<p># vi \/etc\/fstab   \u8f6c\u56de\u7531\u7b2c\u4e00\u53ea\u786c\u76d8\u542f\u52a8<\/p>\n<p>\/dev\/sdb4               \/boot => \/dev\/sda1               \/boot<\/p>\n<p>#grub<br \/>\n>root (hd0,0)<br \/>\n>setup (hd0)<br \/>\n>quit<\/p>\n<p>5. Reboot \u770b\u770b~~\uff01 \u6240\u6709\u90fd\u5341\u5206\u6b63\u5e38~~~ <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u90fd\u5341\u5206\u6068\u6709\u4e00\u53f0\u786c\u4ef6\u7684raid\u670d\u52a1\u5668\u6765\u5b66\u4e60\uff0c\u5927\u5bb6\u90fd\u77e5\u9053\u4f5c\u4e3a\u4e00\u4e2aIT\u4eba\u4e0d\u53ef\u80fd\u4e0d\u61c2\u786c\u4ef6\u5427\uff1f \u53ef\u662f\u81ea\u5df1\u7684\u5de5\u4f5c\u6ca1 <a href='https:\/\/www.icocean.com\/blog\/?p=3984' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[3896,3895],"class_list":["post-3984","post","type-post","status-publish","format-standard","hentry","category-linuxunix","tag-raid1","tag-raid","category-16-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3984"}],"version-history":[{"count":1,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3984\/revisions"}],"predecessor-version":[{"id":3985,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3984\/revisions\/3985"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}