Difference between revisions of "Bright:Setup user quotas"

From Define Wiki
Jump to navigation Jump to search
Line 103: Line 103:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
*** TBC created file, met limits, removed files, says limit exceeded!?
+
* Tests: create 5GB of data using dd
 +
<syntaxhighlight>
 +
[david@trainning ~]$  dd if=/dev/zero of=filename1 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 2.01559 s, 508 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename2 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 2.67037 s, 383 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename3 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 2.79117 s, 367 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename4 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 2.77857 s, 369 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename5 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 2.58464 s, 396 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename6 bs=1024 count=1000000
 +
md126: write failed, user block limit reached.
 +
dd: writing `filename6': Disk quota exceeded
 +
237657+0 records in
 +
237656+0 records out
 +
243359744 bytes (243 MB) copied, 0.535152 s, 455 MB/s
 +
[david@trainning ~]$  dd if=/dev/zero of=filename6 bs=1024 count=1000000
 +
md126: write failed, user block limit reached.
 +
dd: writing `filename6': Disk quota exceeded
 +
237657+0 records in
 +
237656+0 records out
 +
243359744 bytes (243 MB) copied, 0.535152 s, 455 MB/s
 +
[david@trainning ~]$ rm filenam*
 +
[david@trainning ~]$ dd if=/dev/zero of=filename6 bs=1024 count=1000000
 +
1000000+0 records in
 +
1000000+0 records out
 +
1024000000 bytes (1.0 GB) copied, 1.92585 s, 532 MB/s
 +
</syntaxhighlight>
 +
 
 +
'''PROLEMS - TO BE INVESTIGATED'''
 +
* Removed files, however the disk quota still says im over the limit?
 +
<syntaxhighlight>
 +
[david@trainning ~]$ du -sh .
 +
64K .
 +
[david@trainning ~]$ dd if=/dev/zero of=filename2 bs=1024 count=1000000
 +
