Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Tuesday, September 2, 2014

What is Disk Quota's

September 02, 2014
What is Disk Quota's

Disk Quota Space in Linux
NAME
df - report filesystem disk space usage

SYNOPSIS
df [OPTION]... [FILE]...

DESCRIPTION

df displays the amount of disk space available on the filesystem containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown. Disk space is shown in 1K blocks by default, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

If an argument is the absolute file name of a disk device node containing a mounted filesystem, df shows the space available on that filesystem rather than on the filesystem containing the device node (which is always the root filesystem). This version of df cannot show the space available on unmounted filesystems, because on most kinds of systems doing so requires very nonportable intimate knowledge of filesystem structures.

OPTIONS

Show information about the filesystem on which each FILE resides, or all filesystems by default. Mandatory arguments to long options are mandatory for short options too.

-a, --all include filesystems having 0 blocks

-B, --block-size=SIZE use SIZE-byte blocks

-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

-H, --si likewise, but use powers of 1000 not 1024

-i, --inodes
list inode information instead of block usage

-k like --block-size=1K

-l, --local limit listing to local filesystems

--no-sync
do not invoke sync before getting usage info (default)

--sync invoke sync before getting usage info

-t, --type=TYPE limit listing to filesystems of type TYPE

-T, --print-type print filesystem type

-x, --exclude-type=TYPE
limit listing to filesystems not of type TYPE
-v (ignored)
NAME
du - estimate file space usage

SYNOPSIS
du [OPTION]... [FILE]...

DESCRIPTION

Summarize disk usage of each FILE, recursively for directories. Mandatory arguments to long options are mandatory for short options too.

-a, --all
write counts for all files, not just directories

--apparent-size
print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due to holes in (‘sparse’) files, internal fragmentation, indirect blocks, and the like -B, --block-size=SIZE use SIZE-byte blocks

-b, --bytes equivalent to ‘--apparent-size --block-size=1’

-c, --total produce a grand total

-D, --dereference-args
dereference FILEs that are symbolic links

-H like --si,
but also evokes a warning; will soon change to be equivalent to --dereference-args (-D)

-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

--si like -h, but use powers of 1000 not 1024

-k like --block-size=1K

-l, --count-links
count sizes many times if hard linked -L, --dereference de-reference all symbolic links

-P, --no-dereference
don’t follow any symbolic links (this is the default)

-0, --null
end each output line with 0 byte rather than newline

-S, --separate-dirs
do not include size of subdirectories

-s, --summarize
display only a total for each argument

-x, --one-file-system: skip directories on different filesystems
-X FILE, --exclude-from=FILE
Exclude files that match any pattern in FILE.

--exclude=PATTERN
Exclude files that match PATTERN. –max-depth=N print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument; --max-depth=0 is the same as –summarize

PATTERNS

PATTERN is a shell pattern (not a regular expression). The pattern ? Matches any one character, whereas * matches any string (composed of zero, one or multiple characters). For example, *.o will match any files whose names end in .o. Therefore, the command du –exclude=’*.o’ will skip all files and subdirectories ending in .o (including the file .o itself).


NAME
quotacheck - scan a filesystem for disk usage, create, check and repair quota files

SYNOPSIS
quotacheck [ -gubcfinvdMmR ] [ -F quota-format ] -a | filesystem

DESCRIPTION

Quotacheck examines each filesystem, builds a table of current disk usage, and compares this table against that recorded in the disk quota file for the filesystem (this step is ommitted if option -c is specified). If any inconsistencies are detected, both the quota file and the current system copy of the incorrect quotas are updated (the latter only occurs if an active filesystem is checked which is not advised).

By default, only user quotas are checked. quotacheck expects each filesystem to be checked to have quota files named [a]quota.user and [a]quota.group located at the root of the associated filesystem. If a file is not present, quotacheck will create it.

