当前位置:网站首页>实验:磁盘配额操作
实验:磁盘配额操作
2022-07-24 05:23:00 【行走DI五花】
目录
四、对lisi用户在mnt目录中时做出容量限制和文件数量限制
磁盘配额概念:控制指定用户创建文件的数量以及可使用空间的上限
一、检测环境,需要安装的程序
xfsprogs 和quota
使用yum install -y xfsprogs quota 检测,如果程序没有安装,他会自动从yum公共仓下载安装,如果已安装则会自动检测更新。

二、将逻辑卷添加参数进行挂载
由上篇博客建立的LVM逻辑卷,在没挂载的情况下添加参数进行挂载,挂载按照需求分为临时挂载和永久挂载
①临时挂载:mount -o usrquota,grpquota /dev/vgname1/lvname1 /mnt
![]()
查看

②永久挂载: vim /etc/fstab 进行添加

mount -a 刷新一下。
三、创建一个用户
创建用户lisi,设置密码为123123


四、对lisi用户在mnt目录中时做出容量限制和文件数量限制
bsoft:设置磁盘容量的软限制数值为15M
bhard:设置磁盘容量的硬限制数值为20M
isoft:设置磁盘文件数的软限制数值为3
ihard:设置磁盘文件数的硬限制数值为5
例如:对lisi用户在mnt目录中时做出容量软限制为15M,容量硬限制为20M, 文件数软限制为3个,硬限制为5个。

五、验证结果
1、文件数量验证
①chmod 777 /mnt 给与mnt所以权限
![]()
查看

② 切换到lisi用户

③ 在mnt下最多能建5个文件

2、磁盘空间验证
验证方法:使用dd复制命令按字节进行复制文件内容。
①先复制一个10M大小的文件进去,命名为one.txt dd if=/dev/zero of=/mnt/one.txt bs=10M count=1

查看文件大小

② 再复制一个two.txt文件进去,大小为10M
查看大小

③ 再复制一个zero.txt文件进去,大小为10M,此时已达到容量硬限制的标准,提示超出磁盘配额无法操作。

总结:
当想限制指定用户在某一个目录下创建文件的数量以及可使用空间的上限,我们可以对他进行磁盘配置设置
本实验使用的是逻辑卷,磁盘配额对于普通磁盘也可以操作。
边栏推荐
- Polkadot | interprets how liberty plan, which subverts traditional social media, will be launched in Poka
- 迭代器与生成器
- Sword finger offer jz10 Fibonacci sequence
- 使用自定义zabbix包(4.0.5版本)安装agent和proxy
- [251] common test tools
- UE4 reload system 1. basic principle of reload system
- MySQL从基础到入门到高可用
- [no need for public IP] configure a fixed public TCP port address for remote desktop raspberry pie
- Windows下bat脚本备份MySQL数据库
- Homework in the second week
猜你喜欢

LVM and disk quota

Transition effect

Login page + summary

IP notes (11)

Playing RTSP video stream on webpage

Ia class summary (2)

Use intranet penetration to realize public network access to the Intranet

力扣986.区间列表的交集

手动安装Apache
![Configure a fixed remote desktop address [intranet penetration, no need for public IP]](/img/17/4e119be86189d80b100eb000254a86.png)
Configure a fixed remote desktop address [intranet penetration, no need for public IP]
随机推荐
Summary of common working methods (7S, SWOT analysis, PDCA cycle, smart principle, 6w2h, time management, WBS, 28 principles)
UE4 reload system 1. basic principle of reload system
RAID5和LVM组合使用
Jenkins automated unattended operation (up / down)
DHCP原理与配置
[218] what are the advantages and disadvantages of CS architecture and BS architecture and data on the server and client?
Work summary of a test Manager / Test Supervisor / test director
Polkadot | interprets how liberty plan, which subverts traditional social media, will be launched in Poka
DNS域名解析服务
NFS共享服务及实验
Simple three-step fast intranet penetration
awk的使用
联合国农产品数据分析
Crud of MySQL
PXE技术网络装机
Ia class summary (2)
文件系统与日志分析
MeterSphere一站式开源持续测试平台
Summary of ten common vulnerabilities (principle, harm, defense)
leetcode剑指offer JZ73 翻转单词序列