dd: writing `filename2': Disk quota exceeded
 +
1+0 records in
 +
0+0 records out
 +
0 bytes (0 B) copied, 0.000309675 s, 0.0 kB/s
 +
 
 +
# To get things working i need to do the following:
 +
[root@trainning ~]# repquota -a
 +
*** Report for user quotas on device /dev/md126
 +
Block grace time: 00:00; Inode grace time: 00:00
 +
                        Block limits                File limits
 +
User            used    soft    hard  grace    used  soft  hard  grace
 +
----------------------------------------------------------------------
 +
root      -- 13542296      0      0        272569    0    0     
 +
daemon    --      92      0      0            21    0    0     
 +
lp        --      16      0      0              4    0    0     
 +
vcsa      --      16      0      0            30    0    0     
 +
postfix  --    128      0      0            57    0    0     
 +
rpc      --      24      0      0              6    0    0     
 +
ntp      --      20      0      0              5    0    0     
 +
rpcuser  --      36      0      0            11    0    0     
 +
nslcd    --      8      0      0              2    0    0     
 +
abrt      --      48      0      0              8    0    0     
 +
haldaemon --      4      0      0              1    0    0     
 +
slurm    --    412      0      0            52    0    0     
 +
cmhealth  --      92      0      0              7    0    0     
 +
mapred    --      20      0      0              5    0    0     
 +
hdfs      --      20      0      0              5    0    0     
 +
yarn      --      20      0      0              5    0    0     
 +
zookeeper --      20      0      0              5    0    0     
 +
hbase    --      20      0      0              5    0    0     
 +
hive      --      20      0      0              5    0    0     
 +
spark    --      20      0      0              5    0    0     
 +
accumulo  --      20      0      0              5    0    0     
 +
apache    --    8876      0      0            408    0    0     
 +
rtkit    --  11720      0      0            18    0    0     
 +
pulse    --      4      0      0              1    0    0     
 +
mysql    --  53548      0      0            532    0    0     
 +
named    --  14240      0      0            490    0    0     
 +
avahi    --      4      0      0              1    0    0     
 +
gdm      --    248      0      0            41    0    0     
 +
ldap      --  22024      0      0            30    0    0     
 +
cmsupport --      72      0      0            19    0    0     
 +
k_mouza  --      88      0      0            23    0    0     
 +
bright_test --      60      0      0            15    0    0     
 +
david    +- 9008868 5242880 5242880  none      17    0    0      #<--- still says im using 9GB or so
 +
#82      --      4      0      0              1    0    0     
 +
 
 +
 
 +
[root@trainning ~]# quotaoff -a
 +
[root@trainning ~]# quotacheck -vguma
 +
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
 +
quotacheck: Scanning /dev/md126 [/] done
 +
quotacheck: Checked 24622 directories and 249788 files
 +
[root@trainning ~]# repquota  /
 +
*** Report for user quotas on device /dev/md126
 +
Block grace time: 00:00; Inode grace time: 00:00
 +
                        Block limits                File limits
 +
User            used    soft    hard  grace    used  soft  hard  grace
 +
----------------------------------------------------------------------
 +
root      -- 13542304      0      0        272567    0    0     
 +
daemon    --      92      0      0            21    0    0     
 +
lp        --      16      0      0              4    0    0     
 +
vcsa      --      16      0      0            30    0    0     
 +
postfix  --    128      0      0            57    0    0     
 +
rpc      --      24      0      0              6    0    0     
 +
ntp      --      20      0      0              5    0    0     
 +
rpcuser  --      36      0      0            11    0    0     
 +
nslcd    --      8      0      0              2    0    0     
 +
abrt      --      48      0      0              8    0    0     
 +
haldaemon --      4      0      0              1    0    0     
 +
slurm    --    412      0      0            52    0    0     
 +
cmhealth  --      92      0      0              7    0    0     
 +
mapred    --      20      0      0              5    0    0     
 +
hdfs      --      20      0      0              5    0    0     
 +
yarn      --      20      0      0              5    0    0     
 +
zookeeper --      20      0      0              5    0    0     
 +
hbase    --      20      0      0              5    0    0     
 +
hive      --      20      0      0              5    0    0     
 +
spark    --      20      0      0              5    0    0     
 +
accumulo  --      20      0      0              5    0    0     
 +
apache    --    8876      0      0            408    0    0     
 +
rtkit    --  11720      0      0            18    0    0     
 +
pulse    --      4      0      0              1    0    0     
 +
mysql    --  53564      0      0            532    0    0     
 +
named    --  14240      0      0            490    0    0     
 +
avahi    --      4      0      0              1    0    0     
 +
gdm      --    248      0      0            41    0    0     
 +
ldap      --  22024      0      0            30    0    0     
 +
cmsupport --      72      0      0            19    0    0     
 +
k_mouza  --      88      0      0            23    0    0     
 +
bright_test --      60      0      0            15    0    0     
 +
david    --      64 5242880 5242880            17    0    0      #<--- now its back to 64k which matches the du statement above
 +
#82      --      4      0      0              1    0    0     
 +
[root@trainning ~]# quotaon -av
 +
/dev/md126 [/]: group quotas turned on
 +
/dev/md126 [/]: user quotas turned on
 +
 
 +
# Now switch back over to user david
 +
 
 +
 
 +
</syntaxhighlight>

Revision as of 11:20, 19 December 2014

Setup quotas within /etc/fstab

  • Need to add usrquota,grpquota to the /etc/fstab file for the home dir mount point
  • Lets check the home mount point (in this instance its just / for bright)
[root@trainning ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md126      426G   14G  392G   4% /
tmpfs            16G   84K   16G   1% /dev/shm
/dev/md125      496M   24M  447M   6% /boot
  • Lets update the /etc/fstab file with the parameters usrquota,grpquota for user mount points.
[root@trainning ~]# cat /etc/fstab 
UUID=9586a511-9b87-48e1-8749-f5fa0ebabd01 /                              ext3       defaults,noatime,nodiratime,usrquota,grpquota              0 1
UUID=6b542d80-a228-47bc-9e39-831f37bc074c /boot                          ext2       defaults,noatime,nodiratime              0 2
UUID=5e9078a4-9975-4659-839f-9749ceb8ab02 swap                           swap       defaults                                 0 0
proc		/proc	proc	defaults,nosuid	0 0
sysfs		/sys	sysfs	noauto	0 0
devpts		/dev/pts	devpts	mode=0620,gid=5	0 0
tmpfs		/dev/shm	tmpfs	defaults	0 0

# This section of this file was automatically generated by cmd. Do not edit manually!
# BEGIN AUTOGENERATED SECTION -- DO NOT REMOVE
# END AUTOGENERATED SECTION   -- DO NOT REMOVE
  • Remount the filesystem and verify the args in mtab
[root@trainning ~]# mount -o remount /
[root@trainning ~]# cat /etc/mtab
/dev/md126 / ext3 rw,noatime,nodiratime,usrquota,grpquota 0 0
proc /proc proc rw,nosuid 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,mode=0620,gid=5 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/md125 /boot ext2 rw,noatime,nodiratime 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
gvfs-fuse-daemon /root/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev 0 0

Create the Quota Database

  • Note: For Bright because the / folder is used and cannot be mounted read-only, we needed for force the initial check
  • Note: This took a few mins to run


  • Perform an initial check of the system
[root@trainning ~]# quotacheck -cug /
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
[root@trainning ~]# quotacheck -cugm /
  • After the files are created, run the following command to generate the table of current disk usage per file system with quotas enabled:
[root@trainning ~]# quotacheck -avugm
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/md126 [/] done
quotacheck: Checked 24615 directories and 249780 files

Set a user quota

  • Use the edquota command. We'll need to set soft and hard limits here. The number are based on KB so scale up for GB
  • E.g. 5GB limit
[david@hairybacon-2 ~]$ echo "5 * 1024 * 1024" | bc 
5242880
  • Set the limit using 5242880
[root@trainning ~]# edquota david
# which will provide you with a vi screen with the following, edit numbers as below
Disk quotas for user david (uid 1003):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/md126                       60    5242880    5242880         15        0        0
  • Turn quotas on
$ quotaon -a

Verify the user quota

  • check using the quota command
[root@trainning ~]# edquota -u david -f / 
[root@trainning ~]# quota -u david
Disk quotas for user david (uid 1003): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
     /dev/md126      60  5242880 5242880              15       0       0
  • Tests: create 5GB of data using dd
[david@trainning ~]$  dd if=/dev/zero of=filename1 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.01559 s, 508 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename2 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.67037 s, 383 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename3 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.79117 s, 367 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename4 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.77857 s, 369 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename5 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.58464 s, 396 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename6 bs=1024 count=1000000
md126: write failed, user block limit reached.
dd: writing `filename6': Disk quota exceeded
237657+0 records in
237656+0 records out
243359744 bytes (243 MB) copied, 0.535152 s, 455 MB/s
[david@trainning ~]$  dd if=/dev/zero of=filename6 bs=1024 count=1000000
md126: write failed, user block limit reached.
dd: writing `filename6': Disk quota exceeded
237657+0 records in
237656+0 records out
243359744 bytes (243 MB) copied, 0.535152 s, 455 MB/s
[david@trainning ~]$ rm filenam*
[david@trainning ~]$ dd if=/dev/zero of=filename6 bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 1.92585 s, 532 MB/s

PROLEMS - TO BE INVESTIGATED

  • Removed files, however the disk quota still says im over the limit?
[david@trainning ~]$ du -sh . 
64K	.
[david@trainning ~]$ dd if=/dev/zero of=filename2 bs=1024 count=1000000
dd: writing `filename2': Disk quota exceeded
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000309675 s, 0.0 kB/s

