導航:首頁 > 操作系統 > linuxraid刪除

linuxraid刪除

發布時間:2024-06-02 13:22:33

linux瀛︿範鏃ヨ板嶮涓 杞浠剁佺洏闃靛垪RAID

紓佺洏闃靛垪鐨勮嫳鏂囧叏縐版槸Rendant Arrays of Inexpensive Disks錛圧AID錛夛紝鍗沖歸敊寤変環紓佺洏闃靛垪銆傚彲浠ラ氳繃涓浜涙妧鏈灝嗗氫釜杈冨皬鐨勭佺洏鏁村悎鎴愪負涓涓杈冨ぇ鐨勭佺洏璁懼囷紱鑰岃繖涓璁懼囧彲涓嶆㈠瓨鍌ㄥ姛鑳借屽凡錛屽畠榪樺叿鏈夋暟鎹淇濇姢鍔熻兘銆

RAID鐨勭瓑綰э細

脳 RAID-0錛堢瓑閲忔ā寮忥紝stripe錛夛細鎬ц兘杈冧匠

榪欑嶆ā寮忎嬌鐢ㄧ浉鍚屽瀷鍙峰拰瀹歸噺鐨勭佺洏鏉ョ粍鎴愶紝鍙浠ユ湁澶氫釜錛孯AID浼氬皢姣忎釜紓佺洏鍒掑垎鎴愮瓑閲忕殑鍖哄潡錛堜竴鑸涓4K錛2K絳夌瓑錛夛紝鐒跺悗褰撲竴涓鏂囦歡琚鍐欏叆鏃訛紝璇ユ枃浠朵細渚濇嵁鍧楀ぇ灝忓垏鍓插ソ錛屼箣鍚庝緷搴忔斁鍒板悇涓紓佺洏閲岄潰鍘伙紝鐢變簬姣忎釜紓佺洏浜ら敊瀛樻斁鏁版嵁錛屽洜姝ゅ綋浣犵殑鏁版嵁瑕佸啓鍏RAID鏃訛紝鏁版嵁浼氳絳夐噺鐨勬斁緗鍒板悇涓紓佺洏涓婂幓銆傝秺澶氱佺洏緇勬垚RAID-0,閭d箞鐨勮瘽鎬ц兘鑲瀹氬氨瓚婂ソ浜嗐

緙虹偣錛氫竴涓紓佺洏鎸傜偣錛屾暣涓鏂囦歡緋葷粺宕╃洏錛屾棤娉曟仮澶嶄簡銆傚苟涓旀墍鏈夌佺洏瀹歸噺蹇呴』涓鏍鳳紝涓嶇劧鎬ц兘浼氫笅闄嶃

脳 RAID-1錛堟槧鍍忔ā寮忥紝mirror錛夛細瀹屾暣澶囦喚

榪欑嶆ā寮忎篃瑕佺浉鍚屽瀷鍙鳳紝鐩稿悓瀹歸噺鐨勭佺洏錛屾渶濂藉畬鍏ㄤ竴鏍鳳紝涓涓妯″瓙鍒誨嚭鏉ョ殑銆

鏁版嵁浼犻佸埌I/O鎬葷嚎琚澶嶅埗澶氫喚鍒板悇涓紓佺洏錛屽洜姝ゅ啓鐨勬ц兘浼氬彉寰楀緢宸錛屼笉榪囧傛灉浣犵敤紜浠禦AID錛堢佺洏闃靛垪鍗★級錛岀佺洏闃靛垪鍗′細涓誨姩甯浣犲嶅埗錛屼笉闇瑕両/O鎬葷嚎銆備絾鏄紓佺洏闃靛垪鍗″緢璐墊淮鍛鍛錛屾垜涔頒笉璧鳳紝鎵浠ュ緢鎮插墽銆俁AID-1鏈澶х殑鐢ㄩ斿湪浜庡囦喚錛屼笉榪囧畠鐨勮誨彇鎬ц兘寰堝ソ銆

脳 RAID 0+1, RAID 1+0

RAID-0鐨勬ц兘杈冧匠浣嗘槸鏁版嵁涓嶅畨鍏錛孯AID-1鏁版嵁瀹夊叏浣嗘槸鎬ц兘涓嶄匠錛岄偅鑳戒笉鑳界粍鍚堜笅鎾掋

