需求描述
- 采用LVM磁盘管理方案:添加两块SCSI硬盘设备,完成硬盘检测及分区。建立逻辑卷mbox,格式化为XFS文件系统,挂载到/date目录下。
- 设置磁盘配额,要求用户jerry最多只能使用500MB磁盘空间,accp组的用户合计最多只能使用4GB磁盘空间
1、添加两块SCSI硬盘设备
2、完成硬盘检测及分区
3、建立逻辑卷mbox
1)建立物理卷pvcreate /dev/sdc1 /dev/sdd1
[root@localhost ~]# pvcreate /dev/sdc1 /dev/sdd1
WARNING: xfs signature detected on /dev/sdc1 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/sdc1.
WARNING: xfs signature detected on /dev/sdd1 at offset 0. Wipe it? [y/n]: y
Wiping xfs signature on /dev/sdd1.
Physical volume "/dev/sdc1" successfully created.
Physical volume "/dev/sdd1" successfully created.
2)创建卷组vgcreate sb /dev/sdc1 /dev/sdd1
[root@localhost ~]# vgcreate sb /dev/sdc1 /dev/sdd1
Volume group "sb" successfully created
3)创建逻辑卷lvcreate -L 10G -n mbox sb
[root@localhost ~]# lvcreate -L 10G -n mbox sb
Logical volume "mbox" created.
4、格式化为XFS文件系统
[root@localhost ~]# mkfs -t xfs /dev/sb/mbox
meta-data=/dev/sb/mbox isize=512 agcount=4, agsize=655360 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=2621440, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
5、挂载到/date目录下
mount -o usrquota,grpquota /dev/sb/mbox /date
[root@localhost ~]# mount -o usrquota,grpquota /dev/sb/mbox /date
6、设置磁盘配额
要求用户jerry最多只能使用500MB磁盘空间
1)创建用户kerry
[root@localhost ~]# useradd jerry
2)设置配额500MB
[root@localhost ~]# xfs_quota -x -c 'limit -u bhard=500M jerry' /date
accp组的用户合计最多只能使用4GB磁盘空间
[root@localhost ~]# xfs_quota -x -c 'limit -g bhard=5G accp' /date