Create a soft RAID1 battle under Linux

Source: Internet
Author: User
Tags uuid hex code

[[Email protected] ~]# Date

Thu 20:45:34 CST 2016

[Email protected] ~]# FDISK/DEV/SDC

Welcome to Fdisk (Util-linux 2.23.2).

Changes'll remain in memory only, until the decide to write them.

Be careful before using the Write command.

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0XE1F55A32.

Command (M for help): P

disk/dev/sdc:5368 MB, 5368709120 bytes, 10485760 sectors

Units = sectors of 1 * MB = bytes

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

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

Disk label Type:dos

Disk Identifier:0xe1f55a32

Device Boot Start End Blocks Id System

Command (M for help): N

Partition Type:

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

E Extended

Select (default p): P

Partition number (1-4, default 1):

First sector (2048-10485759, default 2048):

Using Default Value 2048

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

Using Default Value 10485759

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

Command (M for help): t

Selected partition 1

Hex code (type L to list all codes): FD #fd: Linux RAID mode

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

Command (M for help): P

disk/dev/sdc:5368 MB, 5368709120 bytes, 10485760 sectors

Units = sectors of 1 * MB = bytes

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

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

Disk label Type:dos

Disk Identifier:0xe1f55a32

Device Boot Start End Blocks Id System

/DEV/SDC1 2048 10485759 5241856 fd Linux raid AutoDetect

Command (M for help): W

The partition table has been altered!

Calling IOCTL () to re-read partition table.

Syncing disks.

[Email protected] ~]# Partprobe/dev/sdb

[Email protected] ~]# PARTPROBE/DEV/SDC

[Email protected] ~]# ls/dev/sdb*

/dev/sdb/dev/sdb1

[Email protected] ~]# ls/dev/sdc*

/dev/sdc/dev/sdc1

Check if the disk can be created RAID1

[Email protected] ~]# MDADM-E/dev/sd[b-c]

/DEV/SDB:

MBR Magic:aa55

PARTITION[0]: 10483712 Sectors at 2048 (type FD)

/DEV/SDC:

MBR Magic:aa55

PARTITION[0]: 10483712 Sectors at 2048 (type FD)

Create RAID1

[Email protected] ~]# mdadm-c-v/dev/md1-l 1-n 2/DEV/SDB1/DEV/SDC1

Mdadm:Note:this array have metadata at the start 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

Mdadm:size set to 5237696K

Continue creating array? Y

Mdadm:defaulting to version 1.2 metadata

MDADM:ARRAY/DEV/MD1 started.

View RAID Status

[Email protected] ~]# Cat/proc/mdstat

Personalities: [RAID1]

Md1:active RAID1 sdc1[1] sdb1[0]

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

[============> ...] Resync = 60.6% (3175232/5237696) finish=0.1min speed=211682k/sec

Unused devices: <none>

[email protected] ~]# Watch Cat/proc/mdstat

View the status of two disks

[Email protected] ~]# mdadm-e/DEV/SDB1/DEV/SDC1

/DEV/SDB1:

Magic:a92b4efc

version:1.2

Feature map:0x0

Array UUID:B3F8134A:ABC56378:C6498702:55215F10

Name:rhel7.2:1 (Local to host RHEL7.2)

Creation Time:thu 18 20:49:27 2016

Raid LEVEL:RAID1

Raid Devices:2

Avail Dev size:10475520 (5.00 GiB 5.36 GB)

Array size:5237696 (5.00 GiB 5.36 GB)

Used Dev size:10475392 (5.00 GiB 5.36 GB)

Data offset:8192 Sectors

Super Offset:8 Sectors

State:clean

Device uuid:4cb9ba13:784b2294:29e78967:d93d8a94

Update Time:thu 18 20:49:54 2016

Checksum:595f46a0-correct

Events:17

Device role:active Device 0

Array state:aa (' A ' = = active, '. ' = = missing)

/DEV/SDC1:

Magic:a92b4efc

version:1.2

Feature map:0x0

Array UUID:B3F8134A:ABC56378:C6498702:55215F10

Name:rhel7.2:1 (Local to host RHEL7.2)

Creation Time:thu 18 20:49:27 2016

Raid LEVEL:RAID1

Raid Devices:2

Avail Dev size:10475520 (5.00 GiB 5.36 GB)

Array size:5237696 (5.00 GiB 5.36 GB)

Used Dev size:10475392 (5.00 GiB 5.36 GB)

Data offset:8192 Sectors

Super Offset:8 Sectors

State:clean

Device uuid:841e8e8c:b3ffe403:a487475c:c899e735

Update Time:thu 18 20:49:54 2016

Checksum:d8105c7d-correct

Events:17

Device role:active device 1

Array state:aa (' A ' = = active, '. ' = = missing)


View RAID1 Status

[Email protected] ~]# mdadm-d/dev/md1

/DEV/MD1:

version:1.2

Creation Time:thu 18 20:49:27 2016

Raid LEVEL:RAID1

Array size:5237696 (5.00 GiB 5.36 GB)

Used Dev size:5237696 (5.00 GiB 5.36 GB)

Raid Devices:2

Total Devices:2

Persistence:superblock is persistent

Update Time:thu 18 20:49:54 2016

State:clean

Active Devices:2

Working devices:2

Failed devices:0

Spare devices:0

Name:rhel7.2:1 (Local to host RHEL7.2)

Uuid:b3f8134a:abc56378:c6498702:55215f10

Events:17

Number Major Minor Raiddevice state

0 8 0 Active SYNC/DEV/SDB1

1 8 1 Active SYNC/DEV/SDC1

[Email protected] ~]#

Formatting

[Email protected] ~]# mkfs.xfs-f/dev/md1

Meta-data=/dev/md1 isize=256 agcount=4, agsize=327356 blks

= sectsz=512 attr=2, projid32bit=1

= Crc=0

data = bsize=4096 blocks=1309424, imaxpct=25

= Sunit=0 swidth=0 blks

Naming =version 2 bsize=4096 ascii-ci=0 ftype=0

Log =internal log bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 Blks, lazy-count=1

Realtime =none extsz=4096 blocks=0, rtextents=0

[Email protected] ~]# MKDIR/RAID1

[Email protected] ~]# mount/dev/md1/raid1/

[Email protected] ~]# cd/raid1/

[[email protected] raid1]# dd If=/dev/zero OF=/RAID1/AA bs=2m count=100

100+0 Records in

100+0 Records out

209715200 bytes (+ MB) copied, 1.7897 s, 117 MB/s

[[email protected] raid1]# ls

Aa

[Email protected] raid1]# DU/RAID1

204800/raid1


This article is from the "Technical Achievement Dream" blog, please be sure to keep this source http://andyliu.blog.51cto.com/518879/1840109

Create a soft RAID1 battle under Linux

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.