RAID 0+1錛氬厛璁㎞鍧楃佺洏緇勬垚RAID-0, 鍚屾椂鍐嶈╁彟澶栫殑N鍧楃佺洏涔熺粍鎴怰AID-0, 榪欐牱瀛愭垜寰楀埌浜嗕袱緇凴AID-0錛岀劧鍚庡皢榪欎袱緇凴AID-0鍐嶇粍鎴愪竴緇凴AID-1銆

RAID 1+0錛氬厛璁2N鍧楃佺洏緇勬垚N涓緇勶紝姣忎釜緇勪袱涓紓佺洏錛屾瘡涓緇勯噷闈㈢殑涓や釜紓佺洏緇勬垚RAID-1, 鐒跺悗灝嗚繖N緇凴AID-1緇勬垚RAID-0銆

緙虹偣錛氱佺洏鏈変竴鍗婄殑瀹歸噺鐢ㄦ潵鍋氬囦喚浜嗭紝鎮插墽鍛錛侊紒錛

RAID-5錛氭ц兘涓庢暟鎹澶囦喚鐨勫潎琛¤冭檻

RAID-5鑷沖皯闇瑕佷笁鍧椾互涓婄殑紓佺洏鎵嶈兘緇勬垚榪欑嶇被鍨嬬殑紓佺洏闃靛垪銆傝繖縐嶇佺洏闃靛垪鐨勬暟鎹鍐欏叆鏈夌偣綾諱技RAID-0,涓嶈繃姣忔″驚鐜鍐欏叆榪囩▼涓錛屽湪姣忓潡紓佺洏榪樺姞鍏ヤ竴涓鍚屼綅媯鏌ユ暟鎹錛圥arity錛夛紝榪欎釜鏁版嵁浼氳板綍鍏朵粬紓佺洏鐨勫囦喚鏁版嵁錛岀敤浜庡綋鏈夌佺洏鎹熸瘉鏃剁殑鏁戞彺銆

RAID-5鐨勫歸噺瑕佸噺鎺変竴涓紓佺洏瀹歸噺錛屼篃灝辨槸闃靛垪鐨勭佺洏鎬繪暟N-1,鍥犱負闇瑕佷竴涓紓佺洏瀹歸噺鏉ヤ繚瀛樺悓浣嶆鏌ユ暟鎹甈arity

RAID-5鐨勮誨彇鎬ц兘寰堜笉閿欙紝璺烺AID-0鏈夊緱涓鎷礆紝浣嗘槸鍐欏叆鎬ц兘灝卞緢灝村艾浜嗭紝鍦ㄨ蔣浠剁佺洏闃靛垪鐨勬椂鍊欙紝CPU榪樺緱鑺辨椂闂村幓璁$畻鍚屼綅媯鏌ユ暟鎹銆傚悓鏃跺畠鍙鑳戒繚璇佷竴涓紓佺洏鎹熷潖鏁版嵁鐨勫畨鍏錛屽傛灉涓や釜紓佺洏鎹熷潖灝辨寕浜嗐

RAID-6錛氳窡RAID-5綾諱技錛屼笉榪囪繖嬈′細浣跨敤涓ゅ潡紓佺洏瀹歸噺浣滀負Parity鐨勫瓨鍌錛屽畠鍙浠ユ敮鎸佷袱鍧楃佺洏鍚屾椂鎹熷潖錛岃繖涓姒傜巼搴旇ユ瘮璧板湪椹璺涓婅涓杈嗛┐杞︽挒鍒扮殑姒傜巼榪樹綆鍚э紝^_^

====Spare Disk錛氶勫囩佺洏鐨勫姛鑳====

