Linux system Raiders: how to make quotas for added hard drives

  
                  

The following new hard disk do quota experiment is done in the vm virtual machine


to achieve disk quota, the system must be installed quota package. The quota package is installed by default in RHEL4. Confirm that the software is installed.


In fact, Red Hat Enterprise Linux 4 is mostly used by servers. SCSI disks support hot plugging and can directly add a new hard disk.


Use the command fdisk -l to view the hard disk in the computer, and the last line to see the newly added /dev/sdb. Use the command fdisk /dev/sdb. You can complete the operation with the help prompt n (new) p (view partition status) w (save) q (exit) l (view system type ID) t (change file system type)


Create a new Partition sets the partition size. In the experiment, in order to verify that both the primary partition and the extended partition can implement disk quota, a primary partition and an extended partition are built.


wSave Configuration


Use fdisk -l again to see the new hard disk. The next step is to format the newly created partition. In the experiment, format the /dev/sdb1 /dev/sdb5 /dev/sdb6 separately.


Modify "/etc/fstab" below. The file is automatically mounted. Add the “usrquota” and “grpquota” options to the partition load settings that need to be quotad. You can set quotas for users and groups in the system.


After the "fstab" file is properly configured, you need to remount the file system to make the configuration of the file system take effect. The easiest way is to restart the Linux system for the settings to take effect.


Setting the partition support quota can not use the quota function after the quota is imposed, because the quota file has not been created in the partition. Use the "quotacheck -cmug" command to create a quota file on the partition that supports the quota function. The quota file is automatically created in the root directory of the partition file system. After creating the quota item, you can see the generated aquota.group and aquota.user


"edquota -u username" "edquota -g group name" command to set quotas for users and groups. .


The filesystem field represents the file system, which is the hard disk partition where quotas need to be set.


The blocks field indicates the number of data blocks that the user has currently occupied. The capacity of each data block is 1 KB, which is automatically calculated by the edquota program.


The inodes field indicates the number of "i nodes" occupied by the current user in the file system, that is, the number of files owned by the user. This number is also automatically calculated by the edquota program.


The two soft fields indicate the number of soft limits of the disk capacity (KB) or the number of files (a), which need to be set by the user. A hard field before and after indicates the hard limit quantity of the disk capacity (KB) or the number of files (a), which needs to be set by the user.


After the user has made a quota setting in a certain partition, it may not have write permission yet, and the corresponding permission needs to be set. It is also necessary to "quotaon quota directory" to enable the quota function. (In the experiment, quotaon /quota;quotaon /quota2)


Verify whether the quota is valid.


"edquota -t" is used to set the grace period for disk quotas. The grace period of the disk quota refers to the maximum grace time for the user to use the system before the disk space (number of files) occupied by the user exceeds the soft limit, but the hard limit is not reached. During this grace period, the user needs to reduce the occupied disk capacity to a soft limit, otherwise the system will not work properly. The unit of grace time can be set to days, hours, minutes, seconds. The default grace time set in RHEL4 is 7 days (7days).


When you use the disk quota for users, you need to master the following principles:


1. The user's limit on the number of files is not very practical, so the disk quota is usually limited to the disk capacity occupied by the user.


2, the value of the soft limit and hard limit set for the user should not be less than the disk capacity or the number of files that the user has occupied. Otherwise, the user may not be able to log in and use the system normally.


3, the number of hard limits set should be greater than the number of soft limits, otherwise there is no practical significance.


4, disk quota for the root user is completely achievable, but in the system must ensure that the root user can log in at any time, so if there is no special need, do not disk the root user Quota settings.

Copyright © Windows knowledge All Rights Reserved