If the quota file is corrupted, quotacheck tries to save as much data as possible. Rescuing data may need user intervention. With no additional options quotacheck will simply exit in such a situation. When in interactive mode (option -i), the user is asked for advice. Advice can also be provided from command line (see option -n) , which is useful when quotacheck is run automatically (ie. from script) and failure is unacceptable.

Quotacheck should be run each time the system boots and mounts non-valid filesystems. This is most likely to happen after a system crash.
It is strongly recommended to run quotacheck with quotas turned off for the filesystem. Otherwise, possible damage or loss to data in the quota files can result. It is also unwise to run quotacheck on a live filesystem as actual usage may change during the scan. To prevent this, quotacheck tries to remount the filesystem read-only before starting the scan. After the scan is done it remounts the filesystem read-write. You can disable this with option -m. You can also make quotacheck ignore the failure to remount the filesystem read-only with option -M.

OPTIONS

-b Forces quotacheck to make backups of the quota file before writing the new data.

-v quotacheck reports its operation as it progresses. Normally it operates silently.

-d Enable debugging mode. It will result in a lot of information which can be used in debugging the program. The output is very verbose and the scan will be slow.

-u Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked. This is the default action.

-g Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked.

-c Don’t read existing quota files. Just perform a new scan and save it to disk. quotacheck also skips scanning of old quota files when they are not found.

-f Forces checking and writing of new quota files on filesystems with quotas enabled. This is not recommended as the created quota files may be out of sync.

-M This flag forces checking of filesystem in read-write mode if a remount fails. Do this only when you are sure no process will write to a filesystem while scanning.

-m Don’t try to remount filesystem read-only. See comment with option -M.

-i Interactive mode. By default quotacheck exits when it finds an error. In interactive mode user is asked for input instead. See option -n.

-n If the quota files become corrupted, it is possible for duplicate entries for a single user or group ID to exist. Normally in this case, quotacheck exits or asks user for input. When this option is set, the first entry found is always used (this option works in interactive mode too).

-F format-name
Check and fix quota files of specified format (ie. don’t perform format auto-detection). This is recommended as detection might not work well on corrupted quota files. Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), rpc (quota over NFS), xfs (quota on XFS filesystem)

-a Check all mounted non-NFS filesystems in /etc/mtab

-R When used together with the -a option, all filesystems except for the root filesystem are checked for quotas.

NOTE
quotacheck should only be run by super-user. Non-privileged users are presumably not allowed to read all the directories on the given filesystem.

FILES
aquota.user or aquota.group located at filesystem root with quotas. /etc/mtab names and locations of mounted filesystems



NAME
quota - display disk usage and limits

SYNOPSIS
quota [ -F format-name ] [ -guvsil | q ]
quota [ -F format-name ] [ -uvsil | q ] user...
quota [ -F format-name ] [ -gvsil | q ] group...

DESCRIPTION

Quota displays users’ disk usage and limits. By default only the user quotas are printed. Quota reports the quotas of all the filesystems listed in /etc/mtab. For filesystems that are NFS-mounted a call to the rpc.rquotad on the server machine is performed to get the information.

OPTIONS

-F format-name
Show quota for specified format (ie. don’t perform format auto detection). Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), rpcquota over NFS), xfs (quota on XFS filesystem)

-g Print group quotas for the group of which the user is a member. The optional group argument(s) restricts the display to the specified group(s).

-u flag is equivalent to the default.
-v will display quotas on filesystems where no storage is allocated.

-s option will make quota(1) try to choose units for showing limits, used space and used inodes.

-i ignore mountpoints mounted by automounter

-l report quotas only on local filesystems (ie. ignore NFS mounted filesystems).

-q Print a more terse message, containing only information on filesystems where usage is over quota.

-Q Do not print error message if connection to rpc.rquotad is refused (usually this happens when rpc.rquotad is not running on the server).

Specifying both -g and -u displays both the user quotas and the group quotas (for the user). Only the super-user may use the -u flag and the optional user argument to view the limits of other users. Non-super-users can use the -g flag and optional group argument to view only the limits of groups of which they are members. The -q flag takes precedence over the -v flag.