涓轟簡璁╃郴緇熷彲浠ュ疄鏃跺湪鍧忔帀紓佺洏鏃朵富鍔ㄩ噸寤猴紝闇瑕侀勫囩佺洏spare disk鐨勮緟鍔╋紝騫蟲椂涓嶅寘鍚鍦ㄧ佺洏闃靛垪涓錛屽綋紓佺洏闃靛垪鏈変換浣曠佺洏鎹熷潖鏃訛紝spare disk椹涓婅涓誨姩鎷夊叆紓佺洏闃靛垪涓錛屽苟灝嗗潖鎺夌殑紓佺洏縐婚櫎紓佺洏闃靛垪錛岀劧鍚庣珛鍗抽噸寤烘暟鎹緋葷粺錛屽傛灉浣犵殑紓佺洏闃靛垪榪樻敮鎸佺儹鎻掓嫈灝辨洿鐖戒簡錛屽洜涓鴻繖涓鏃跺欏彧闇瑕佹妸鍧忕殑閭i楃佺洏鎷斾笅鏉ワ紝鎹涓婁竴涓鏂扮殑錛屽啀灝嗘柊鐨勭佺洏璁劇疆鎴恠pare disk錛屽畬鎴愪簡錛屼笉鐢ㄥ叧鏈洪噸鍚鍙浠ュ畬鎴愪竴鍒囥傝繖瀵規湇鍔″櫒鐨勭ǔ瀹氭ф湁寰堝ソ鐨勫府鍔┿

紓佺洏闃靛垪鐨勪紭鐐癸細

脳 鏁版嵁瀹夊叏涓庡彲闈犳э紝榪欓噷鎸囩殑鏄紜鐩樺潖浜嗘暟鎹鍙浠ユ尳鍥炪

脳 璇誨啓鎬ц兘錛孯AID-0鍙浠ュ姞寮鴻誨啓鎬ц兘錛岃╀綘鐨勭郴鍝I/O緋葷粺閮ㄥ垎寰椾互鏀瑰杽

脳 瀹歸噺錛氬彲浠ヨ╁氫釜紓佺洏緇勫悎璧鋒潵錛屽洜姝ゅ崟涓鏂囦歡緋葷粺鍙浠ユ湁鐩稿綋澶х殑瀹歸噺銆

centos鎻愪緵鐨勮蔣浠剁佺洏闃靛垪涓簃dadm榪欏楄蔣浠訛紝浠ュ垎鍖烘垨紓佺洏涓哄崟浣嶏紝涔熷氨鏄璇翠綘涓嶉渶瑕佸氫釜紓佺洏灝卞彲浠ヨ捐′綘鐨勭佺洏闃靛垪浜嗐傛ゅ栵紝mdadm鏀鎸佸垰鍒氭彁鍒扮殑RAID-0,RAID-1,RAID-5絳夌駭錛岃繕鏀鎸乻pare disk鐨勫姛鑳姐傝屼笖鎻愪緵鐨勭$悊鏈哄埗榪樺彲浠ヨ揪鍒扮被浼煎彲浠ョ儹鎻掓嫈鐨勫姛鑳斤紝鍙浠ュ湪綰匡紙鏂囦歡緋葷粺姝e父浣跨敤錛夎繘琛屽垎鍖虹殑鎶芥崲錛屼嬌鐢ㄤ笂闈炲父鐨勬柟渚褲傘

娉ㄦ剰錛氱‖鐩樼佺洏闃靛垪鍦╨inux鐪嬭搗鏉ュ氨鏄涓涓澶х殑紓佺洏錛屾墍鏈夎懼囨枃浠跺悕涓/dev/sd[a-p]錛屽洜涓轟嬌鐢ㄥ埌SCSI鐨勬ā鍧楃殑鍘熷洜銆傝岃蔣浠剁佺洏闃靛垪鍥犱負鏄緋葷粺浠跨湡錛屽洜姝や嬌鐢ㄧ殑璁懼囨枃浠跺悕鏃剁郴緇熺殑璁懼囨枃浠訛紝鏂囦歡鍚嶄負/dev/md0, /dev/md1錛屼袱鑰呮敞鎰忓尯鍒銆

====杞浠剁佺洏闃靛垪鐨勮劇疆====

# mdadm 鈥揹etail /dev/md0

# mdadm 鈥揷reate 鈥揳uto=yes /dev/md[0-9] 鈥搑aid-device=4 鈥搇evel=[015] 鈥搒pare-device=2 /dev/sd5 /dev/sd6

