Hard drive failure (HD0) simulation under Fedora 13 with RAID1 software mirror (on a Michael Dell GX260, 2x20G system disks, RAID1 software mirror):
Power off GX260, remove HD0, swap HD1 instead HD0, mount your new hard disk as HD1 (another WD200, 20G, manufacture date: July 4th, 2002, 8 years old ~ almost like a bottle of wine), power up system:
[root@~]# fdisk -l /dev/sda
Disk /dev/sda: 20.0 GB, 20000000000 bytes
255 heads, 63 sectors/track, 2431 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006aa5b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 fd Linux raid autodetect
/dev/sda2 26 537 4106240 fd Linux raid autodetect
/dev/sda3 537 666 1034240 fd Linux raid autodetect
/dev/sda4 666 2432 14184448 5 Extended
/dev/sda5 666 1177 4106240 fd Linux raid autodetect
/dev/sda6 1178 1689 4106240 fd Linux raid autodetect
/dev/sda7 1689 1753 512000 fd Linux raid autodetect
/dev/sda8 1753 2432 5455872 fd Linux raid autodetect
[root@~]# fdisk -l /dev/sdb
Disk /dev/sdb: 20.0 GB, 20000000000 bytes
255 heads, 63 sectors/track, 2431 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2b2b2b2b
Disk /dev/sdb doesn’t contain a valid partition table
[root@~]# sfdisk -d /dev/sda | sfdisk -f /dev/sdb
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Checking that no-one is using this disk right now …
OK
Disk /dev/sdb: 2431 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = sectors of 512 bytes, counting from 0
Device Boot Start End #sectors Id System
/dev/sdb1 * 2048 411647 409600 fd Linux raid autodetect
/dev/sdb2 411648 8624127 8212480 fd Linux raid autodetect
/dev/sdb3 8624128 10692607 2068480 fd Linux raid autodetect
/dev/sdb4 10692608 39061503 28368896 5 Extended
/dev/sdb5 10694656 18907135 8212480 fd Linux raid autodetect
/dev/sdb6 18909184 27121663 8212480 fd Linux raid autodetect
/dev/sdb7 27123712 28147711 1024000 fd Linux raid autodetect
/dev/sdb8 28149760 39061503 10911744 fd Linux raid autodetect
Warning: partition 1 does not end at a cylinder boundary
Successfully wrote the new partition table
Re-reading the partition table …
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
[root@~]# tail -100 /var/log/messages
Jul 25 13:27:30 kernel: sdb: unknown partition table
Jul 25 13:27:31 kernel: sdb: sdb1 sdb2 sdb3 sdb4 < sdb5 sdb6 sdb7 sdb8 >
[root@~]# fdisk -l /dev/sdb
Disk /dev/sdb: 20.0 GB, 20000000000 bytes
255 heads, 63 sectors/track, 2431 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2b2b2b2b
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 26 204800 fd Linux raid autodetect
/dev/sdb2 26 537 4106240 fd Linux raid autodetect
/dev/sdb3 537 666 1034240 fd Linux raid autodetect
/dev/sdb4 666 2432 14184448 5 Extended
/dev/sdb5 666 1177 4106240 fd Linux raid autodetect
/dev/sdb6 1178 1689 4106240 fd Linux raid autodetect
/dev/sdb7 1689 1753 512000 fd Linux raid autodetect
/dev/sdb8 1753 2432 5455872 fd Linux raid autodetect
[root@~]# cat /proc/mdstat
Personalities : [raid1]
md6 : active raid1 sda8[1]
5454840 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md5 : active raid1 sda7[2]
511992 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md4 : active raid1 sda6[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md3 : active raid1 sda5[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md2 : active raid1 sda3[1]
1034232 blocks super 1.1 [2/1] [_U]
md1 : active raid1 sda2[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md0 : active raid1 sda1[1]
204788 blocks super 1.0 [2/1] [_U]
[root@~]# mdadm –detail /dev/md0
/dev/md0:
Version : 1.0
Creation Time : Tue Jul 20 17:23:15 2010
Raid Level : raid1
Array Size : 204788 (200.02 MiB 209.70 MB)
Used Dev Size : 204788 (200.02 MiB 209.70 MB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Sun Jul 25 13:24:49 2010
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : localhost.localdomain:0
UUID : 287d4602:92e45868:b43b0181:dc86d27a
Events : 164
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 1 1 active sync /dev/sda1
[root@~]# mdadm –add /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
[root@~]# mdadm –detail /dev/md0
/dev/md0:
Version : 1.0
Creation Time : Tue Jul 20 17:23:15 2010
Raid Level : raid1
Array Size : 204788 (200.02 MiB 209.70 MB)
Used Dev Size : 204788 (200.02 MiB 209.70 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Sun Jul 25 13:31:07 2010
State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Rebuild Status : 30% complete
Name : localhost.localdomain:0
UUID : 287d4602:92e45868:b43b0181:dc86d27a
Events : 180
Number Major Minor RaidDevice State
2 8 17 0 spare rebuilding /dev/sdb1
1 8 1 1 active sync /dev/sda1
[root@~]# mdadm –detail /dev/md0
/dev/md0:
Version : 1.0
Creation Time : Tue Jul 20 17:23:15 2010
Raid Level : raid1
Array Size : 204788 (200.02 MiB 209.70 MB)
Used Dev Size : 204788 (200.02 MiB 209.70 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Sun Jul 25 13:31:14 2010
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : localhost.localdomain:0
UUID : 287d4602:92e45868:b43b0181:dc86d27a
Events : 208
Number Major Minor RaidDevice State
2 8 17 0 active sync /dev/sdb1
1 8 1 1 active sync /dev/sda1
[root@~]# mdadm –detail /dev/md6
/dev/md6:
Version : 1.1
Creation Time : Tue Jul 20 17:23:53 2010
Raid Level : raid1
Array Size : 5454840 (5.20 GiB 5.59 GB)
Used Dev Size : 5454840 (5.20 GiB 5.59 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Jul 25 13:24:49 2010
State : active, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : localhost.localdomain:6
UUID : ce89732a:5e6407fd:871f6954:8b61ecc6
Events : 206
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 8 1 active sync /dev/sda8
[root@~]# mdadm –add /dev/md6 /dev/sdb8
mdadm: added /dev/sdb8
[root@~]# mdadm –detail /dev/md6
/dev/md6:
Version : 1.1
Creation Time : Tue Jul 20 17:23:53 2010
Raid Level : raid1
Array Size : 5454840 (5.20 GiB 5.59 GB)
Used Dev Size : 5454840 (5.20 GiB 5.59 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Jul 25 13:56:42 2010
State : active, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Rebuild Status : 1% complete
Name : localhost.localdomain:6
UUID : ce89732a:5e6407fd:871f6954:8b61ecc6
Events : 212
Number Major Minor RaidDevice State
2 8 24 0 spare rebuilding /dev/sdb8
1 8 8 1 active sync /dev/sda8
[root@~]# mdadm –detail /dev/md6
/dev/md6:
Version : 1.1
Creation Time : Tue Jul 20 17:23:53 2010
Raid Level : raid1
Array Size : 5454840 (5.20 GiB 5.59 GB)
Used Dev Size : 5454840 (5.20 GiB 5.59 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Sun Jul 25 13:56:47 2010
State : active, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Rebuild Status : 4% complete
Name : localhost.localdomain:6
UUID : ce89732a:5e6407fd:871f6954:8b61ecc6
Events : 216
Number Major Minor RaidDevice State
2 8 24 0 spare rebuilding /dev/sdb8
1 8 8 1 active sync /dev/sda8
[root@~]# cat /proc/mdstat
Personalities : [raid1]
md6 : active raid1 sdb8[2] sda8[1]
5454840 blocks super 1.1 [2/1] [_U]
[=====>...............] recovery = 25.7% (1405440/5454840) finish=2.2min speed=30092K/sec
bitmap: 1/1 pages [4KB], 65536KB chunk
md5 : active raid1 sdb7[3] sda7[2]
511992 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md4 : active raid1 sda6[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md3 : active raid1 sda5[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md2 : active raid1 sda3[1]
1034232 blocks super 1.1 [2/1] [_U]
md1 : active raid1 sda2[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md0 : active raid1 sdb1[2] sda1[1]
204788 blocks super 1.0 [2/2] [UU]
unused devices:
[root@~]# cat /proc/mdstat
Personalities : [raid1]
md6 : active raid1 sdb8[2] sda8[1]
5454840 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md5 : active raid1 sdb7[3] sda7[2]
511992 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md4 : active raid1 sda6[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md3 : active raid1 sda5[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md2 : active raid1 sda3[1]
1034232 blocks super 1.1 [2/1] [_U]
md1 : active raid1 sda2[1]
4105208 blocks super 1.1 [2/1] [_U]
bitmap: 1/1 pages [4KB], 65536KB chunk
md0 : active raid1 sdb1[2] sda1[1]
204788 blocks super 1.0 [2/2] [UU]
unused devices:
[root@~]# mdadm –add /dev/md2 /dev/sdb3
mdadm: added /dev/sdb3
[root@~]# mdadm –detail /dev/md2
/dev/md2:
Version : 1.1
Creation Time : Tue Jul 20 17:23:27 2010
Raid Level : raid1
Array Size : 1034232 (1010.16 MiB 1059.05 MB)
Used Dev Size : 1034232 (1010.16 MiB 1059.05 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Sun Jul 25 14:08:38 2010
State : clean, degraded
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1
Name : localhost.localdomain:2
UUID : 8775b7b9:8a08626c:15abe820:0723e0a5
Events : 198
Number Major Minor RaidDevice State
2 8 19 0 spare rebuilding /dev/sdb3
1 8 3 1 active sync /dev/sda3
[root@~]# cat /proc/mdstat
Personalities : [raid1]
md6 : active raid1 sdb8[2] sda8[1]
5454840 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md5 : active raid1 sdb7[3] sda7[2]
511992 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md4 : active raid1 sdb6[2] sda6[1]
4105208 blocks super 1.1 [2/1] [_U]
[============>........] recovery = 61.4% (2524672/4105208) finish=1.2min speed=20999K/sec
bitmap: 1/1 pages [4KB], 65536KB chunk
md3 : active raid1 sdb5[2] sda5[1]
4105208 blocks super 1.1 [2/1] [_U]
resync=DELAYED
bitmap: 1/1 pages [4KB], 65536KB chunk
md2 : active raid1 sdb3[2] sda3[1]
1034232 blocks super 1.1 [2/1] [_U]
resync=DELAYED
md1 : active raid1 sdb2[2] sda2[1]
4105208 blocks super 1.1 [2/2] [UU]
bitmap: 0/1 pages [0KB], 65536KB chunk
md0 : active raid1 sdb1[2] sda1[1]
204788 blocks super 1.0 [2/2] [UU]
unused devices:
[root@~]#