DIAGNOSTICS

If quota exits with a non-zero status, one or more filesystems are over quota.


NAME
edquota - edit user quotas

SYNOPSIS
edquota [ -p protoname ] [ -u | -g ] [ -r ] [ -F format-name ] [ -f filesystem ] username...

edquota [ -u | -g ] [ -F format-name ] [ -f filesystem ] -t

edquota [ -u | -g ] [ -F format-name ] [ -f filesystem ] -T username | groupname...

DESCRIPTION

edquota is a quota editor. One or more users or groups may be specified on the command line. For each user or group a temporary file is created with an ASCII representation of the current disk quotas for that user or group and an editor is then invoked on the file. The quotas may then be modified, new quotas added, etc. Setting a quota to zero indicates that no quota should be imposed.

Users are permitted to exceed their soft limits for a grace period that may be specified per filesystem. Once the grace period has expired, the soft limit is enforced as a hard limit.

The current usage information in the file is for informational purposes; only the hard and soft limits can be changed. Upon leaving the editor, edquota reads the temporary file and modifies the binary quota files to reflect the changes made.

The editor invoked is vi(1) unless either the EDITOR or the VISUAL environment variable specifies otherwise.

Only the super-user may edit quotas.


OPTIONS


-r Edit also non-local quota use rpc.rquotad on remote server to set quota. This option is available only if quota tools were compiled with enabled support for setting quotas over RPC. The -n option is equivalent, and is maintained for backward compatibility.

-u Edit the user quota. This is the default.

-g Edit the group quota.

-p protoname
Duplicate the quotas of the prototypical user specified for each user specified. This is the normal mechanism used to initialize quotas for groups of users.

-F format-name
Edit quota for specified format (ie. don’t perform format autodetection). Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), rpc (quota over NFS), xfs (quota on XFS filesystem)

-f filesystem
Perform specified operations only for given filesystem (default is to perform operations for all filesystems with quota).

-t Edit the soft time limits for each filesystem. In old quota format if the time limits are zero, the default time limits in <linux/quota.h> are used. In new quota format time limits must be specified (there is no default value set in kernel). Time units of ’seconds’, ’minutes’, ’hours’, ’days’, ’weeks’, and ’months’ are understood. Time limits are printed in the greatest possible time unit such that the value is greater than or equal to one.

-T Edit time for the user/group when softlimit is enforced. Possible values are ’unset’ or number and unit. Units are same as used in -t option.

FILES
aquota.user or aquota.group quota file at the filesystem root (version 2 quota, non-XFS filesystems) quota.user or quota.group quota file at the filesystem root (version 1 quota, non-XFS filesystems) /etc/mtab mounted filesystems table


NAME
setquota - set disk quotas

SYNOPSIS

setquota [ -r ] [ -u | -g ] [ -F quotaformat ] name block-softlimit block-hardlimit inode-softlimit inode-hardlimit -a | filesystem...

setquota [ -r ] [ -u | -g ] [ -F quotaformat ] [ -p protoname ] name -a | filesystem...

setquota -b [ -r ] [ -u | -g ] [ -F quotaformat ] -a | filesystem...

setquota -t [ -u | -g ] [ -F quotaformat ] block-grace inode-grace -a | filesystem...

setquota -T [ -u | -g ] [ -F quotaformat ] name block-grace inode-grace -a | filesystem...

DESCRIPTION

setquota is a command line quota editor. The filesystem, user/group name and new quotas for this filesystem can be specified on the command line.

-r Edit also remote quota use rpc.rquotad on remote server to set quota. This option is available only if quota tools were compiled with enabled support for setting quotas over RPC.

-F quotaformat
Perform setting for specified format (ie. don’t perform format autodetection). Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), rpc (quota over NFS), xfs (quota on XFS filesystem)

-u Set user quotas for named user. This is the default.

-g Set group quotas for named group.