# To get things working i need to do the following:
[root@trainning ~]# repquota -a
*** Report for user quotas on device /dev/md126
Block grace time: 00:00; Inode grace time: 00:00
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      -- 13542296       0       0         272569     0     0       
daemon    --      92       0       0             21     0     0       
lp        --      16       0       0              4     0     0       
vcsa      --      16       0       0             30     0     0       
postfix   --     128       0       0             57     0     0       
rpc       --      24       0       0              6     0     0       
ntp       --      20       0       0              5     0     0       
rpcuser   --      36       0       0             11     0     0       
nslcd     --       8       0       0              2     0     0       
abrt      --      48       0       0              8     0     0       
haldaemon --       4       0       0              1     0     0       
slurm     --     412       0       0             52     0     0       
cmhealth  --      92       0       0              7     0     0       
mapred    --      20       0       0              5     0     0       
hdfs      --      20       0       0              5     0     0       
yarn      --      20       0       0              5     0     0       
zookeeper --      20       0       0              5     0     0       
hbase     --      20       0       0              5     0     0       
hive      --      20       0       0              5     0     0       
spark     --      20       0       0              5     0     0       
accumulo  --      20       0       0              5     0     0       
apache    --    8876       0       0            408     0     0       
rtkit     --   11720       0       0             18     0     0       
pulse     --       4       0       0              1     0     0       
mysql     --   53548       0       0            532     0     0       
named     --   14240       0       0            490     0     0       
avahi     --       4       0       0              1     0     0       
gdm       --     248       0       0             41     0     0       
ldap      --   22024       0       0             30     0     0       
cmsupport --      72       0       0             19     0     0       
k_mouza   --      88       0       0             23     0     0       
bright_test --      60       0       0             15     0     0       
david     +- 9008868 5242880 5242880   none      17     0     0       #<--- still says im using 9GB or so
#82       --       4       0       0              1     0     0       


