Managing Disk Quotas in Linux

Posted in Uncategorized by admin on January 11th, 2008

Managing or restricting the amount of disks on each partition by every user or group of users is very important. This could be enabled using disk quota feature in Linux Redhat/Fedora and it is very simple and easy to implement.

Setting Up Quotas

Filesystem in Linux server plays a role in setting up disk quotas. Here are some steps how to set up disk quotas in single user mode.
Enter Single User Mode:
First of all you should remount /home filesystem and it needs to make sure that no user or processes are using it or accessing from console. After making sure that you are the only user on the system then you can skip entering single user mode setup. When you will enter single user mode, it will automatically logs off all users and stop cron jobs. Here are the steps of entering single user mode.
1) First of all use who command to view all users currently logged in, you can inform network users message that system is going to shutdown. Send this message to currently logged in user using wall command.
[root@linux-server tmp]# who
root pts/0 Nov 6 14:46 (192-168-1-242.my-website.com)
bob pts/0 Nov 6 12:01 (192-168-1-248.my-website.com)
bunny pts/0 Nov 6 16:25 (192-168-1-250.my-website.com)
[root@linux-server tmp]# wall The system is shutting down now!

Broadcast message from root (pts/0) (Sun Nov 21 15:04:27 2007):

The system is shutting down now!

[root@linux-server tmp]#

2) Log into the VGA prompt and enter single user command init 1

[root@linux-server tmp]# init 1

Simple eh?

Edititing /etc/fstab Configuration File

You can use /etc/fstab configuration file is used to list all disk partitions which are required to be mounted automatically whenever the system boots. Disk quotas are however enabled on Linux system file system by making some editing in /etc/fstab file and modifying options for home directory. You can add usrquota option and this option is mentioned in fstab main pages.
The file /etc/fstab looked like

LABEL=/home /home ext3 defaults 1 2

After editing /etc/fstab it should be
LABEL=/home /home ext3 defaults,usrquota 1 2

After editing /etc/fstab it should be
LABEL=/home /home ext3 defaults,usrquota 1 2

Remounting The File system

After editing /etc/fstab file it needs to view the file for /home. This could be done using this command.
# mount –o remount /home
user exit command to get out from single user mode.
# exit
Creating Quota Configuration Files:

Aquota user file contains the quotas information for users and aquota.group file contains quotas by group. This information is stored on uppermost directory. Per user quotas could be enabled on /home file system.
[root@linux-server tmp]# touch /home/aquota.user
[root@linux-server tmp]# chmod 600 /home/aquota.user
[root@linuxserver tmp]#
Initializing Quota Table
While editing /etc/fstab file and remounting file system shows that Linux filesystem has disk quota capabilities. Linux quota is initialized by the following command.
[root@linux-server tmp]# quotacheck -vagum
quotacheck: WARNING - Quotafile /home/aquota.user was probably truncated. Can’t save quota settings…
.
.
quotacheck: Scanning /dev/hda3 [/home] done
quotacheck: Checked 191 directories and 930 files
[root@bigboy tmp]#

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment