一、查看添加的4块硬盘fdisk -l,然后分别将4块硬盘建分区表
fdisk_/dev/sdb-----n----p----1---1---652----w
fdisk_/dev/sdc-----n----p----1---1---652----w
fdisk_/dev/sdd-----n----p----1---1---652----w
fdisk_/dev/sde-----n----p----1---1---652----w
强制内核更新分区列表:partprobe
格式化:mkfs.ext3_/dev/sdb1
mkfs.ext3_/dev/sdc1
mkfs.ext3_/dev/sdd1
mkfs.ext3_/dev/sde1
二、建立raid10
1、mdadm --create --auto=yes /dev/md10 --level=10 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
2、Continue creating array? y
三、建立物理卷
[root@localhost ~]# pvcreate /dev/md10
Physical volume "/dev/md10" successfully created(成功)
四、建立卷组
[root@localhost ~]# vgcreate vfastvg /dev/md10
Volume group "vfastvg" successfully created(成功)
五、建立逻辑卷
[root@localhost ~]# lvcreate -l 2000 -n vfastlv vfastvg
查看:lvdisplay /dev/vfastvg/vfastlv
--- Logical volume ---
LV Name /dev/vfastvg/vfastlv
VG Name vfastvg
LV UUID vVDWYs-dL20-IPHr-8M27-HqOb-ABBm-EOWZna
LV Write Access read/write
LV Status available
# open 0
LV Size 7.81 GB
Current LE 2000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 512
Block device 253:2
六、格式化:mkfs.ext3 /dev/vfastvg/vfastlv
回显:Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override
七、建立文件、挂载
[root@localhost mnt]# mkdir vfastlv
[root@localhost mnt]# mount /dev/vfastvg/vfastlv /mnt/vfastlv
[root@localhost mnt]# cd vfastlv/
[root@localhost vfastlv]# ls
lost+found
八、创建快照
[root@localhost ~]# lvcreate -l 200 -s -n vfastlva /dev/vfastvg/vfastlv
/dev/hdc: open failed: 只读文件系统
Logical volume "vfastlva" created
You have new mail in /var/spool/mail/root
格式化:[root@localhost ~]# mkfs.ext3 /dev/vfastvg/vfastlva
挂载:[root@localhost ~]# mount /dev/vfastvg/vfastlva /mnt/vfastlva
九、自动挂载、开机启动
自动挂载:[root@localhost ~]# mdadm --detail /dev/md10 | grep UUID
mdadm: Unknown keyword ARRPY
UUID : 91ccf381:1235a744:8d1f7081:3b7be86b
[root@localhost ~]# vim /etc/mdadm.conf
ARRPY /dev/md10 UUID=91ccf381:1235a744:8d1f7081:3b7be86b
开机启动:vim_/etc/fstab
修改:/dev/md10 /mnt/raid10 ext3 defaults 0 0
十、磁盘配额
建立用户:vim_aaa.sh
#!/bin/bash
groupadd aaa
for aaa in aaa1 aaa2 aaa3 aaa4 aaa5
do
useradd $aaa
echo "123456" | passwd --stdin $aaa
done
设置软连接:[root@localhost ~]# ln -s /home /mnt/vfastlv
支持磁盘配额:[root@localhost ~]# mount -o remount,usrquota,grpquota /mnt/vfastlv
建立数据文件:[root@localhost ~]# quotacheck -auvg
编辑用户配额:[root@localhost ~]# edquota -u aaa1(soft:10000 hard:10000)
[root@localhost ~]# edquota -p aaa1 -u aaa2
[root@localhost ~]# edquota -p aaa1 -u aaa3
修改权限:[root@localhost ~]# chmod o+w /mnt/vfastlv
测试:dd if=/dev/zero of=aaa1 bs=1M count=100
[aaa1@localhost ~]$ cd /mnt/vfastlv
[aaa1@localhost vfastlv]$ dd if=/dev/zero of=aaa11 bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 3.65912 seconds, 28.7 MB/s
[aaa1@localhost vfastlv]$ dd if=/dev/zero of=aaa11 bs=1M count=1000
dd: 写入 “aaa11”: 设备上没有空间
731+0 records in
730+0 records out
765513728 bytes (766 MB) copied, 40.3797 seconds, 19.0 MB/s
完成