1. Install ntfs-3g (RPM) package (if not aready present)
2. mount -t ntfs-3g /dev/partition_name /mount/path/
Thursday, October 14, 2010
Thursday, October 7, 2010
Disk Quota for Linux Users
Configuration:
1. Add "usrquota" qualifier to the home partition in /etc/fstab
LABEL=/home /home ext3 defaults,usrquota 1 2
2. Create an empty file /home/aquota.user with root as owner and permission 600
touch /home/aquota.user
chmod 600 /home/aquota.user
3. Remount the /home partition
mount -o remount /home
4. Check /etc/mtab
/dev/sda5 /home ext3 rw,usrquota 0 0
5. Run quotacheck to scan the filesystem for disk usage and update the aquota.user file
quotacheck -vum /home
6. Run quotaon -av
/dev/sda5 [/home]: user quotas turned on
7. Edit quota for user and set the soft and hard limit for the blocks (in KB)
edquota -u senthilkumar.v
Disk quotas for user senthilkumar.v (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/sda5 409928 900000 1000000 1789 0 0
A script to add new user with quota
#!/bin/bash
real_useradd=/usr/sbin/useradd
SLIMIT=2600000
HLIMIT=3000000
if [ $# -eq 0 ] ; then
$real_useradd
exit
fi
a=`echo $* | grep "\-D"`
if [ $? -eq 0 ] ; then
$real_useradd $*
exit
fi
a=`echo $* | grep "\-g"`
if [ $? -ne 0 ] ; then
GRP="-g devgroup"
fi
login_name=${!#}
$real_useradd $GRP $*
passwd $login_name
setquota -u $login_name $SLIMIT $HLIMIT 0 0 -a
Quota Reports:
1. List quota
quota -u user_id
2. List users who hit the quota limit
quota -q
3. Quota summary report
repquota -a
Quota Check:
Add a cron entry to check the disk usage regularly
1. Add the following in /etc/cron.weekly/quotacheck
#!/bin/bash
/sbin/quotacheck -vum /home
2. chmod +x /etc/cron.weekly/quotacheck
1. Add "usrquota" qualifier to the home partition in /etc/fstab
LABEL=/home /home ext3 defaults,usrquota 1 2
2. Create an empty file /home/aquota.user with root as owner and permission 600
touch /home/aquota.user
chmod 600 /home/aquota.user
3. Remount the /home partition
mount -o remount /home
4. Check /etc/mtab
/dev/sda5 /home ext3 rw,usrquota 0 0
5. Run quotacheck to scan the filesystem for disk usage and update the aquota.user file
quotacheck -vum /home
6. Run quotaon -av
/dev/sda5 [/home]: user quotas turned on
7. Edit quota for user and set the soft and hard limit for the blocks (in KB)
edquota -u senthilkumar.v
Disk quotas for user senthilkumar.v (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/sda5 409928 900000 1000000 1789 0 0
A script to add new user with quota
#!/bin/bash
real_useradd=/usr/sbin/useradd
SLIMIT=2600000
HLIMIT=3000000
if [ $# -eq 0 ] ; then
$real_useradd
exit
fi
a=`echo $* | grep "\-D"`
if [ $? -eq 0 ] ; then
$real_useradd $*
exit
fi
a=`echo $* | grep "\-g"`
if [ $? -ne 0 ] ; then
GRP="-g devgroup"
fi
login_name=${!#}
$real_useradd $GRP $*
passwd $login_name
setquota -u $login_name $SLIMIT $HLIMIT 0 0 -a
Quota Reports:
1. List quota
quota -u user_id
2. List users who hit the quota limit
quota -q
3. Quota summary report
repquota -a
Quota Check:
Add a cron entry to check the disk usage regularly
1. Add the following in /etc/cron.weekly/quotacheck
#!/bin/bash
/sbin/quotacheck -vum /home
2. chmod +x /etc/cron.weekly/quotacheck
Subscribe to:
Posts (Atom)