本文共 20473 字,大约阅读时间需要 68 分钟。
关闭rac1机器;
[root@rac1 /]# shutdown -g0 -y rac2 启动iscsi服务(iscsi配置的和rac1一样,也就是说,rac2这个时候既是服务端,又是客户端)[root@rac2 ~]# /etc/init.d/iscsi start
Checking iscsi config: [ OK ]Loading iscsi driver: [ OK ]mknod: `/dev/iscsictl': File existsStarting iscsid: [ OK ][root@rac2 ~]# fdisk -l...Disk /dev/sdb: 536 MB, 536870912 bytes64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac2 ~]# dmesg信息:scsi3 : SFNet iSCSI driver Vendor: IET Model: VIRTUAL-DISK Rev: 0 Type: Direct-Access ANSI SCSI revision: 04SCSI device sdc: 1048576 512-byte hdwr sectors (537 MB)SCSI device sdc: drive cache: write throughSCSI device sdc: 1048576 512-byte hdwr sectors (537 MB)SCSI device sdc: drive cache: write through sdc: unknown partition tableAttached scsi disk sdc at scsi3, channel 0, id 0, lun 4[root@rac2 ~]#sdc就是新增加的硬盘,挂载设备,写文件测试:
[root@rac2 ~]# mkdir /mnt/sdc[root@rac2 ~]# mount /dev/sdc /mnt/sdc[root@rac2 ~]# cd /mnt/sdc[root@rac2 sdc]# lslost+found nohup.out rac120071026 test[root@rac2 sdc]# touch rac2_20071026[root@rac2 sdc]# lslost+found nohup.out rac120071026 rac2_20071026 test[root@rac2 sdc]# cd /[root@rac2 /]# umount /dev/sdc[root@rac2 /]# /etc/init.d/iscsi stopSearching for iscsi-based multipath mapsFound 0 mapsStopping iscsid: [ OK ]Removing iscsi driver: [ OK ][root@rac2 /]# 启动rac1 fdisk -l状态:[root@rac1 ~]# fdisk -l......Disk /dev/sdb: 536 MB, 536870912 bytes64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/md0: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylindersUnits = cylinders of 8 * 512 = 4096 bytesDisk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
mdadm状态:[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[0] 524224 blocks [2/1] [U_]unused devices: [root@rac1 ~]# mdadm --detail /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 1Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 01:10:11 2007
State : clean, degraded Active Devices : 1Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.190[root@rac1 ~]#停止阵列:
[root@rac1 /]# mdadm -S /dev/md0[root@rac1 /]# fdisk -l......Disk /dev/sdb: 536 MB, 536870912 bytes64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
启动阵列的时候只启动了一个盘
[root@rac1 /]# mdadm -A /dev/md0 /dev/sdb /dev/sdcmdadm: /dev/md0 has been started with 1 drive (out of 2).[root@rac1 /]# mount /dev/md0 /mnt/md0[root@rac1 /]# cd /mnt/md0[root@rac1 md0]# lslost+found nohup.out rac120071026 test从上面可以看到在rac2机器上写的文件不存在
查看raid状态:[root@rac1 md0]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[0] 524224 blocks [2/1] [U_]unused devices: [root@rac1 md0]# mdadm --detail /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 1Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 09:17:11 2007
State : clean, degraded Active Devices : 1Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.196[root@rac1 md0]#在阵列中增加新的硬盘:
[root@rac1 md0]# mdadm /dev/md0 --add /dev/sdcmdadm: hot added /dev/sdc察看raid状态
[root@rac1 md0]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdc[2] sdb[0] 524224 blocks [2/1] [U_] [==>..................] recovery = 12.6% (66688/524224) finish=1.5min speed=4763K/secunused devices: [root@rac1 md0]# mdadm --detail /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 2Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 09:19:08 2007
State : clean, degraded, recovering Active Devices : 1Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 30% completeNumber Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed 2 8 32 1 spare /dev/sdc UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.197[root@rac1 md0]#重新测试:
rac1上操作,卸载硬盘,禁用raid,停止iscsi。[root@rac1 /]# umount /dev/md0[root@rac1 /]# mdadm -S /dev/md0[root@rac1 /]# /etc/init.d/iscsi stopSearching for iscsi-based multipath mapsFound 0 mapsStopping iscsid: [ OK ]Removing iscsi driver: [ OK ][root@rac1 /]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
[root@rac1 /]# rac2上启动iscsi,加载硬盘,写入数据,停止硬盘,停止iscsi[root@rac2 /]# /etc/init.d/iscsi startChecking iscsi config: [ OK ]Loading iscsi driver: [ OK ]mknod: `/dev/iscsictl': File existsStarting iscsid: [ OK ][root@rac2 /]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac2 /]# mount /dev/sdc /mnt/sdc[root@rac2 /]# cd /mnt/sdc[root@rac2 sdc]# lslost+found nohup.out rac120071026 test[root@rac2 sdc]# touch rac2_20071026[root@rac2 sdc]# cd /[root@rac2 /]# umount /dev/sdc[root@rac2 /]# /etc/init.d/iscsi stopSearching for iscsi-based multipath mapsFound 0 mapsStopping iscsid: [ OK ]Removing iscsi driver: [ OK ][root@rac2 /]#rac1上启动iscsi,
[root@rac1 /]# /etc/init.d/iscsi startChecking iscsi config: [ OK ]Loading iscsi driver: [ OK ]mknod: `/dev/iscsictl': File existsStarting iscsid: [ OK ][root@rac1 /]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac1 /]# [root@rac1 /]# mdadm -As /dev/md0mdadm: /dev/md0 has been started with 2 drives.[root@rac1 /]# cat /proc/mdstat Personalities : [raid1] md0 : active raid1 sdb[0] sdc[1] 524224 blocks [2/2] [UU]unused devices: [root@rac1 /]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 2Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 09:25:21 2007
State : clean Active Devices : 2Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 8 32 1 active sync /dev/sdc UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.208[root@rac1 /]#[root@rac1 /]# mount /dev/md0 /mnt/md0
[root@rac1 /]# cd /mnt/md0[root@rac1 md0]# ls -altotal 21drwxr-xr-x 3 root root 1024 Oct 26 03:42 .drwxr-xr-x 3 root root 4096 Oct 25 14:55 ..drwx------ 2 root root 12288 Oct 25 15:31 lost+found-rw------- 1 root root 0 Oct 26 01:01 nohup.out-rw-r--r-- 1 root root 0 Oct 26 01:08 rac120071026?--------- ? ? ? ? ? rac2_20071026-rw-r--r-- 1 root root 0 Oct 25 15:32 test[root@rac1 mnt]# mdadm /dev/md0 -f /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0[root@rac1 mnt]# mdadm /dev/md0 -r /dev/sdbmdadm: hot removed /dev/sdb[root@rac1 mnt]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdc[1] 524224 blocks [2/1] [_U]unused devices: [root@rac1 mnt]# mdadm /dev/md0 -a /dev/sdbmdadm: hot added /dev/sdb[root@rac1 mnt]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[2] sdc[1] 524224 blocks [2/1] [_U] [=>...................] recovery = 8.3% (44032/524224) finish=2.1min speed=3669K/secunused devices: [root@rac1 mnt]#重新卸载设备后,再重新加载,加载后文件如下:
[root@rac1 md0]# ls -altotal 21drwxr-xr-x 3 root root 1024 Oct 26 03:42 .drwxr-xr-x 3 root root 4096 Oct 25 14:55 ..drwx------ 2 root root 12288 Oct 25 15:31 lost+found-rw------- 1 root root 0 Oct 26 01:01 nohup.out-rw-r--r-- 1 root root 0 Oct 26 01:08 rac120071026-rw-r--r-- 1 root root 0 Oct 26 03:42 rac2_20071026-rw-r--r-- 1 root root 0 Oct 25 15:32 test[root@rac1 md0]#正常。
再模拟rac1关机。
rac2操作:[root@rac2 /]# /etc/init.d/iscsi startChecking iscsi config: [ OK ]Loading iscsi driver: [ OK ]mknod: `/dev/iscsictl': File existsStarting iscsid: [ OK ][root@rac2 /]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac2 /]# mount /dev/sdc /mnt/sdc[root@rac2 /]# cd /mnt/sdc[root@rac2 sdc]# lslost+found nohup.out rac120071026 rac2_20071026 test[root@rac2 sdc]# vi rac2aaaaaaaaaaaaaaaa
wq"rac2" [New] 1L, 17C written [root@rac2 sdc]# lslost+found nohup.out rac120071026 rac2 rac2_20071026 test[root@rac2 sdc]# cd /[root@rac2 /]# umount /dev/sdc[root@rac2 /]# /etc/init.d/iscsi stopSearching for iscsi-based multipath mapsFound 0 mapsStopping iscsid: [ OK ]Removing iscsi driver: [ OK ][root@rac2 /]#启动rac1
[root@rac1 ~]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/md0: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylindersUnits = cylinders of 8 * 512 = 4096 bytesDisk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[0] 524224 blocks [2/1] [U_]unused devices: [root@rac1 ~]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 1Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 09:39:43 2007
State : clean, degraded Active Devices : 1Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.334[root@rac1 ~]# mdadm /dev/md0 -f /dev/sdbmdadm: set /dev/sdb faulty in /dev/md0[root@rac1 ~]# mdadm /dev/md0 -r /dev/sdbmdadm: hot remove failed for /dev/sdb: Device or resource busy[root@rac1 ~]# mdadm /dev/md0 -a /dev/sdcmdadm: hot added /dev/sdc[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdc[2] sdb[0] 524224 blocks [2/1] [U_] [=>...................] recovery = 7.6% (40704/524224) finish=1.7min speed=4522K/secunused devices: [root@rac1 ~]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 2Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 09:59:02 2007
State : clean, degraded, recovering Active Devices : 1Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 37% completeNumber Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed 2 8 32 1 spare /dev/sdc UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.335[root@rac1 ~]#不成功。/dev/sdc资料丢失。
重新测试:
[root@rac1 ~]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/md0: 536 MB, 536805376 bytes
2 heads, 4 sectors/track, 131056 cylindersUnits = cylinders of 8 * 512 = 4096 bytesDisk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac1 ~]# mdadm -S /dev/md0
[root@rac1 ~]# fdisk -lDisk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux/dev/sda2 893 1274 3068415 82 Linux swap/dev/sda3 1275 2610 10731420 83 LinuxDisk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesDisk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 536 MB, 536870912 bytes
17 heads, 61 sectors/track, 1011 cylindersUnits = cylinders of 1037 * 512 = 530944 bytesDisk /dev/sdc doesn't contain a valid partition table
[root@rac1 ~]# mdadm -As /dev/md0 mdadm: /dev/md0 has been started with 1 drive (out of 2).[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[0] 524224 blocks [2/1] [U_]unused devices: [root@rac1 ~]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 1Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 10:01:53 2007
State : clean, degraded Active Devices : 1Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 16 0 active sync /dev/sdb 1 0 0 -1 removed UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.448 正确的操作应该是:关闭阵列:[root@rac1 ~]# mdadm -S /dev/md0启动阵列只启动一个硬盘报错:
[root@rac1 ~]# mdadm -A /dev/md0 /dev/sdcmdadm: /dev/md0 assembled from 1 drive - need all 2 to start it (use --run to insist).查看帮助:
[root@rac1 ~]# mdadm -A --helpUsage: mdadm --assemble device options... mdadm --assemble --scan options...Options that are valid with --assemble (-A) are: --uuid= -u : uuid of array to assemble. Devices which don't have this uuid are excluded --super-minor= -m : minor number to look for in super-block when choosing devices to use. --config= -c : config file --scan -s : scan config file for missing information --run -R : Try to start the array even if not enough devices for a full array are present --force -f : Assemble the array even if some superblocks appear : out-of-date. This involves modifying the superblocks. --update= -U : Update superblock: one of sparc2.2, super-minor or summaries启动阵列:
[root@rac1 ~]# mdadm -AR /dev/md0 /dev/sdcmdadm: /dev/md0 has been started with 1 drive (out of 2).[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdc[1] 524224 blocks [2/1] [_U]unused devices: [root@rac1 ~]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 1Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 10:01:02 2007
State : clean, degraded Active Devices : 1Working Devices : 1 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 0 0 -1 removed 1 8 32 1 active sync /dev/sdc UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.342加入新硬盘:
[root@rac1 ~]# mdadm /dev/md0 -a /dev/sdbmdadm: hot added /dev/sdb[root@rac1 ~]# cat /proc/mdstatPersonalities : [raid1] md0 : active raid1 sdb[2] sdc[1] 524224 blocks [2/1] [_U] [>....................] recovery = 3.7% (19904/524224) finish=2.5min speed=3317K/secunused devices: [root@rac1 ~]# mdadm -D /dev/md0/dev/md0: Version : 00.90.01 Creation Time : Thu Oct 25 15:28:07 2007 Raid Level : raid1 Array Size : 524224 (511.94 MiB 536.81 MB) Device Size : 524224 (511.94 MiB 536.81 MB) Raid Devices : 2 Total Devices : 2Preferred Minor : 0 Persistence : Superblock is persistentUpdate Time : Fri Oct 26 10:15:04 2007
State : clean, degraded, recovering Active Devices : 1Working Devices : 2 Failed Devices : 0 Spare Devices : 1 Rebuild Status : 12% completeNumber Major Minor RaidDevice State
0 0 0 -1 removed 1 8 32 1 active sync /dev/sdc 2 8 16 0 spare /dev/sdb UUID : 081c04ac:6cb9278e:35bade9d:49098be4 Events : 0.343[root@rac1 ~]# 进入目录查看状态:[root@rac1 ~]# cd /[root@rac1 /]# mount /dev/md0 /mnt/md0[root@rac1 /]# cd /mnt/md0[root@rac1 md0]# lslost+found nohup.out rac120071026 rac2 rac2_20071026 test[root@rac1 md0]# cat rac2aaaaaaaaaaaaa[root@rac1 md0]#一切正常了。
其他命令:
mdadm /dev/md0 -f /dev/sdaxset faulty for sdaxmdadm /dev/md0 -r /dev/sdax
hot remove /dev/sdax from /dev/md0mdadm /dev/md0 -a /dev/sdax
hot add /dev/sdax to /dev/md0if the array is full ,new added /dev/sdax will be a spare device
it'll be auto added when a device in array is down 删除已有的software raid:1.stop /dev/mdX:mdadm -S /dev/mdXor rm /dev/mdX2.del /etc/mdadm.conf3.del raid mount in /etc/fstab and autofs4.del raid part use fdisk or parted来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-245789/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/312079/viewspace-245789/