The quota system allows limiting disk space allocated to a user or group of users. To set it up, you must have a kernel that supports it (compiled with the CONFIG_QUOTA
option) — as is the case with Debian kernels. The quota management software is found in the quota Debian package.
To activate quota in a filesystem, you have to indicate the usrquota
and grpquota
options in /etc/fstab
for the user and group quotas, respectively. Rebooting the computer will then update the quotas in the absence of disk activity (a necessary condition for proper accounting of already used disk space).
يسمح لك الأمر edquota user
(أو edquota -g group
) بتعديل الحد التخزيني للمستخدم (أو المجموعة) أثناء عملية فحص الاستهلاك الحالي لمساحة القرص.
يسمح لك نظام الحصص بتحديد أربعة حدود:
two limits (called “soft” and “hard”) refer to the number of blocks consumed. If the filesystem was created with a block-size of 1 kibibyte, a block contains 1024 bytes from the same file. Unsaturated blocks thus induce losses of disk space. A quota of 100 blocks, which theoretically allows storage of 102,400 bytes, will however be saturated with just 100 files of 500 bytes each, only representing 50,000 bytes in total.
واثنان (soft و hard) يشيران لعدد عقد inode المستخدمة. يشغل كل ملف عقدة inode واحدة على الأقل لتخزين معلومات عنه (الصلاحيات، المالك، تاريخ ووقت آخر وصول، الخ). أي أنهما يقيدان عدد ملفات المستخدم.
يمكن تجاوز الحدود ”المرنة“ بشكل مؤقت؛ حيث ينبه المستخدمون فقط إلى أنهم يتجاوزون الحصة التخزينية وذلك عبر الأمر warnquota
، الذي يستدعى عادة باستخدام cron
. أما الحدود ”القاسية“ فلا يمكن تجاوزها أبداً: إذ يرفض النظام أي عملية تسبب تجاوز الحصة التخزينية القاسية.
يمكنك باستخدام الأمر edquota -t
، تعريف ”فترة سماح“ أعظمية يسمح خلالها تجاوز القيود المرنة. بعد انقضاء هذه المهلة، سوف تعامل قيود المرنة على أنها قيود قاسية، وسيضطر المستخدمون لتقليص استهلاكهم للمساحة التخزينية إلى ما دون الحد المفروض قبل أن يتمكنوا من كتابة أي شيء على القرص الصلب.