- DISK
- 添加大小均为10G的虚拟磁盘,配置raid-5磁盘
- 创建LVM命名为/dev/vg01/lv01,大小为100G,格式化为ext4,挂在到本地目录/webdata,在分区内建立测试空文件disk.txt
一、添加13快10G的硬盘
[root@storagesrv /]# echo "- - - " > /sys/class/scsi_host/host0/scan
[root@storagesrv /]# echo "- - - " > /sys/class/scsi_host/host1/scan
[root@storagesrv /]# echo "- - - " > /sys/class/scsi_host/host2/scan
二、查看硬盘是否被扫描
[root@storagesrv /]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 10G 0 disk
sdc 8:32 0 10G 0 disk
sdd 8:48 0 10G 0 disk
sde 8:64 0 10G 0 disk
sdf 8:80 0 10G 0 disk
sdg 8:96 0 10G 0 disk
sdh 8:112 0 10G 0 disk
sdi 8:128 0 10G 0 disk
sdj 8:144 0 10G 0 disk
sdk 8:160 0 10G 0 disk
sdl 8:176 0 10G 0 disk
sdm 8:192 0 10G 0 disk
sdn 8:208 0 10G 0 disk
sr0 11:0 1 4.2G 0 rom
三、下载disk相关服务
[root@storagesrv /]# yum install mdadm lvm* -y
四、配置raid5 和LVM
[root@storagesrv /]# mdadm -Cv /dev/md0 -n12 -x1 -l5 /dev/sd[b-n]
[root@storagesrv /]# vgcreate /dev/vg01 /dev/md0
[root@storagesrv /]# lvcreate -L +100G -n lv01 vg01
[root@storagesrv /]# lvdisplay
#vgs lvs lvdisplay 可查看到配置后的效果
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID uR2how-ZAht-cG0G-9i1s-lcnE-RxnH-iCHcdq
LV Write Access read/write
LV Creation host, time localhost, 2023-06-12 10:23:21 -0400
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID ogcqfJ-fNdW-2BaJ-d237-tUJT-Wv3p-u8Q1Ct
LV Write Access read/write
LV Creation host, time localhost, 2023-06-17 10:23:12-0400
LV Status available
# open 1
LV Size <17.00 GiB
Current LE 4351
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/vg01/lv01
LV Name lv01
VG Name vg01
LV UUID QuU2P3-siBK-7Lc0-Rp9Z-tIAI-eyxS-q6ewtJ
LV Write Access read/write
LV Creation host, time storagesrv, 2023-06-20 10:23:21 -0400
LV Status available
# open 0
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 22528
Block device 253:2
[root@storagesrv /]# mkfs.ext4 /dev/vg01/lv01 #格式化为ext4
[root@storagesrv /]# mkdir /webdata #创建挂载目录
[root@storagesrv /]# mount /dev/vg01/lv01 /webdata/ #挂载
[root@storagesrv /]# cd /webdata/
[root@storagesrv webdata]# touch disk.txt #创建测试文件
[root@storagesrv webdata]# ls
disk.txt lost+found