Linux disk quota management


Disk quotas are a mechanism for managing disk space, using disk quotas to limit the maximum amount of space a user or group can use in a particular file system

1. Check whether the kernel supports disk quotas

grep "CONFIG_QUOTA" /boot/config…….(tab completion)


 2. Remount the disk and enable disk quota

 (1)umount /mnt/sdc1

   (2)mount -o uquota,gquota /mnt/sdc1



(You can see the following parameters usrquota, grpquota, support disk quota)

 3. The configuration file takes effect permanently vi /etc/fstab


Enter the mounted device into the bottom line, save and exit

4. Add test users

  adduser u1

  passwd u1

  adduser u2

  passwd u2

 5. Set user quota limits

  edquota -u u1


Here we set a soft limit of 30M and a hard limit of 50M. The maximum number of files is 7 (the soft limit is 4)

 6. View system quota

     (1) repquota -avus

     (2) quota -uvs u1  :



 7. Test and modify file permissions, so that all users can edit and modify


8. Enter user u1 to the root directory and enter the sdc1 directory to create a file test

(1) Create a file test


(2) Store data


dd: Copies a file in blocks of the specified size, and performs the specified conversion while copying

if: input file name, default is standard input

of: output file name, default is standard output


Write to the third file created

 9. We can copy quota when there is more than one user

    edquota -p u1 -u u2


 10. Delete quota

You can edit quota to make both soft and hard limits set to 0

     edquota -u u1