-p protoname
Use quota settings of user or group protoname to set the quota for the named user or group.

-b Read information to set from stdin (input format is name block-softlimit block-hardlimit inode-softlimit inode-hardlimit).

-t Set grace times for users/groups. Times block-grace and inode-grace are specified in seconds.

-T Alter times for individual user/group when softlimit is enforced. Times block-grace and inode-grace are specified in seconds or can be string ’unset’.

-a Go through all filesystems with quota in /etc/mtab and perform setting.

To disable a quota, set the corresponding parameter to 0. To change quotas for several filesystems, invoke once for each filesystem.

Only the super-user may edit quotas.

NAME
quotaon, quotaoff - turn filesystem quotas on and off

SYNOPSIS
/sbin/quotaon [ -vugfp ] [ -F format-name ] filesystem...
/sbin/quotaon [ -avugfp ] [ -F format-name ]

/sbin/quotaoff [ -vugp ] [ -x state ] filesystem...
/sbin/quotaoff [ -avugp ]

DESCRIPTION


quotaon announces to the system that disk quotas should be enabled on one or more filesystems. The filesystem quota files must be present in the root directory of the specified filesystem and be named either aquota.user (for version 2 user quota), quota.user (for version 1 user quota), aquota.group (for version 2 group quota), or quota.group (for version 1 group quota).

XFS filesystems are a special case - XFS considers quota information as filesystem metadata and uses journaling to provide a higher level guarantee of consistency. There are two components to the XFS disk quota system: accounting and limit enforcement. XFS filesystems require that quota accounting be turned on at mount time. It is possible to enable and disable limit enforcement on an XFS filesystem after quota accounting is already turned on. The default is to turn on both accounting and enforcement. The XFS quota implementation does not maintain quota information in user-visible files, but rather stores this information internally.

Quotaoff announces to the system that the specified filesystems should have any disk quotas turned off.

OPTIONS quotaon


-a All automatically mounted (no noauto option) non-NFS filesystems in /etc/fstab with quotas will have their quotas turned on. This is normally used at boot time to enable quotas.

-v Display a message for each filesystem where quotas are turned on.

-u Manipulate user quotas. This is the default.

-g Manipulate group quotas.

-p Instead of turning quotas on just print state of quotas (ie. whether. quota is on or off)

-f Make quotaon behave like being called as quotaoff.


OPTIONS quotaoff


-F format-name
Report quota for specified format (ie. don’t perform format autodetection). Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), xfs (quota on XFS filesystem)
-a Force all filesystems in /etc/fstab to have their quotas disabled.

-v Display a message for each filesystem affected.

-u Manipulate user quotas. This is the default.

-g Manipulate group quotas.

-p Instead of turning quotas off just print state of quotas (ie. whether. quota is on or off)

-x delete
Free up the space used to hold quota information (maintained internally) within XFS. This option is only applicable to XFS, and is silently ignored for other filesystem types. It can only be used on a filesystem with quota previously turned off.

-x enforce
Switch off limit enforcement for XFS filesystems (perform quota accounting only). This option is only applicable to XFS, and is silently ignored for other filesystem types.

NOTES ON XFS FILESYSTEMS


To enable quotas on an XFS filesystem, use mount(8) or /etc/fstab quota option to enable both accounting and limit enforcement. Quotaon utility cannot be used for this purpose. Turning on quotas on an XFS root filesystem requires the quota mount options be passed into the kernel at boot time through the Linux rootflags boot option.

To turn off quota limit enforcement on any XFS filesystem, first make sure that quota accounting and enforcement are both turned on using repquota -s. Then, use quotaoff -vo to disable limit enforcement. This may be done while the filesystem is mounted.

Turning on quota limit enforcement on an XFS filesystem is achieved using quotaon -v. This may be done while the filesystem is mounted.



NAME
quotactl - manipulate disk quotas