鈥揷reate錛氫負鏂板緩RAID鐨勫弬鏁

鈥揳uto=yes錛氬喅瀹氭柊寤哄悗闈㈡帴鐨勮蔣浠剁佺洏闃靛垪璁懼囷紝鍗/dev/md0, /dev/md1絳

鈥搑aid-devices=N錛氫嬌鐢∟涓紓佺洏浣滀負紓佺洏闃靛垪鐨勮懼

鈥搒pare-devices=N錛氫嬌鐢∟涓紓佺洏浣滀負澶囩敤spare璁懼

鈥搇evel=[015]錛氳劇疆紓佺洏闃靛垪鐨勭瓑綰с傛敮鎸佸緢澶氾紝涓嶈繃寤鴻鍙瑕佺敤0,1,5鍗沖彲

鈥揹etail錛氬悗闈㈡墍鎺ョ殑閭d釜紓佺洏闃靛垪璁懼囩殑璇︾粏淇℃伅

娉ㄦ剰鏈鍚庨潰鎺ョ殑璁懼囨枃浠跺悕錛屽彲浠ユ椂鏁村潡紓佺洏錛屾瘮濡/dev/sdb錛屼篃鍙浠ユ槸涓涓鍒嗗尯錛屾瘮濡/dev/sdb1錛屼笉榪囪繖浜涜懼囨枃浠跺悕鐨勬暟閲忔繪暟蹇呴』絳変簬鈥搑aid-devices鍜屸搒pare-devices鐨勪釜鏁版誨拰鎵嶈屻

涓嬮潰鎴戞潵璇曡瘯寤虹珛涓涓猂AID-5鐨勮蔣浠剁佺洏闃靛垪錛岃矊浼艱繖涓姣旇緝甯哥敤錛屽緢閫傚悎銆

鎴戝笇鏈涜繖涓猂AID-5鐜澧冩椂榪欐牱瀛愮殑錛

脳 鍒╃敤4涓鍒嗗尯緇勬垚RAID-5

脳 姣忎釜鍒嗗尯澶х害涓1G澶у皬錛岄渶瑕佺『瀹氭瘡涓鍒嗗尯涓鏍峰ぇ杈冧匠

脳 鍙﹀栧姞涓涓鍒嗗尯璁劇疆涓簊paredisk

脳 榪欎釜sparedisk鐨勫ぇ灝忎笌鍏朵粬RAID鎵闇鍒嗗尯涓鏍峰ぇ

脳 灝嗘RAID-5璁懼囨寕杞藉埌/mnt/raid鐩褰曚笅闈

鍏堢敤fdisk鏋勫緩5涓1G鐨勫垎鍖猴細

# fdisk /dev/sda

  鍓嶉潰鐪佺暐銆傘傘

  Command (m for help):n

姣忔″垎1000M絀洪棿澶у皬錛屾敞鎰忥紝鎴戜笉鐭ラ亾紲為┈鍘熷洜錛宖irst 鎵囧尯瑕佹墜鍔ㄨ緭鍏ワ紝鐢╬閫夐」鏌ョ湅鍚庯紝鐢ㄦ渶鍚庝竴涓鍒嗗尯鐨勬墖鍖哄彿+2049鎵嶆槸絎涓涓絀洪棽鎵囧尯鍙鳳紝榪欎釜鍙鑳芥椂fedora鐨勪竴涓猙ug錛屽垎鍖哄眳鐒朵笉鏄榪炵畫鐨勶紝涓嶇′簡錛岃嚜宸卞幓璇曡瘯銆??/p

鏈鍚庣殑鍒嗗尯鐢╬鏌ョ湅鍚庯紝鏄榪欐牱瀛愮殑錛

