Implementation of software RAID 0

巴扎黑
Release: 2017-06-23 14:13:41
Original
2565 people have browsed it

Software RAID 0 implementation

RAID 0 is also known as Stripe or Striping, which represents the highest storage performance among all RAID levels. RAID 0The principle of improving storage performance is to disperse continuous data to multiple disks for access. In this way, system data requests can be executed in parallel by multiple disks. Each disk performs its own portion of the data request. This kind of parallel operation on data can make full use of the bus bandwidth and significantly improve the overall disk access performance.

The disadvantage of RAID 0 is that it does not provide data redundancy, so once user data is damaged, the damaged data cannot be recovered. RAID0As long as any one of the hard disks has a problem during operation, the entire data will fail. It is generally not recommended for enterprise users to use it alone.

RAID 0 has unique characteristics that make it particularly suitable for areas that require high performance but don’t care much about data security. , such as graphics workstations, etc. For individual users, RAID 0 is also an excellent choice to improve hard drive storage performance.

You can use the entire hard disk, or you can use partitions to do raid0. Here we use partitions.

1 Partition

Create two new partitions /dev/sda6 /dev/sda7

Note: Remember to partition Change the ID to fd

Sync partition

[root@centos7 ~]# partprobe
Copy after login

2 Create RAID 0

[root@centos7 ~]# mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sda6 /dev/sda7
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
Copy after login

Create Success,

-C creates a new disk array, the device name is manually specified as md0,

-a {yes|no}: Automatically create the device file of the target RAID device

-l Specifies the RAID level, here is 0

-n Specifies the number of disks participating in the array

The new device is named /dev/md0, this device can be used like a partition , you can create the file system, mount it, and then you can use it normally.

3 Create file system

[root@centos7 ~]# mkfs.ext4 /dev/md0
Copy after login

View device

[root@centos7 ~]# blkid
[……]
/dev/sr0: UUID="2016-12-05-13-52-39-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sda6: UUID="70b40ab3-f5ba-2412-df4d-d159d01e22ae" UUID_SUB="7ebe1427-b452-8a91-1c46-03f8a47e17e7" LABEL="centos7.3.loacl:0" TYPE="linux_raid_member"
/dev/sda7: UUID="70b40ab3-f5ba-2412-df4d-d159d01e22ae" UUID_SUB="b946d93b-6b3e-c5cb-f10e-ce43c4d25774" LABEL="centos7.3.loacl:0" TYPE="linux_raid_member"
/dev/md0: UUID="7fa669ed-fc90-4ecc-a7a7-a49997f23c06" TYPE="ext4"
Copy after login

You can see that the UUIDs of /sda6, /sda7 and /dev/md0 are the same.

4 Mount

[root@centos7 ~]# mkdir /mnt/md0
[root@centos7 ~]# mount /dev/md0 /mnt/md0/
Copy after login

Check the mounting status

[root@centos7 /mnt/md0]# df -h /dev/md0
Filesystem Size Used Avail Use% Mounted on
/dev/md0 2.0G 6.0M 1.9G 1% /mnt/md0
Copy after login

Set boot mount

[root@centos7 ~]# blkid /dev/md0
/dev/md0: UUID="7fa669ed-fc90-4ecc-a7a7-a49997f23c06" TYPE="ext4"
[root@centos7 ~]# vim /etc/fstab
UUID=dddd23d1-1012-4bac-9717-56b9b469e0c2 / ext4 defaults 1 1
UUID=316d8677-25b8-49af-b4eb-54daa20b6595 /boot ext4 defaults 1 2
UUID=dacd6ddd-d765-4646-b98c-0579f2732749 swap swap defaults 0 0
UUID=7fa669ed-fc90-4ecc-a7a7-a49997f23c06 /mnt/md0 ext4 defaults 0 0
Copy after login

5 Check the details of raid0 (/dev/md0)

[root@centos7 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Tue Apr 25 11:51:21 2017
Raid Level : raid0
Array Size : 2095104 (2046.00 MiB 2145.39 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Tue Apr 25 11:51:21 2017
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Chunk Size : 512K
Name : centos7.3.loacl:0 (local to host centos7.3.loacl)
UUID : 70b40ab3:f5ba2412:df4dd159:d01e22ae
Events : 0
Number Major Minor RaidDevice State
0 8 6 0 active sync /dev/sda6
1 8 7 1 active sync /dev/sda7
Copy after login

The above is the detailed content of Implementation of software RAID 0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template