每天学五分钟 Liunx 110 | 存储篇:RAID
RAID
RAID 模式
RAID0(stripe,条带模式)
RAID1(mirror,镜像模式)
RAID10
RAID 类型
RAID 上手
硬件 RAID
软件 RAID
[root@test ~]# cd /dev/md
md/ md0
[root@test ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 xfs 895G 851G 44G 96% /
[root@test ~]# vgdisplay
--- Volume group ---
VG Name test
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2884
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 13
Open LV 10
Max PV 0
Cur PV 1
Act PV 1
VG Size 600.00 GiB
PE Size 4.00 MiB
Total PE 153599
Alloc PE / Size 45156 / 176.39 GiB
Free PE / Size 108443 / 423.61 GiB
VG UUID Nu1VTG-dY65-Le4a-zMDV-9kkQ-hvrT-X5uZe0
[root@test ~]# lvcreate -l 50 -n Disk0 test
Logical volume "Disk0" created.
[root@test ~]# lvcreate -l 50 -n Disk1 test
Logical volume "Disk1" created.
[root@test ~]# lvcreate -l 50 -n Disk2 test
Logical volume "Disk2" created.
[root@test ~]# lvcreate -l 50 -n Disk3 test
Logical volume "Disk3" created.
[root@test ~]# lvdisplay | grep Disk
LV Path /dev/test/Disk0
LV Name Disk0
LV Path /dev/test/Disk1
LV Name Disk1
LV Path /dev/test/Disk2
LV Name Disk2
LV Path /dev/test/Disk3
LV Name Disk3
[root@test ~]# mdadm --create --auto=yes /dev/md1 --raid-devices=4 --level=10 --spare-devices=0 /dev/test/Disk{0,1,2,3}
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
[root@test ~]# cd /dev/md
md/ md0 md1
[root@test ~]# mkfs -t ext4 /dev/md1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=512 blocks, Stripe width=1024 blocks
102000 inodes, 407552 blocks
20377 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=34078720
50 block groups
8192 blocks per group, 8192 fragments per group
2040 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@test ~]# mkdir -p /root/lianhuasheng/raid
[root@test ~]# mount /dev/md1 /root/lianhuasheng/raid/
[root@test ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 xfs 895G 850G 45G 96% /
/dev/md1 ext4 378M 2.3M 352M 1% /root/lianhuasheng/raid
[root@test ~]# lvdisplay | grep Disk -C 5
--- Logical volume ---
LV Path /dev/test/Disk0
LV Name Disk0
VG Name test
LV UUID n0Qvxo-8UbS-mcpz-Qdju-dAjF-nAHk-WaNqdE
LV Write Access read/write
LV Creation host, time test.localdomain, 2020-03-18 23:42:11 +0800
LV Status available
open 1
LV Size 200.00 MiB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:47
--- Logical volume ---
LV Path /dev/test/Disk1
LV Name Disk1
VG Name test
LV UUID Eg29wy-3jBC-R44P-G5Nl-9D69-Noc0-HcDA8B
LV Write Access read/write
LV Creation host, time test.localdomain, 2020-03-18 23:42:22 +0800
LV Status available
open 1
LV Size 200.00 MiB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:48
--- Logical volume ---
LV Path /dev/test/Disk2
LV Name Disk2
VG Name test
LV UUID uWDcYc-0pso-vi6T-rXRD-i5ko-WSfG-K15qAY
LV Write Access read/write
LV Creation host, time test.localdomain, 2020-03-18 23:42:28 +0800
LV Status available
open 1
LV Size 200.00 MiB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:49
--- Logical volume ---
LV Path /dev/test/Disk3
LV Name Disk3
VG Name test
LV UUID 0ye1ED-ZEZK-Yj1d-QapB-QIMw-C930-sg8nQQ
LV Write Access read/write
LV Creation host, time test.localdomain, 2020-03-18 23:42:34 +0800
LV Status available
open 1
LV Size 200.00 MiB
Current LE 50
Segments 1
Allocation inherit
[root@test ~]# cat /etc/fstab | grep md1
[root@test ~]# umount /root/lianhuasheng/raid
[root@test ~]# mdadm --stop /dev/md1
mdadm: stopped /dev/md1
[root@test ~]# cat /proc/mdstat | grep md1
[root@test ~]# cat /etc/mdadm.conf | grep md1
cat: /etc/mdadm.conf: No such file or directory
[root@test ~]# ll /dev/ | grep md1
[root@test ~]#