SYNOPSIS
#include <linux/quota.h>
#include <xfs/xqm.h>
#include <linux/dqblk_v1.h>
#include <linux/dqblk_v2.h>

long quotactl(int cmd, char special, qid_t id, caddr_t addr)

DESCRIPTION

The quotactl() call manipulates disk quotas. cmd indicates a command to be applied to UID id or GID id. To set the type of quota use the QCMD(cmd, type) macro. special is a pointer to a null-terminated string containing the path name of the block special device for the filesystem being manipulated. addr is the address of an optional, command specific, data structure which is copied in or out of the system. The interpretation of addr is given with each command below.

Q_QUOTAON: Turn on quotas for a filesystem. id is the identification number of the quota format to be used. Format numbers are defined in the header file of appropriate format. Currently there are two supported quota formats whose numbers are defined by constants QFMT_VFS_OLD (original quota format) and QFMT_VFS_V0 (new VFS v0 quota format). addr points to the path name of file containing the quotas for the filesystem. The quota file must exist; it is normally created with the quotacheck (8) program. This call is restricted to the super-user.

Q_QUOTAOFF: Turn off quotas for a filesystem. addr and id are ignored. This call is restricted to the super-user.

Q_GETQUOTA: Get disk quota limits and current usage for user or group id. addr is a pointer to an if_dqblk structure (defined in <linux/quota.h>). The field dqb_valid defines the entries in the structure which are set correctly. On Q_GETQUOTA call all entries are valid. Only the super-user may get the quotas of a user other than himself.

Q_SETQUOTA: Set current quota information for user or group id. addr is a pointer to an if_dqblk structure (defined in <linux/quota.h>). The field dqb_valid defines which entries in the quota structure are valid and should be set. The constants for dqb_valid field are defined in the <linux/quota.h> header file. This call obsoletes calls Q_SETQLIM and Q_SETUSE in the previous quota interfaces. This call is restricted to the super-user.

Q_GETINFO: Get information (like grace times) about quotafile. addr should be a pointer to an if_dqinfo structure (defined in <linux/quota.h>). The dqi_valid field in the structure defines entries in it which are valid. On Q_GETINFO call all entries are valid. Parameter id is ignored.

Q_SETINFO: Set information about quotafile. addr should be a pointer to if_dqinfo structure (defined in <linux/quota.h>). The field dqi_valid defines which entries in the quota info structure are valid and should be set. The constants for dqi_valid field are defined in the <linux/quota.h> header file. This call obsoletes calls Q_SETGRACE and Q_SETFLAGS in the previous quota interfaces. Parameter id is ignored. This operation is restricted to super-user.

Q_GETFMT: Get quota format used on the specified filesystem. addr should be a pointer to a memory (4 bytes) where the format number will be stored.

Q_SYNC: Update the on-disk copy of quota usages for a filesystem. If special is null then all filesystems with active quotas are sync’ed. addr and id are ignored.

Q_GETSTATS: Get statistics and other generic information about quota subsystem. addr should be a pointer to dqstats structure (defined in <linux/quota.h>) in which data should be stored. Special and id are ignored.

For XFS filesystems making use of the XFS Quota Manager (XQM), the above commands are bypassed and the following commands are used:

Q_XQUOTAON: Q_XQUOTAOFF: Q_XGETQUOTA: Q_XSETQLIM: Q_XGETQSTAT:

Q_XQUOTARM:

There is no command equivalent to Q_SYNC for XFS since sync(1) writes quota information to disk (in addition to the other filesystem metadata it writes out).

RETURN VALUES quotactl() returns:

  0 on success.
-1 on failure and sets errno to indicate the error.

ERRORS

EFAULT addr or special are invalid.

ENOSYS The kernel has not been compiled with the QUOTA option.

EINVAL cmd or type is invalid.

ENOENT The file specified by special or addr does not exist.

ENOTBLK special is not a block device.

EPERM The call is privileged and the caller was not the super-user.

ESRCH No disc quota is found for the indicated user.
Quotas have not been turned on for this filesystem.