璁懼 Boot      Start         End      Blocks   Id  System

  /dev/sda1            2048      206847      102400    7  HPFS/NTFS/exFAT

  /dev/sda2   *      206848   169859071    84826112    7  HPFS/NTFS/exFAT

  /dev/sda3       169859072   462827821   146484375    7  HPFS/NTFS/exFAT

  /dev/sda4       462829568   976773119   256971776    5  Extended

  /dev/sda5       462833664   463243263      204800   83  Linux

  /dev/sda6       463245312   631181311    83968000   83  Linux

  /dev/sda7       631183360   799119359    83968000   83  Linux

  /dev/sda8       799121408   803315711     2097152   82  Linux swap / Solaris

  /dev/sda9       803317760   805365759     1024000   83  Linux

  /dev/sda10      805367808   807415807     1024000   83  Linux

  /dev/sda11      807417856   809465855     1024000   83  Linux

  /dev/sda12      809467904   811515903     1024000   83  Linux

  /dev/sda13      811517952   813565951     1024000   83  Linux

  鍚庨潰鐨勪粠9鍒13灝辨槸鍒氬垰鎴戝垎鐨5涓鍒嗗尯錛屾瘡涓澶ф1G錛屽ぇ灝忛兘鐩稿悓銆

# partprobe

鎺ヤ笅鏉ュ氨綆鍗曞暒鍟︼紝錛岄氳繃mdadm鏉ュ壋寤虹佺洏闃靛垪鍚с傚摝涔

# mdadm 鈥揷reate 鈥揳uto=yes /dev/md0 鈥搇evel=5 鈥搑aid-devices=4 鈥搒pare-devices=1 /dev/sda{9,10,11,12,13}

鏌ョ湅涓嬶紙絳変笅錛屽厛鍘誨枬鏉鍜栧暋鍏堬紝鍥犱負濡傛灉浣犵洿鎺ョ珛椹榪愯岋紝鍙鑳藉嚭鐜頒笅闈㈢殑姝e湪building鏁版嵁鐨勪俊鎮錛夛細

澶嶅埗浠g爜

  

浠g爜濡備笅:

# mdadm --detail /dev/md0

  /dev/md0: ==RAID璁懼囨枃浠跺悕

  Version : 1.2

  Creation Time : Sun Oct 28 10:03:43 2012 ==RAID琚鍒涘緩鐨勬椂闂

  Raid Level : raid5 ==姝RAID鐨勭瓑綰

  Array Size : 3068928 (2.93 GiB 3.14 GB) ==姝RAID鍙鐢ㄧ佺洏瀹歸噺

  Used Dev Size : 1022976 (999.17 MiB 1047.53 MB) ==姣忎釜璁懼囧彲鐢ㄥ歸噺

  Raid Devices : 4 ==鐢ㄤ綔RAID鐨勮懼囨暟閲

  Total Devices : 5 ==鍏ㄩ儴鐨勮懼囨暟閲

  Persistence : Superblock is persistent

Update Time : Sun Oct 28 10:04:01 2012

  State : clean, degraded, recovering

  Active Devices : 3 ==鍚鍔ㄧ殑錛坅ctive錛夎懼囨暟閲

  Working Devices : 5 ==鍙宸ヤ綔鐨勮懼囨暟閲

  Failed Devices : 0 ==鍑虹幇閿欒鐨勮懼囨暟閲

  Spare Devices : 2 ==棰勫噑pare紓佺洏鐨勬暟閲

Layout : left-symmetric

  Chunk Size : 512K

Rebuild Status : 17% complete

Name : localhost.localdomain:0 (local to host localhost.localdomain)

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

  Events : 3

Number Major Minor RaidDevice State

  0 8 9 0 active sync /dev/sda9

  1 8 10 1 active sync /dev/sda10

  2 8 11 2 active sync /dev/sda11

  5 8 12 3 spare rebuilding /dev/sda12

4 8 13 - spare /dev/sda13

鐪熸g殑瀹屾垚build鍚庣殑淇℃伅搴旇ユ槸錛

澶嶅埗浠g爜

  

浠g爜濡備笅:

# mdadm --detail /dev/md0

  /dev/md0:

  Version : 1.2

  Creation Time : Sun Oct 28 10:03:43 2012

  Raid Level : raid5

  Array Size : 3068928 (2.93 GiB 3.14 GB)

  Used Dev Size : 1022976 (999.17 MiB 1047.53 MB)

  Raid Devices : 4

  Total Devices : 5

  Persistence : Superblock is persistent

Update Time : Sun Oct 28 10:06:00 2012

  State : clean

  Active Devices : 4

  Working Devices : 5

  Failed Devices : 0

  Spare Devices : 1

