software RAID 筆記
1,software RAID Configuration
Create and define RAID devices using mdadm
mdadm -C /dev/md0 -a yes -l 1 -n 2 -x 1 /dev/sda1 /dev/sdb1 /dev/sdc1
-l: raid級別
-n: 硬碟數
-x: 熱備份硬碟數
format each RAID device with a filesystem
mke2fs -j /dev/md0
test the RAID devices
mdadm allows you to check the status of your RAID devices
mdadm --detail /dev/md0[@more@]
2,software RAID testing and recovery
simulating disk failures
mdadm /dev/md0 -f /dev/sda1
(模擬sda1硬碟壞 )
recovering from a software RAID disk failure
replace the failed hard drive and power on
reconstruct partitions on the replacement drive
增加新硬碟
mdadm /dev/md0 -a /dev/sda1
刪除硬碟
mdadm /dev/md0 -r /dev/sda1
mdadm,/proc/mdstat,and syslog messages
例子:
1,準備的分割槽資訊
/dev/sda5 1864 1988 1004031 83 Linux
/dev/sda6 1989 2113 1004031 83 Linux
/dev/sda7 2114 2238 1004031 83 Linux
2,建立陣列
[root@tonykorn97 ~]# mdadm -C /dev/md0 -a yes -l 1 -n 2 -x 1 /dev/sda{5,6,7}
mdadm: /dev/sda5 appears to contain an ext2fs file system
size=1004028K mtime=Sun May 18 06:03:36 2008
Continue creating array? y
mdadm: array /dev/md0 started.
此時fdisk 可以檢視到/dev/md0分割槽
[root@tonykorn97 ~]# fdisk -l
...
Disk /dev/md0: 1027 MB, 1027997696 bytes
2 heads, 4 sectors/track, 250976 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
3,格式化分割槽並掛載
[root@tonykorn97 ~]# mkfs.ext3 /dev/md0
...
[root@tonykorn97 ~]# mkdir /data
[root@tonykorn97 ~]# mount /dev/md0 /data
4,檢視當前raid資訊
[root@tonykorn97 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sun Jul 13 10:15:49 2008
Raid Level : raid1
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Jul 13 10:17:27 2008
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
UUID : 95695625:471aa8d7:1d74ab8c:1224f36e
Events : 0.2
Number Major Minor RaidDevice State
0 8 5 0 active sync /dev/sda5
1 8 6 1 active sync /dev/sda6
2 8 7 - spare /dev/sda7
[root@tonykorn97 ~]#
4,模擬一個硬碟壞
[root@tonykorn97 ~]# mdadm --fail /dev/md0 /dev/sda5
mdadm: set /dev/sda5 faulty in /dev/md0
此時raid的狀態
[root@tonykorn97 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sun Jul 13 10:15:49 2008
Raid Level : raid1
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Jul 13 10:20:03 2008
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 1
Spare Devices : 1
Rebuild Status : 41% complete
UUID : 95695625:471aa8d7:1d74ab8c:1224f36e
Events : 0.4
Number Major Minor RaidDevice State
2 8 7 0 spare rebuilding /dev/sda7
1 8 6 1 active sync /dev/sda6
3 8 5 - faulty spare /dev/sda5
[root@tonykorn97 ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda7[2] sda6[1] sda5[3](F)
1003904 blocks [2/1] [_U]
[============>........] recovery = 64.6% (649344/1003904) finish=0.2min speed=20946K/sec
unused devices:
[root@tonykorn97 ~]#
陣列用備用盤代替壞掉硬碟後的狀態:
[root@tonykorn97 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sun Jul 13 10:15:49 2008
Raid Level : raid1
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Jul 13 10:20:53 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 1
Spare Devices : 0
UUID : 95695625:471aa8d7:1d74ab8c:1224f36e
Events : 0.6
Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7
1 8 6 1 active sync /dev/sda6
2 8 5 - faulty spare /dev/sda5
[root@tonykorn97 ~]#
移出這個出問題的磁碟:
[root@tonykorn97 ~]# mdadm --remove /dev/md0 /dev/sda5
mdadm: hot removed /dev/sda5
[root@tonykorn97 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sun Jul 13 10:15:49 2008
Raid Level : raid1
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Jul 13 10:23:11 2008
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
UUID : 95695625:471aa8d7:1d74ab8c:1224f36e
Events : 0.8
Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7
1 8 6 1 active sync /dev/sda6
[root@tonykorn97 ~]#
新增硬碟
[root@tonykorn97 ~]# mdadm -a /dev/md0 /dev/sda5
mdadm: added /dev/sda5
You have new mail in /var/spool/mail/root
[root@tonykorn97 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Sun Jul 13 10:15:49 2008
Raid Level : raid1
Array Size : 1003904 (980.54 MiB 1028.00 MB)
Device Size : 1003904 (980.54 MiB 1028.00 MB)
Raid Devices : 2
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Sun Jul 13 10:23:45 2008
State : clean
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
UUID : 95695625:471aa8d7:1d74ab8c:1224f36e
Events : 0.8
Number Major Minor RaidDevice State
0 8 7 0 active sync /dev/sda7
1 8 6 1 active sync /dev/sda6
2 8 5 - spare /dev/sda5
[root@tonykorn97 ~]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-1007484/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux Software RAID step by stepLinuxAI
- [筆記]Oracle與RAID筆記OracleAI
- How to set up Software raid1 configuration on a running systemAI
- centos5.4上soft raid之/etc/mdadm.conf學習筆記CentOSAI筆記
- Raid Raid0 Raid1 Raid5 Raid0+1 Raid1+0AI
- linux raid 0 raid 1 raid 10LinuxAI
- Manifesto of Software CraftsmanshipRaft
- Raid1 Raid2 Raid5 Raid6 Raid10如何選擇使用AI
- sysbench fileio 壓測磁碟raid 5 raid 1 raid10 raid 50 情況AI
- RAID0、RAID1、RAID0+1、RAID5原理介紹AI
- Cisco Firepower 1000 Series FTD Software 7.6.0 & ASA Software 9.22.1
- Cisco Firepower 9300 Series FTD Software 7.6.0 & ASA Software 9.22.1
- Cisco Firepower 4100 Series FTD Software 7.6.0 & ASA Software 9.22.1
- raid1 raid2 raid5 raid6 raid10的優缺點和做各自raid需要幾塊硬碟AI硬碟
- 磁碟陣列關於Raid0,Raid1,Raid5,Raid10陣列AI
- Software Code Areas (105)
- 印象筆記 --- 方法分享筆記筆記
- RAIDAI
- 掃盲:Raid0、Raid1、Raid5及Raid10的區別AI
- Cisco Secure Firewall 3100 Series FTD Software 7.6.0 & ASA Software 9.22.1
- 筆記筆記
- raid1+0 and raid0+1AI
- How to Relink Oracle Database SoftwareOracleDatabase
- Oracle software下載地址列表Oracle
- [轉載] The role of the Software Architect
- Heavy Duty Truck Diagnostic Scanner and Software
- RAID卡AI
- 磁碟RAIDAI
- CUUG筆記 ORACLE索引學習筆記筆記Oracle索引
- 主動筆記與被動筆記筆記
- 淘寶記錄筆記筆記
- 轉載:RAID5和RAID10,哪種RAID更適合你AI
- Raid0/raid1/raid5磁碟陣列資料恢復思路AI陣列資料恢復
- oracle orion 壓測磁碟效能raid10 raid5 raid50 資料OracleAI
- Ubuntu: 軟體庫(software repositories)Ubuntu
- Top free and open source log management software
- 【亞馬遜誠招】Software Development Engineer - Interns亞馬遜dev
- Software Packages in `experimental' - 安裝方法(轉)Package