1.为主机增加80G SCSI 接口硬盘
2.划分三个各20G的主分区
[root@localhost ~]# lsblk
3.将三个主分区转换为物理卷(pvcreate),扫描系统中的物理卷
[root@localhost ~]# pvcreate /dev/sdd[123]
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sdd2" successfully created
Physical volume "/dev/sdd3" successfully created
[root@localhost ~]# pvscan
PV /dev/sda2 VG centos lvm2 [59.51 GiB / 64.00 MiB free]
PV /dev/sdd2 lvm2 [20.00 GiB]
PV /dev/sdd3 lvm2 [20.00 GiB]
PV /dev/sdd1 lvm2 [20.00 GiB]
Total: 4 [119.51 GiB] / in use: 1 [59.51 GiB] / in no VG: 3 [60.00 GiB]
4.使用两个物理卷创建卷组,名字为myvg,查看卷组大小
[root@localhost ~]# vgcreate myvg /dev/sdd[12]
Volume group "myvg" successfully created
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 39.99 GiB
5.创建逻辑卷mylv,大小为30G
[root@localhost ~]# lvcreate -L 30G -n mylv myvg
Logical volume "mylv" created.
6.将逻辑卷格式化成xfs文件系统,并挂载到/data目录上,创建文件测试
[root@localhost ~]# mkfs -t xfs /dev/myvg/mylv
meta-data=/dev/myvg/mylv isize=256 agcount=4, agsize=1966080 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=7864320, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=3840, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# mkdir -pv /data
mkdir: 已创建目录 "/data"
[root@localhost ~]# mount /dev/myvg/mylv /data
7.增大逻辑卷到35G
[root@localhost data]# lvextend -L +5G /dev/myvg/mylv
Size of logical volume myvg/mylv changed from 30.00 GiB (7680 extents) to 35.00 GiB (8960 extents).
Logical volume mylv successfully resized
8.编辑/etc/fstab文件挂载逻辑卷,并支持磁盘配额选项
9.创建磁盘配额,crushlinux用户在/data目录下文件大小软限制为80M,硬限制为100M,
crushlinux用户在/data目录下文件数量软限制为80个,硬限制为100个。
10.使用touch dd 命令在/data目录下测试
11.查看配额的使用情况:用户角度
12.查看配额的使用情况:文件系统角度