Create a RAID-linux Enterprise Application-Linux server application in Linux. For more information, see. Use mdadm in Linux to create and manage soft raid
Note: This operation uses RHEL4 as an example, but it can be applied to most other distro instances (guess ).
Common mdadm Parameters
-C: Creates a Raid, which is followed by parameters, representing the name of the raid device. For example:/dev/md0,/dev/md1.
-N indicates the number of disks used to create disk arrays.
-L Raid level.
-X specifies the number of disks used for hotspare (hot spare. If a hard disk in the array breaks down, it will immediately top up and rebuild;
-D: displays detailed information about Soft raid;
-S scans the configuration file (/etc/mdadm. conf) or '/proc/mdstat' to view missing information f;
General process for creating soft raid
Use the fdisk tool to create partitions for the new disk;
Use the mkfs. XXXX tool to format the partition you just divided into a file system in a certain format. For example, ext3 and reiserfs;
Use mdadm to create a soft raid;
Create the/etc/mdadm. conf file (note the file format, including whether there is a comma, and so on. This file is used to enable soft raid automatically after the system restarts. You can view the/etc/rc. sysinit script and search for the 'mdadm 'string );
Example: Create soft raid5 (+ hotspare)
The following is a complete process of my actual operations:
This is my current disk and partition information using the 'fdisk-l' command (only/dev/sda is in use, the other four are new disks, no partitions, no formatting ):
# Fdisk-l
Disk/dev/sda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sda1*1 720 5783368 + 83 Linux
/Dev/sda2 721 783 506047 + 82 Linux swap
Disk/dev/sdb: 214 MB, 214748160 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048*512 = 1048576 bytes
Disk/dev/sdb doesn' t contain a valid partition table
Disk/dev/sdc: 214 MB, 214748160 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048*512 = 1048576 bytes
Disk/dev/sdc doesn' t contain a valid partition table
Disk/dev/sdd: 214 MB, 214748160 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048*512 = 1048576 bytes
Disk/dev/sdd doesn't contain a valid partition table
Disk/dev/sde: 214 Mbit/s, 214748160 bytes
64 heads, 32 sectors/track, 204 cylinders
Units = cylinders of 2048*512 = 1048576 bytes
Disk/dev/sde doesn't contain a valid partition table
Use fdisk to create a partition (in this example, the entire disk is divided into a primary partition. Perform the same operation on the remaining disks .) :
# Fdisk/dev/sdb
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.
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-204, default 1 ):
Using default value 1
Last cylinder or + size or + sizeM or + sizeK (1-204, default 204 ):
Using default value 204
Command (m for help): w
The partition table has been altered!
Calling ioctl () to re-read partition table.
Syncing disks.
Create a file system for the newly created partition (perform the same operations for the remaining partitions in sequence ):
# Mkfs. ext3/dev/sdb1
Mke2fs 1.35 (28-Feb-2004)
Filesystem label =
OS type: Linux
Block size = 1024 (log = 0)
Fragment size = 1024 (log = 0)
52416 inodes, 208880 blocks
10444 blocks (5.00%) reserved for the super user
First data block = 1
Maximum filesystem blocks = 67371008
26 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
8193,245 77, 40961,573 45, 73729,204
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service