[root@trainning ~]# quotaoff -a 
[root@trainning ~]# quotacheck -vguma
quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/md126 [/] done
quotacheck: Checked 24622 directories and 249788 files
[root@trainning ~]# repquota  /
*** Report for user quotas on device /dev/md126
Block grace time: 00:00; Inode grace time: 00:00
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      -- 13542304       0       0         272567     0     0       
daemon    --      92       0       0             21     0     0       
lp        --      16       0       0              4     0     0       
vcsa      --      16       0       0             30     0     0       
postfix   --     128       0       0             57     0     0       
rpc       --      24       0       0              6     0     0       
ntp       --      20       0       0              5     0     0       
rpcuser   --      36       0       0             11     0     0       
nslcd     --       8       0       0              2     0     0       
abrt      --      48       0       0              8     0     0       
haldaemon --       4       0       0              1     0     0       
slurm     --     412       0       0             52     0     0       
cmhealth  --      92       0       0              7     0     0       
mapred    --      20       0       0              5     0     0       
hdfs      --      20       0       0              5     0     0       
yarn      --      20       0       0              5     0     0       
zookeeper --      20       0       0              5     0     0       
hbase     --      20       0       0              5     0     0       
hive      --      20       0       0              5     0     0       
spark     --      20       0       0              5     0     0       
accumulo  --      20       0       0              5     0     0       
apache    --    8876       0       0            408     0     0       
rtkit     --   11720       0       0             18     0     0       
pulse     --       4       0       0              1     0     0       
mysql     --   53564       0       0            532     0     0       
named     --   14240       0       0            490     0     0       
avahi     --       4       0       0              1     0     0       
gdm       --     248       0       0             41     0     0       
ldap      --   22024       0       0             30     0     0       
cmsupport --      72       0       0             19     0     0       
k_mouza   --      88       0       0             23     0     0       
bright_test --      60       0       0             15     0     0       
david     --      64 5242880 5242880             17     0     0       #<--- now its back to 64k which matches the du statement above
#82       --       4       0       0              1     0     0       
[root@trainning ~]# quotaon -av
/dev/md126 [/]: group quotas turned on
/dev/md126 [/]: user quotas turned on

# Now switch back over to user david