Layout : left-symmetric

  Chunk Size : 512K

Name : localhost.localdomain:0 (local to host localhost.localdomain)

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

  Events : 20

Number Major Minor RaidDevice State

  0 8 9 0 active sync /dev/sda9

  1 8 10 1 active sync /dev/sda10

  2 8 11 2 active sync /dev/sda11

  5 8 12 3 active sync /dev/sda12

4 8 13 - spare /dev/sda13

榪樺彲浠ラ氳繃鏌ョ湅/proc/mdstat鏌ョ湅紓佺洏闃靛垪鎯呭喌錛

# cat /proc/mdstat

Personalities : [raid6] [raid5] [raid4]

  md0 : active raid5 sda12[5] sda13[4](S) sda11[2] sda10[1] sda9[0]

  3068928 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]

  unused devices: none

鏍煎紡鍖栦笌鎸傝澆浣跨敤RAID錛

# mkfs -t ext4 /dev/md0

# mkdir /mnt/raid

# mount /dev/md

# mount /dev/md0 /mnt/raid

# df

鏂囦歡緋葷粺          1K-鍧    宸茬敤     鍙鐢 宸茬敤% 鎸傝澆鐐

  rootfs         82649712 4681980 73769332    6% /

  devtmpfs        1964632       4  1964628    1% /dev

  tmpfs           1975352     600  1974752    1% /dev/shm

  tmpfs           1975352    1160  1974192    1% /run

  /dev/sda6      82649712 4681980 73769332    6% /

  tmpfs           1975352       0  1975352    0% /sys/fs/cgroup

  tmpfs           1975352       0  1975352    0% /media

  /dev/sda7      82649712 8355056 70096256   11% /home

  /dev/sda5        198337   90718    97379   49% /boot

  /dev/md0        3020688   70048  2797196    3% /mnt/raid

  鐪嬪埌浜嗗惂錛屾渶鍚庝竴涓錛屾槸涓嶆槸寰堟湁鎴愬氨鎰燂紝=_=

====浠跨湡RAID閿欒鐨勬晳鎻存ā寮====

# mdadm 鈥搈anage /dev/md[0-9] [--add 璁懼嘳 [--remove 璁懼嘳 [--fail 璁懼嘳

鈥揳dd錛氬皢鍚庨潰鐨勮懼囧姞鍏ュ埌榪欎釜md涓

鈥搑emove錛氬皢鍚庨潰鐨勮懼囦粠榪欎釜md涓鍒犻櫎

鈥揻ail錛氬皢鍚庨潰鐨勮懼囪劇疆鎴愬嚭閿欑殑鐘舵

鎵嬪姩妯℃嫙紓佺洏閿欒錛

# cp -a /etc /var/log /mnt/raid/

# df -h /mnt/raid/; -smh /mnt/raid/*

  鏂囦歡緋葷粺        瀹歸噺  宸茬敤  鍙鐢 宸茬敤% 鎸傝澆鐐

  /dev/md0        2.9G  126M  2.7G    5% /mnt/raid

  45M    /mnt/raid/etc

  4.4M    /mnt/raid/log

  16K    /mnt/raid/lost+found

# mdadm 鈥搈anage /dev/md0 鈥揻ail /dev/sda10

  mdadm: set /dev/sda10 faulty in /dev/md0

鐒跺悗椹涓婃煡鐪嬬姸鎬侊紝榪欎釜鍔ㄤ綔瑕佸揩鐐癸紝鍥犱負raid浼氳嚜鍔ㄩ噸寤烘暟鎹緋葷粺錛

澶嶅埗浠g爜

  

浠g爜濡備笅:

# mdadm --detail /dev/md0

  /dev/md0:

  Version : 1.2

  Creation Time : Sun Oct 28 10:03:43 2012

  Raid Level : raid5

  Array Size : 3068928 (2.93 GiB 3.14 GB)

  Used Dev Size : 1022976 (999.17 MiB 1047.53 MB)

  Raid Devices : 4

  Total Devices : 5

  Persistence : Superblock is persistent

Update Time : Sun Oct 28 10:24:42 2012

  State : clean, degraded, recovering

  Active Devices : 3

  Working Devices : 4

  Failed Devices : 1

  Spare Devices : 1

Layout : left-symmetric

  Chunk Size : 512K

Rebuild Status : 6% complete

Name : localhost.localdomain:0 (local to host localhost.localdomain)

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

  Events : 23

Number Major Minor RaidDevice State

  0 8 9 0 active sync /dev/sda9

  4 8 13 1 spare rebuilding /dev/sda13

  2 8 11 2 active sync /dev/sda11

  5 8 12 3 active sync /dev/sda12

1 8 10 - faulty spare /dev/sda10

鍠濆畬鍜栧暋鍚庯紝鐪嬩竴涓嬶紙鍏跺疄涔熷氨1鍒嗛挓宸﹀彸錛

澶嶅埗浠g爜

  

浠g爜濡備笅:

# mdadm --detail /dev/md0

  /dev/md0:

  Version : 1.2

  Creation Time : Sun Oct 28 10:03:43 2012

  Raid Level : raid5

  Array Size : 3068928 (2.93 GiB 3.14 GB)

  Used Dev Size : 1022976 (999.17 MiB 1047.53 MB)

  Raid Devices : 4

  Total Devices : 5

  Persistence : Superblock is persistent

Update Time : Sun Oct 28 10:26:53 2012

  State : clean

  Active Devices : 4

  Working Devices : 4

  Failed Devices : 1

  Spare Devices : 0

Layout : left-symmetric

  Chunk Size : 512K

Name : localhost.localdomain:0 (local to host localhost.localdomain)

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

  Events : 43

Number Major Minor RaidDevice State

  0 8 9 0 active sync /dev/sda9

  4 8 13 1 active sync /dev/sda13

  2 8 11 2 active sync /dev/sda11

  5 8 12 3 active sync /dev/sda12

1 8 10 - faulty spare /dev/sda10

鐪嬪埌浜嗗惂錛屼笉鐢ㄦ垜鏉ョ粰浣犺В閲婁簡鍚с

鎺ヤ笅鏉ワ紝鎴戝皢鍑洪敊鐨勭佺洏鍒犻櫎騫跺姞鍏ユ柊鐨勭佺洏錛

棣栧厛錛屽厛鏂板緩涓涓鏂扮殑鍒嗗尯錛岃繖涓鍒嗗尯澶у皬瑕佷笌鍏朵粬鐨勫垎鍖轟竴鏍峰ぇ鎵嶅ソ銆傜劧鍚庡啀鐢╩dadm鍒犻櫎閿欒鐨勫苟鍔犲叆鏂扮殑

# fdisk /dev/sda

鈥.涓嬮潰寤烘柊鍒嗗尯姝ラょ渷鐣ワ紝濡傛灉涓嶇煡閬撴庝箞寤猴紝鍙傝冩垜鐨勪紒楣呮棩璁幫紙涓錛

# partprobe

# partprobe

  [root@localhost ~]# mdadm 鈥搈anage /dev/md0 鈥揳dd /dev/sda14 鈥搑emove /dev/sda10

  mdadm: added /dev/sda14

  mdadm: hot removed /dev/sda10 from /dev/md0

澶嶅埗浠g爜

  

浠g爜濡備笅:

# mdadm --detail /dev/md0

  /dev/md0:

  Version : 1.2

  Creation Time : Sun Oct 28 10:03:43 2012

  Raid Level : raid5

  Array Size : 3068928 (2.93 GiB 3.14 GB)

  Used Dev Size : 1022976 (999.17 MiB 1047.53 MB)

  Raid Devices : 4

  Total Devices : 5

  Persistence : Superblock is persistent

Update Time : Sun Oct 28 10:33:04 2012

  State : clean

  Active Devices : 4

  Working Devices : 5

  Failed Devices : 0

  Spare Devices : 1

Layout : left-symmetric

  Chunk Size : 512K

Name : localhost.localdomain:0 (local to host localhost.localdomain)

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

  Events : 45

Number Major Minor RaidDevice State

  0 8 9 0 active sync /dev/sda9

  4 8 13 1 active sync /dev/sda13

  2 8 11 2 active sync /dev/sda11

  5 8 12 3 active sync /dev/sda12

