raid10
添加4块SCSI硬盘
给硬盘分区
[root@localhost ~]# fdisk /dev/sdb
nàpà1àtà8eàw
sdc、sdd、sde同样
创建raid10
[root@localhost ~]# mdadm --create --auto=yes /dev/md1 --level=10 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm: array /dev/md1 started.
查看raid
[root@localhost ~]# cat /proc/mdstat
Personalities : [raid10]
md10 : active raid10 sde1[3] sdd1[2] sdc1[1] sdb1[0]
41929344 blocks 64K chunks 2 near-copies [4/4] [UUUU]
格式化raid10
[root@localhost ~]# mkfs.ext3 /dev/md1
强制更新分区列表
[root@localhost ~]# partprobe
配置文件/etc/mdadm.conf
[root@localhost ~]# mdadm –Ds #查看raid信息
[root@localhost ~]# mdadm -Ds
ARRAY /dev/md10 level=raid10 num-devices=4 metadata=0.90 UUID=5394ba9d:83acd990:75a3c979:50a8a53b
[root@localhost ~]# vim /etc/mdadm.conf
ARRAY /dev/md10 UUID=5394ba9d:83acd990:75a3c979:50a8a53b
LVM
建立物理卷
[root@localhost ~]# pvcreate /dev/md1
Physical volume "/dev/md1" successfully created
[root@localhost ~]# pvdisplay /dev/md1 查看物理卷
[root@localhost ~]# pvscan 扫描物理卷
建立卷组
[root@localhost ~]# vgcreate -s 16m vfastvg /dev/md1
/dev/cdrom: open failed: 只读文件系统
Attempt to close device '/dev/cdrom' which is not open.
Volume group "vfast" successfully created
[root@localhost ~]# vgdisplay vfast 查看卷组
建立逻辑卷
[root@localhost ~]# lvcreate -L 10G -n vfastlv vfastvg
Logical volume "vfastlv" created
[root@localhost ~]# lvdisplay 查看
格式化逻辑卷
[root@localhost ~]# mkfs.ext3 /dev/vfastvg/vfastlv
挂载逻辑卷
[root@localhost ~]# mkdir /mnt/vfast
[root@localhost ~]# mount /dev/vfastvg/vfastlv /mnt/vfast/
[root@localhost ~]# vim /etc/fstab
/dev/vfastvg/vfastlv /mnt/vfast ext3 defaults 0 0
quota
开启配额
[root@localhost ~]# mount -o remount,usrquota,grpquota /mnt/vfast/
[root@localhost ~]# vim /etc/fstab
/dev/vfastvg/vfastlv /mnt/vfast ext3 defaults,usrquota,grpquota 0 0
建立软连接
[root@localhost /]# mv /home/ /mnt/vfast/
[root@localhost ~]# mv /home/ /mnt/vfast/
[root@localhost ~]# ln -s /mnt/vfast/home/ /
[root@localhost ~]# ll -d /home
lrwxrwxrwx 1 root root 16 01-05 00:11 /home -> /mnt/vfast/home/
创建用户和组
[root@localhost ~]# vim username.sh
#!/bin/bash
groupadd guangyuan
for i in gy{1..10};do
useradd -g guangyuan $i
echo "123456" | passwd --stdin $i
done
建立数据文件
[root@localhost ~]# mount -a
[root@localhost ~]# quotacheck -avug
quotacheck: Scanning /dev/mapper/vfastvg-vfastlv [/mnt/vfast]
done
quotacheck: Checked 44 directories and 44 files
[root@localhost ~]# ls /mnt/vfast/
aquota.group aquota.user home lost+found
启动配额
[root@localhost ~]# quotaon -auvg
/dev/mapper/vfastvg-vfastlv [/mnt/vfast]: group quotas turned on
/dev/mapper/vfastvg-vfastlv [/mnt/vfast]: user quotas turned on
设置用户配额
[root@localhost ~]# edquota -u gy1
Disk quotas for user gy1 (uid 510):
Filesystem blocks soft hard inodes soft hard
/dev/mapper/vfastvg-vfastlv 32 250000 300000 8 0 0
[root@localhost ~]# edquota -p gy1 -u gy2
….
设置组的配额
[root@localhost ~]# edquota -g guangyuan
Disk quotas for group group (gid 500):
Filesystem blocks soft hard inodes soft hard
/dev/md1 0 2000000 2500000 0 0 0
修改宽限时间
[root@localhost ~]# edquota –t
设权限
[root@localhost ~]# chmod o+w /mnt/vfast/
测试
[gy1@localhost ~]$ dd if=/dev/zero of=test.txt bs=1M count=310
dm-2: warning, user block quota exceeded.
dm-2: write failed, user block limit reached.
dd: 写入 “test.txt”: 超出磁盘限额
293+0 records in
292+0 records out
306855936 bytes (307 MB) copied, 10.8278 seconds, 28.3 MB/s