Setting up quota on a Partition with Writing Permissions
It could be danger to set up quota on a partition with writing permissions because the filesystem could be changed during the operations. If you didn't set up quota at the first place and now you want to set it up, this solution might be helpful.
Suppose /dev/sda5 is mounted on /home. First of all, we need to make following two files and change their permissions to 600 so that nobody else can access to them. Don't forget you need root privilege in order to perform all these tasks.
touch aquota.user aquota.group
chmod 600 aquota.*
Then you need to edit /etc/fstab. Add grpquota option if you need group quota.
/dev/sda5 /home jfs defaults,usrquota 0 1
Remount the partition.
mount -o remount /home
Repair the empty quota files you made.
quotacheck /home
With repquota -as, you will be able to see something like following
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
user1 -- 2455M 0 0 43119 0 0
user2 -- 56 0 0 5 0 0
user3 -- 256 0 0 16 0 0
user4 -- 941M 0 0 233k 0 0
It's done. Think twice before doing this if your server is critical.