Håndtering av disk-kvoter Innledning With multi users systems, administrators must protect against users filling the disk. Often, users remove unneeded files only when prod­ ded to, resulting eventually in a scarcity of space. Runaway programs may fill up large amounts of disk space as well, often through log files such as that recording errors. It is possible to limit the amount of files, directories and disk space used by a user. 11.. SSoommee ccoonncceeppttss 11..11.. PPeerr ddeevviiccee//ppaarrttiittiioonn ccoonnttrrooll Disk quotas are managed partition by partition. There is no relation between the disk quotas setup for each partition. Further, you may enable disk quotas on some partitions while disabling them on others. 11..22.. UUsseerr aanndd ggrroouupp qquuoottaass You can control disk quota user per user. You can also work at the group level. Both quotas are setup completely independently. A group with a hundred users may have a disk space quota of much less than the sum of the users' quotas. When a file is created by a user, it belong to that user and to some group. The disk quota records of both the user and group are updated. A user may have plenty of available disk quota, but the group may be out of quota. Because of that the user won't be able to use more disk space while active in that group. This will not prevent them from doing work in another group assuming that the space is available, though they will need to switch to that group before this can occur. 11..33.. GGrroouupp qquuoottaass aanndd MMeemmbbeerrss ddeeffaauulltt qquuoottaass _L_i_n_u_x_c_o_n_f lets you manage quota with great flexibility. While you can can configure the quota limits user per user, most administrators will choose to operate more globally. Further, Linuxconf lets you partially fill quota specifications. This lets you use some defaults for a user and override only a single specification (maximum files allowed for example). 11..44.. DDiisskk qquuoottaa iinnffoorrmmaattiioonn You can control two aspects with disk quotas, (1) the number of files and directories owned by a user (or group) and (2) the amount of disk space owned. Both options are controlled separately. It is possible to have no limit on one while enforcing some limits on the other. Each aspect is controlled by three parameters: · _S_o_f_t _l_i_m_i_t The soft limit is a proposed operational limit. The user/group may exceed this limit, but only for a limited amount of time. · _H_a_r_d _l_i_m_i_t This limit can't be exceed. · _G_r_a_c_e _p_e_r_i_o_d This is the length of time the user/group may exceed the soft limit. It defaults to 7 days, and is expressed in a days:hours:minutes:seconds format. 11..55.. PPoossssiibbllee vvaalluueess ffoorr aa lliimmiitt A given limit may have three values: · _0 This means no limits · _-_1 This means unspecified. The effective value is inherited from the defaults. · _S_o_m_e _v_a_l_u_e _g_r_e_a_t_e_r _t_h_a_n _0 This is a limit. For disk space, this is expressed in kilobytes, and is true whatever the block size used on the disk. Linuxconf will translate the kilobytes to fit the disk subsystem requirements. 11..66.. EEffffeeccttiivvee qquuoottaass ffoorr uusseerrss Disk quotas for a user are influenced by three setups: · _T_h_e _u_s_e_r _r_e_c_o_r_d_s Those records are visible in the user account dialog. There is one record per partition with user quotas enabled. · _T_h_e _d_e_f_a_u_l_t_s _f_o_r _g_r_o_u_p _m_e_m_b_e_r_s Don't confuse this with group quotas. You can set up default values for disk quotas which apply directly to the members of the group. You modify these defaults right in the group account dialog. There is one record per partition with user quotas enabled. · _G_e_n_e_r_a_l _d_e_f_a_u_l_t _v_a_l_u_e_s One record per partition provides the base defaults. Often this will be the only record modified with all users inheriting these values. 11..77.. EEffffeeccttiivvee qquuoottaass ffoorr ggrroouuppss Disk quotas for a group are influenced by two setups: · _T_h_e _g_r_o_u_p _r_e_c_o_r_d_s These records are visible in the group account dialog. There is one record per partition with group quota enabled. · _G_e_n_e_r_a_l _d_e_f_a_u_l_t _v_a_l_u_e_s One record per partition provides the base defaults. Often this will be the only record modified with all groups inheriting these values. 22.. EEnnaabblliinngg ddiisskk qquuoottaass You have to enable disk quotas on each partition where you want this level of control. This is done in the "File system configurator". Pick the menu "Access local drive" and then pick each partition where you want to enable disk quotas. In the dialog, you will find a check box for user quotas and another for group quotas. Again, these quotas (user and group) are completely independent and may be enabled separately. 33.. RReellaatteedd ccoommmmaannddss Here are the different commands you may want to use to manipulate disk quotas: · _q_u_o_t_a_o_n_,_q_u_o_t_a_o_f_f This lets you turn on and off quotas on a partition · _r_e_p_q_u_o_t_a This prints a status report for the different users or groups. · _q_u_o_t_a_c_h_e_c_k This walks a partition and updates the status of each group and user. This command is normally run right after an fsck at boot time. · _e_d_q_u_o_t_a This is a bare bones quota management utility. It allows you to edit a user record or group record directly. _D_O _N_O_T _U_S_E _T_H_I_S. It has no concept of defaults and any change you make with it may be overwritten by linuxconf.