1 / 11

LINUX 服务器管理

LINUX 服务器管理. 田 钧. 第八章 Linux 磁盘配额. 授课内容: 1. 磁盘配额的介绍及优点 2. 配置磁盘配额 授课目标: 学会配置磁盘配额. 磁盘配额的介绍和优点. 功能: 使用磁盘配额,系统管理员可以对磁盘空间进行管理,对不同用户在文件和磁盘容量上加以限制,这样就能有效的利用磁盘有限的容量。 磁盘配额的两种磁盘管理方式: 1. 基于文件 inode 的磁盘管理 2. 基于磁盘存储块的磁盘管理 特点: 磁盘配额是在每个用户,每个文件系统的基础 上被处理的。.

ryo
Download Presentation

LINUX 服务器管理

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LINUX 服务器管理 田 钧

  2. 第八章 Linux磁盘配额 • 授课内容: 1.磁盘配额的介绍及优点 2.配置磁盘配额 • 授课目标: 学会配置磁盘配额 2

  3. 磁盘配额的介绍和优点 • 功能:使用磁盘配额,系统管理员可以对磁盘空间进行管理,对不同用户在文件和磁盘容量上加以限制,这样就能有效的利用磁盘有限的容量。 • 磁盘配额的两种磁盘管理方式: 1.基于文件inode的磁盘管理 2.基于磁盘存储块的磁盘管理 特点:磁盘配额是在每个用户,每个文件系统的基础 上被处理的。 3

  4. 配置磁盘配额 实现磁盘配额的步骤: • 修改 /etc/fstab来激活某个文件系统的配额 • 重新挂载文件系统,使改变生效 • 创建配额文件,重新生成磁盘用量表 • 分配配额(edquota) • 用quotaon命令启动配额 4

  5. 编辑/etc/fstab • 以根用户身份使用编辑器给需要配额的文件系统添加 usrquota 和(或)grpquota 选项: LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 none /dev/pts devpts gid=5,mode=620 0 0 LABEL=/home /home ext3 defaults,usrquota,grpquota 1 2 /dev/hda2 swap swap defaults 0 0 /dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 5

  6. 重新挂载文件系统 添加了 userquota 和 grpquota 选项后,重新挂载在 fstab 中被修改的文件系统 #mount –o remount /home 6

  7. 创建配额文件 • 运行 quotacheck 命令: quotacheck 命令检查启用了配额的文件系统,并为每个文件系统建立一个当前磁盘用量的表。该表会被用来更新操作系统的磁盘用量文件。此外,文件系统的磁盘配额文件也被更新。 • 创建配额文件(aquota.user 和 aquota.group)命令: # quotacheck -acvug 或 # quotacheck -acvu /home -a 选项意味着在 /etc/mtab 中所有挂载了的非 NFS 文件系统都会被检查来决定是否启用了配额。-c 选项指定每个启用了配额的文件系统都应该创建配额文件,-u 选项指定检查用户配额,-g 选项指定检查组群配额,-v显示命令运行过程。 7

  8. 为用户分配配额 • 命令:edquota [-u,-g] username 例如:如果在 /etc/fstab 中为 /home 分区(/dev/hda3)启用了配额,执行了 #edquota gdlc 命令后,系统默认的编辑器中就会有如下显示: Disk quotas for user gdlc (uid 501): Filesystem blocks soft hard inodes soft hard /dev/hda3 440436 0 0 37418 0 0 8

  9. 设置软限制的过渡期 • 命令: # 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/hda3 7days 7days 9

  10. 启动与关闭配额 • 启动所有配额: # quotaon –avgu • 若只对/home文件系统中所有配置的用户激活配额: # quotaon /home • 关闭所有配额: # quotaoff -avgu • 关闭/home文件系统配额 # quotaoff /home 10

  11. 练习 • 对根文件系统(/)做磁盘配额, 对用户gdlc的软限制为4m,硬限制为20m,过渡时间为7s 11

More Related