RAID is an abbreviation for the English Redundant array of independent disks, which is known as a standalone redundant disk array. Simply put, RAID is a combination of multiple separate hard disks (physical hard disks) in different ways to form a hard disk group (logical hard disk), providing higher storage performance than a single hard drive and providing data backup technology.
RAID level: Only means that the disk organization is different, there is no upper and lower points;
0: Strip
Performance improvement: Read, write
Redundancy capability (fault tolerance): none
Space utilization: NS
At least 2 pieces of disk
1: Mirror
Performance: Write performance degradation, read performance improvement
Redundancy capability: Available
Space utilization: 1/2
At least 2 pieces of disk
5:
Performance: read, write promotion
Redundancy capability: Available
Space utilization: (n-1)/n
Need at least 3 bucks.
10:
Performance: Read and write promotion
Redundancy capability: Available
Space utilization: 1/2
Need at least 4 bucks.
01:
Performance: Read and write promotion
Redundancy capability: Available
Space utilization: 1/2
Need at least 4 bucks.
50:
Performance: Read and write promotion
Redundancy capability: Available
Space utilization: (n-2)/n
Need at least 6 bucks.
Jbod
Performance: No lift
Redundancy capability: None
Space utilization: 100%
Need at least 2 bucks.
Use Fdisk to divide two partitions to simulate two hard drives,
[Email protected] ~]# fdisk-l
disk/dev/sda:8589 MB, 8589934592 bytes
255 heads, Sectors/track, 1044 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 200781 Linux
/dev/sda2 1020127+-Swap/solaris Linux
/dev/sda3 153 1044 7164990-up Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes (/dev/sdb created )
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes
[Email protected] ~]# Fdisk/dev/sdb
Command (M for help): P
disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-130, default): +300m
Command (M for help): P
disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 PNs 297171 Linux
Such a partition is created, but to do a raid to change the ID of the disk into RAID (Linux RAID Auto),
Command (M for help): l
0 Empty 1e Hidden W95 FAT1-old Minix BF Solaris
1 FAT12 NEC DOS bayi minix/old Lin C1 drdos/sec (fat-
2 Xenix root Plan 9 swap/so c4 drdos/sec (fat-
3 Xenix usr 3c partitionmagic Linux c6 drdos/sec (fat-
4 FAT16 <32m Venix 80286, os/2 hidden c:c7 syrinx
5 Extended PPC PReP Boot, Linux Extended da non-fs data
6 FAT16 SFS, NTFS volume set db cp/m/CTOS/.
7 Hpfs/ntfs 4d qnx4.x NTFS Volume set de Dell Utility
8 AIX 4e qnx4.x 2nd part Linux plaintext DF bootit
9 AIX Bootable 4f qnx4.x 3rd part 8e Linux LVM E1 DOS Access
A os/2 Boot manag ontrack DM amoeba E3 DOS r/o
b W95 FAT32 Wuyi Ontrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
C W95 FAT32 (LBA) cp/m 9f bsd/os EB BeOS FS
E W95 FAT16 (LBA) Ontrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
F W95 Ext ' d (LBA) OnTrackDM6 a5 FreeBSD ef EFI (fat-12/16/
Ten OPUS ez-drive a6 OpenBSD f0 linux/pa-risc b
Hidden FAT12 Bow A7 NeXTSTEP F1 SpeedStor
Compaq Diagnost 5c Priam edisk A8 Darwin UFS f4 SpeedStor
Hidden FAT16 <3 speedstor A9 NetBSD F2 DOS Secondary
Hidden FAT16, GNU HURD or Sys ab Darwin boot fb VMware VMFS
Hidden hpfs/ntf Novell Netware b7 BSDI FS FC VMware Vmkcore
AST smartsleep Novell Netware b8 BSDI swap fd Linux RAID Auto
1b Hidden W95 FAT3 disksecure Mult bb Boot Wizard hid Fe lanstep
1c Hidden W95 FAT3 pc/ix be Solaris boot ff BBT
Command (M for help): t
Selected Partition 1
Hex code (type L to list codes): fd (converted to FD)
Changed system type of partition 1 to FD (Linux raid AutoDetect)
Command (M for help): P
disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 PNS 297171 fd Linux raid AutoDetect
Command (M for help): n
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 2
First cylinder (38-130, default 38):
Using Default Value 38
Last cylinder or +size or +sizem or +sizek (38-130, default): +300m
Command (M for help): t
Partition number (1-4): 2
Hex code (type L to list codes): FD
Changed system type of partition 2 to FD (Linux raid AutoDetect)
Command (M for help): P
disk/dev/sdb:1073 MB, 1073741824 bytes
255 heads, Sectors/track, cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 PNS 297171 fd Linux raid AutoDetect
/DEV/SDB2 297202+ FD Linux raid AutoDetect
Command (M for help): W (save changes)
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
[[email protected] ~]# partprobe/dev/sdb ( re-read partition table )
[Email protected] ~]# cat/proc/partitions
Major Minor #blocks name
8 0 8388608 SDA
8 1 200781 sda1
8 2 1020127 Sda2
8 3 7164990 Sda3
8 1048576 SDB
8 297171 SDB1
8 297202 SDB2
Create RAID 0
[Email protected] ~]# mdadm-c/dev/md0-a yes-l 0-n 2/dev/sdb{1,2}
Mdadm:array/dev/md0 started.
[Email protected] ~]# cat/proc/mdstat
Personalities: [RAID0]
Md0:active RAID0 sdb2[1] sdb1[0]
594176 Blocks 64k chunks
Unused devices: <none>
[[email protected] ~]# mke2fs-j/dev/md0 format
MKE2FS 1.39 (29-may-2006)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
74400 inodes, 148544 blocks
7427 Blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=155189248
5 block groups
32768 blocks per group, 32768 fragments per group
14880 inodes per group
Superblock backups stored on blocks:
32768, 98304
Writing Inode Tables:done
Creating Journal (4096 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem'll be automatically checked every Notoginseng mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
[[email protected] ~]# mount/dev/md0/mnt/mount to/mnt
Other levels of RAID creation methods are the same.
Mdadm: Make any block device raid
Modal Commands:
Create a pattern
-C
Dedicated options:
-L: Level
-N #: Number of devices (#为数字)
-A {Yes|no}: whether to automatically create a device file for it
-c:chunk size, 2^n, default is 64K
-X #: Specify the number of free disks
Management mode
--add,--remove,--fail
mdadm/dev/md#--FAIL/DEV/SDA7
Monitoring mode
-F
Growth model
-G
Assembly mode
-A
View details of a RAID array
Mdadm-d/dev/md#
--detail
Stop array:
Mdadm-s/dev/md#
--stop
To display RAID details:
mdadm-d/dev/md0 (RAID device)
Simulated disk corruption:
MDADM/DEV/MD0--fail/dev/sdb2 (disk/dev/sdb2 on raid/dev/md0 is damaged. )
To delete a damaged disk:
Mdadm/dev/md0-r/DEV/SDB2
Add a new disk to the raid (the newly added disk must be the same size as the previous disk)
Mdadm/dev/sdb2-a/DEV/SDB3
RAID array not used (stop):
Mdadm-s/dev/md0
RAID array re-enable (boot):
Mdadm-a/DEV/MD0/DEV/SDB1/DEV/SDB2
Specify the free disk and replace it by itself when a disk in the raid is broken:
Mdadm-c/dev/md0-a yes-l 1-n 2-x 1/dev/sdb1/dev/sdB2 /dev/sdb3
If you have already created it, then add the idle disk operation:
Mdadm/dev/sdb2-a/DEV/SDB3
Save the current RAID information to a configuration file for later assembly:
mdadm-d--scan >/etc/mdadm.conf
The following links are written more clearly:
http://lyp0909.blog.51cto.com/508999/503575
Create a soft raid