6 8 14 - spare /dev/sda14

鐪嬪埌浜嗗惂錛岀粨鏋滀笉鐢ㄦ垜瑙i噴浜嗗惂銆傘傚搱鍝

鑰岃繖涓鍒囩殑涓鍒囬兘鏄痮nline鐨勭姸鎬佷笅瀹屾垚鐨勶紝鏄涓嶆槸寰圢B鍛  =_=

====寮鏈鴻嚜鍔ㄦ寕杞絉AID====

鍙闇瑕佺煡閬/dev/md0鐨刄UID灝辮

# mdadm 鈥揹etail /dev/md0 | grep -i uuid

  UUID : 657db303:887c7b6f:b8d8fc91:dc7b3374

# vi /etc/mdadm.conf

  ARRAY /dev/md0 UUID=657db303:887c7b6f:b8d8fc91:dc7b3374

  # vi /etc/fstab錛屽湪鏈鍚庝竴琛屽姞鍏

/dev/md0 /mnt/raid ext4 defaults 1 2

嫻嬭瘯涓嬪彲琛屽惁錛堣繖涓寰堥噸瑕侊紝鍥犱負濡傛灉fstab淇鏀逛笉瀵瑰彲鑳藉艱嚧寮涓嶄簡鏈哄櫒錛

# umount /dev/md0; mount -a

  [root@localhost ~]# df /mnt/raid/

  鏂囦歡緋葷粺         1K-鍧   宸茬敤    鍙鐢 宸茬敤% 鎸傝澆鐐

  /dev/md0       3020688 120464 2746780    5% /mnt/raid

  OK錛屾病鏈夐棶棰橈紝閭d箞浣犲氨鍙浠ラ噸鍚浜嗭紝鐪嬫槸涓嶆槸鑷鍔ㄦ寕杞戒簡鍛銆

====鍏抽棴RAID====

1錛屽厛鍗歌澆

# umount /dev/md0

2錛屽垹闄ら厤緗鏂囦歡鍐呭癸細

# vi /etc/fstab錛屽垹闄わ紙娉ㄩ噴錛変笅闈㈣繖琛

/dev/md0 /mnt/raid ext4 defaults 1 2

3錛屽叧闂/dev/md0錛

# mdadm 鈥搒top /dev/md0

4錛# cat /proc/mdstat

  Personalities : [raid6] [raid5] [raid4]

  unused devices: none

5錛寁i /etc/mdadm.conf錛屽垹闄わ紙娉ㄩ噴錛変笅闈㈢殑琛

ARRAY /dev/md0 UUID=657db303:887c7b6f:b8d8fc91:dc7b3374

濂界殑錛屾墍鏈夌殑RAID鐨勫熀鏈閮借插畬浜嗐備笉榪囦笂闈㈡垜鐢ㄧ殑鏃朵竴鍧楃佺洏錛屽疄闄呯敤閫斾腑璁板緱鐢ㄥ氬潡紓佺洏鍟婏紒錛

=======================================END=========================================

閱讀全文

與linuxraid刪除相關的資料

熱點內容
沒有伺服器怎麼發現其他節點 瀏覽:335
文明傳奇怎麼開伺服器 瀏覽:56
javalistint 瀏覽:675
程序員到公司當領導 瀏覽:225
用演算法控制玩家的行為 瀏覽:482
androidsdk17下載 瀏覽:792
怎麼給單獨表格添加密碼 瀏覽:12
下載壓縮密碼 瀏覽:259
android系統上編程 瀏覽:469
單片機模擬i2c從機 瀏覽:238
教育年報系統伺服器如何開啟 瀏覽:842
對稱密鑰加密後的長度 瀏覽:294
微製造編程軟體下載 瀏覽:107
旋住宿酒店用哪個App最好 瀏覽:60
三菱編程中怎麼創建子程序 瀏覽:201
在單片機溫度輸入採集信號有 瀏覽:686
電腦雲伺服器同步 瀏覽:420
方舟生存進化手游版怎麼轉伺服器 瀏覽:90
哪個app可以聽小說 瀏覽:162
網路發送數據如何加密 瀏覽:203