Linux中软RAID常见问题解决方法详解
2011-02-04 09:12:38 来源:本站整理6. 多种元数据格式
目前MD设备有两种主要的元数据格式(0.9版本和1.x版本),主要是元数据占用的空间不同和支持的底层设备个数不同,而且1.x版本还可以指定元数据写入设备的具体位置(1.0为在设备尾部,1.1为在设备开始,1.2为在设备开始的4KB位置)。创建阵列通过--metadata(或者其缩写-e)参数来指定元数据格式版本。
[root@fc5 mdadm-2.6.3]# ./mdadm -CR /dev/md0 -l5 -n6 -x1 /dev/sd[b-h]
[root@fc5 mdadm-2.6.3]# ./mdadm -D /dev/md0 | grep Version
Version : 00.90.03
[root@fc5 mdadm-2.6.3]# ./mdadm -CR /dev/md0 -l5 -n6 -x1 -e1.0 /dev/sd[b-h]
[root@fc5 mdadm-2.6.3]# ./mdadm -D /dev/md0 | grep Version
Version : 01.00.03
[root@fc5 mdadm-2.6.3]# ./mdadm -CR /dev/md0 -l5 -n6 -x1 -e1.1 /dev/sd[b-h]
[root@fc5 mdadm-2.6.3]# ./mdadm -D /dev/md0 | grep Version
Version : 01.01.03
[root@fc5 mdadm-2.6.3]# ./mdadm -CR /dev/md0 -l5 -n6 -x1 -e1.2 /dev/sd[b-h]
[root@fc5 mdadm-2.6.3]# ./mdadm -D /dev/md0 | grep Version
Version : 01.02.03
当阵列将磁盘移走后,也使用--zero-superblock清空设备上面的元数据信息。
[root@fc5 mdadm-2.6.3]# ./mdadm -Es /dev/sdh
ARRAY /dev/md0 level=raid5 num-devices=6
UUID=acd2b182:4695ee20:37689502:eb0423e1
spares=1
[root@fc5 mdadm-2.6.3]# ./mdadm /dev/md0 -f /dev/sdh -r /dev/sdh
mdadm: set /dev/sdh faulty in /dev/md0
mdadm: hot removed /dev/sdh
[root@fc5 mdadm-2.6.3]# ./mdadm --zero-superblock /dev/sdh
[root@fc5 mdadm-2.6.3]# ./mdadm -Es /dev/sdh
[root@fc5 mdadm-2.6.3]#
7. 可分区的RAID设备
如果想对支持分区的MD设备(Partitionable raid array)进行分区,需要在创建时使用/dev/md_d0来替代前面的/dev/md0。创建阵列是通过--auto=mdp(或者其缩写-ap)参数指定。
[root@fc5 mdadm-2.6.3]# ./mdadm -Cv --auto=mdp /dev/md_d0 -l5 -n6 /dev/sd[b-g] -x1 /dev/sdh
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 1048512K
mdadm: array /dev/md_d0 started.
[root@fc5 mdadm-2.6.3]# fdisk /dev/md_d0
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 1310640.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1310640, default 1):1
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1310640, default 1310640): +1024M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (250002-1310640, default 250002):250002
Using default value 250002
Last cylinder or +size or +sizeM or +sizeK (250002-1310640, default 1310640):1310640
Using default value 1310640
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@fc5 mdadm-2.6.3]# fdisk -l /dev/md_d0
Disk /dev/md_d0: 5368 MB, 5368381440 bytes
2 heads, 4 sectors/track, 1310640 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Device Boot Start End Blocks Id System
/dev/md_d0p1 1 250001 1000002 83 Linux
/dev/md_d0p2 250002 1310640 4242556 83 Linux
更多精彩
赞助商链接