If cmd is Q_QUOTAON, quotactl() may set errno to:

EACCES The quota file pointed to by addr exists but is not a regular file. The quota file pointed to by addr exists but is not on the filesystem pointed to by special.

EINVAL The quota file is corrupted.

ENOENT The file specified by special or addr does not exist.

ENOTBLK special is not a block device.

EPERM The call is privileged and the caller was not the super-user.

ESRCH No disc quota is found for the indicated user.

EBUSY Q_QUOTAON attempted while another Q_QUOTAON has already taken place.



NAME
quotastats - Program to query quota statistics

SYNOPSIS
/usr/sbin/quotastats

DESCRIPTION

quotastats queries the kernel for quota statistics. It displays:

· Supported kernel quota version
· Number of dquot lookups
· Number of dquot drops
· Number of dquot reads
· Number of dquot writes
· Number of quotafile syncs
· Number of dquot cache hits
· Number of allocated dquots
· Number of free dquots
· Number of in use dquot entries (user/group)




 Thanking You
Hope U Like it......

Own Website

Vtiger Open Source

Install Vtiger CRM

Tortoise installation SVN

Notepad++ install
Ubuntu Server 12.04

Thursday, August 28, 2014

How to Stepup Crontab Scheduler from Terminal command in Linux

August 28, 2014
How to Stepup Crontab Scheduler from Terminal command in Linux
Crontab Scheduler
###Cron - Scheduler###
 Features:
  1. Scheduler
  2. Rules (Cron entries) are based on times:
   a. minute (0-59)
   b. hour (0-23)
   c. day of the month (1-31)
   d. month (1-12)
   e. day of the week (Sun,Mon,Tue, etc. OR 0-7)
   f. command to execute (shell, perl, php, etc.)
 3. Wakes up every minute in search of programs to execute
 4. Reads cron entries from multiple files
 5. Maintains per-user and system-wide (/etc/crontab) schedules

/etc:
cron.d/       
cron.deny - denies cron execution by user
cron.monthly/ - runs jobs monthly
cron.weekly/ - runs jobs weekly  
cron.daily/ - runs jobs daily
cron.hourly/ - runs jobs hourly
crontab - contains system-wide schedules

Note: '*' wildcard in a time column means to run for all values

Per-user Crontabs:
Stored in: /var/spool/cron

Task: 
  1. Create a cron entry for the user 'student1'
   a. su student1
   b. crontab -e
   c. create an entry, minus the name of the user

Note: 'crontab -l' - enumerates per-user cron entries


System-wide Crontab:
Stored in: /etc/crontab

Task:
  1. Create a cron entry in: /etc/crontab

Note: 'crontab -l -u username' - enumerates per-user cron entries


Thanking you
Hope U Like it.....

Windows Server 2008

Notepad

Python 3.4.1

Nagios 4

Oracle Linux 7
How to Install Linux Mint 17

How to Creating Your Own Repository Using Command Mode

August 28, 2014
How to Creating Your Own Repository Using Command Mode
Own Repository


Creating your own repository
Step 1) Check if the package is installed if not install the package : create repo
Step 2) Make a directory for repository
createrepo /root/<Directory-name>
Step 3) Edit the main configuration file
/etc/yum.repos.d/rhel-debuginfo.repo
Edit according to the below configurations
#[rhel-debuginfo]
#name=Red Hat Enterprise Linux $releasever - $basearch - Debug
#baseurl=ftp://10.10.19.30/pub/ (your directory path of RPMs)
#enabled=1
#gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Step 4) Edit the yum.conf file
/etc/yum.comf
Set the gpgcheck=0
Step 5 ) Update repository
Yum update
Step 5 ) Install any software from repository
Yum install <rpm-name>



Thanking you
Hope U Like it.....

Ubuntu 14.04

Lamp Installation in Ubuntu

Root Password Reset in Ubuntu

Linux Mint 17

Own Blogger Website
Install Free BSD