lvm,磁盘配额

 

1、 添加4快硬盘/dev/sdb /dev/sdc /dev/sdd /dev/sdc
2、 将4块硬盘分区
Fdisk –l /dev/sdb
N
P
1
回车
回车
W
Fdisk –l /dev/sdc
N
P
1
回车
回车
W
Fdisk –l /dev/sdd
N
P
1
回车
回车
W
Fdisk –l /dev/sde
N
P
1
回车
回车
W
partprobe
3、 建立raid10
Mdadm –creat –auto=yes /dev/md10 –level=10 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sdc
4、 建立物理卷pvcreate /dev/md10
5、 建立卷组vgcreate –s 16m vfastvg /dev/md10
6、 建立逻辑卷lvcreate –l 300 –n vfastlv vfastvg
7、 格式化逻辑卷 mkfs.ext3 /dev/vfastvg/vfastlv
8、 挂载逻辑卷umount /dev/cdrom
Mount /dev/vfastvg/vfastlv /mnt/
Mount –o  remount,usrquote,grpquota /mnt
9建立配额文件
quotacheck -avug
开启配额
quotaon -avug
创建用户
 #!/bin/bash
 groupadd laoyu
for username in laoyu1 laoyu2 laoyu3 laoyu4
do
useradd -g laoyu $username
echo "123456"| passwd --stdin $username
done
编辑配额
edquota -u laoyu1
 
filename                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vfastvg-vfastlv          0          200000         300000          0        0 
 
calhost raid10]# edquota -p laoyu1  -u laoyu2
[root@localhost raid10]# edquota -p laoyu1  -u laoyu3
[root@localhost raid10]# edquota -p laoyu1  -u laoyu4
[root@localhost raid10]# edquota -u laoyu2 查看一下
[root@localhost raid10]# edquota -g laoyu
Disk quotas for group laoyu (gid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vfastvg-vfastlv                                                                       
[root@localhost raid10]# edquota -t  宽限时间
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
  Filesystem             Block grace period     Inode grace period
/dev/mapper/vfastvg-vfastlv                  14days                  7days
~                                            
软连接
[root@localhost ~]# ln -s /home /mnt/raid10/
[root@localhost ~]# cd /mnt/raid10/
[root@localhost raid10]# ls
aquota.group  aquota.user  home  lost+found
[root@localhost raid10]# ll
总计 32
-rw------- 1 root root  7168 01-04 18:50 aquota.group
-rw------- 1 root root  7168 01-04 18:51 aquota.user
lrwxrwxrwx 1 root root     5 01-04 18:52 home -> /home
drwx------ 2 root root 16384 01-04 17:31 lost+found
 
给普通用户加个写的权限
[root@localhost ~]#chmod  o+w /mnt/
[root@localhost ~]#su - laoyu1
[laoyu1@localhost raid5]$cd /mnt/raid10
[laoyu1@localhost raid5]$dd if=/dev/zero  of=laoyu1 bs=1M count=270
md1: warning, user block quota exceeded.
270+0 records in
270+0 records out
283115520 bytes (283 MB) copied, 5.13592 seconds, 55.1 MB/s

 
 
 
 

你可能感兴趣的:(raid,lvm,磁盘配额)