Linux Disk Management--raid1 creation

Source: Internet
Author: User

1.  Scene2.  PocEnvironment

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/45/DF/wKioL1PstwTRnJXLAACSFsCm8UU725.gif "title=" 1.gif " alt= "Wkiol1pstwtrnjxlaacsfscm8uu725.gif"/>

# uname-a

Linux localhost 3.10.0-123.el7.x86_64 #1SMP Mon June 12:09:22 UTC x86_64 x86_64 x86_64 gnu/linux

# Cat/etc/redhat-release

CentOS Linux release 7.0.1406 (Core)

3.  Specific Operation3.1.  Partitioning

# fdisk-l

disk/dev/sdc:32.2 GB, 32212254720 bytes,62914560 sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512bytes

disk/dev/sdd:32.2 GB, 32212254720 bytes,62914560 sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512bytes

.........

# FDISK/DEV/SDC

..........

Command (M for help): P

disk/dev/sdc:32.2 GB, 32212254720 bytes,62914560 sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512bytes

Disk label Type:dos

Disk IDENTIFIER:0X3DBF19DC

Device Boot Start End Blocks Id System

Command (M for help): n

Partition Type:

P Primary (0 primary, 0extended, 4 free)

E Extended

Select (default P): p

Partition number (1-4, default 1):

First sector (2048-62914559, default 2048):

Using Default Value 2048

Last sector, +sectors or +size{k,m,g} (2048-62914559, default 62914559):

Using Default Value 62914559

Partition 1 of type Linux and of size 30GiB is set

Command (M for help): t

Selected partition 1

Hex code (type L to list all codes): FD

Changed type of partition ' Linux ' to ' Linuxraid AutoDetect '

Command (M for help): W

The partition table has been altered!

Calling IOCTL () to re-read partition table.

Syncing disks.

# FDISK-L/DEV/SDC

disk/dev/sdc:32.2 GB, 32212254720 bytes, 62914560sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512bytes

Disk label Type:dos

Disk IDENTIFIER:0X3DBF19DC

Device Boot Start End Blocks Id System

/DEV/SDC1 2048 62914559 31456256 fd Linux raid AutoDetect

Perform the same partitioning operation on the/DEV/SDD

# FDISK-L/DEV/SDD

disk/dev/sdd:32.2 GB, 32212254720 bytes,62914560 sectors

Units = sectors of 1 * MB = bytes

Sector size (logical/physical): bytes/512 bytes

I/O size (minimum/optimal): bytes/512bytes

Disk label Type:dos

Disk IDENTIFIER:0X2B1E2FEF

Device Boot Start End Blocks Id System

/DEV/SDD1 2048 62914559 31456256 fd Linux raid AutoDetect

3.2.  CreateRAID1

# Mount/dev/cdrom/mnt/cdrom

Mount:/dev/sr0 is write-protected,mounting read-only

# cd/mnt/cdrom/packages

# ls md*

mdadm-3.2.6-31.el7.x86_64.rpm

# rpm-uvhmdadm-3.2.6-31.el7.x86_64.rpm

error:failed dependencies:

Libreport-filesystem is needed by mdadm-3.2.6-31.el7.x86_64

#rpm-UVH mdadm-3.2.6-31.el7.x86_64.rpmlibreport-filesystem-2.1.11-10.el7.centos.x86_64.rpm

Preparing ... ################################# [100%]

Updating/installing ...

1:libreport-filesystem-2.1.11-10.el################################# [50%]

2:mdadm-3.2.6-31.el7 ################################# [100%]

# mdadm-c/dev/md0-l 1-n 2/dev/sd[cd]1

Mdadm:-C does not set the mode, and Socannot is the first option.

[Email protected] packages]# mdadm--create/dev/md0-l 1-n 2/dev/sd[cd]1

Mdadm:Note:this array has metadata at TheStart and

May is suitable as a boot device. If you plan to

Store '/boot ' on this device, ensure that

Your Boot-loader understands md/v1.x metadata, or use

--metadata=0.90

Continue creating array? Yes

Mdadm:defaulting to version 1.2 metadata

Mdadm:array/dev/md0 started.

3.3.  creating a file system

Format a disk array

# mkfs.ext4/dev/md0

MKE2FS 1.42.9 (28-dec-2013)

Filesystem label=

OS Type:linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

1966080 inodes, 7859936 blocks

392996 blocks (5.00%) reserved for thesuper user

First Data block=0

Maximum filesystem blocks=2155872256

Block groups

32768 blocks per group, 32768 fragments Pergroup

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000

Allocating group Tables:done

Writing Inode Tables:done

Creating Journal (32768 blocks): Done

Writing Superblocks and Filesystemaccounting Information:done

#mkdir/data

# Mount/dev/md0/data

# Ll/data

Total 16

drwx------2 root root 16384 03:01lost+found

Set up auto mount on boot

# Vi/etc/fstab

Add a row at the end

/dev/md0/data EXT4 Defaults 0 0

# Mdadm-ds

Array/dev/md0 metadata=1.2 name=localhost:0 uuid=e236da40:5469327f:1683de23:2d391d6f

Write to configuration file

# mdadm-ds>>/etc/mdadm.conf

Restart verification

#reboot

# mount

/dev/md0 on/data type EXT4 (rw,relatime,data=ordered)

# Cat/proc/mdstat

Personalities: [RAID1]

Md0:active RAID1 sdd1[1] sdc1[0]

31439744 Blocks Super 1.2 [2/2] [UU]

Unused devices: <none>

4.  Analog Failure

Delete the 30ga.vmdk

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/DF/wKioL1PstyDSVFgKAAB4SIP3uZs335.gif "title=" 2.gif " alt= "Wkiol1pstydsvfgkaab4sip3uzs335.gif"/>

# Cat/proc/mdstat

Personalities: [RAID1]

Md0:active RAID1 Sdc1[1]

31439744 blocks Super 1.2 [2/1] [_u]

Unused devices: <none>

5.  RebuildingRAID1

To simulate a recovery, or a 30GB hard disk, add a new disk file to 30GC. VMDK

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/45/DF/wKioL1Pstzfx7w9lAACOBogc_GA494.gif "title=" 3.gif " alt= "Wkiol1pstzfx7w9laacobogc_ga494.gif"/>

# fdisk-l

# mdadm/dev/md0-a/DEV/SDC1

Mdadm:added/dev/sdc1

# Cat/proc/mdstat

Personalities: [RAID1]

Md0:active RAID1 sdc1[2] sdd1[1]

31439744 blocks super1.2 [2/1] [_u]

[==>.........] Recovery = 11.3% (3554240/31439744) finish=2.2min speed=209072k/sec

Unused devices: <none>

View Logs

Md:bind<sdc1>

Md:recovery of RAID Array md0

Md:minimum _guaranteed_ speed:1000 Kb/sec/disk.

Md:using Maximum available idle IO bandwidth (but not more than200000 kb/sec) for recovery.

md:using 128k window, over a total of 31439744k.


Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.