Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Tuesday, September 2, 2014

What is Domain Name System(DNS) & How DNS Works.

September 02, 2014
What is Domain Name System(DNS) & How DNS Works.
DNS - Domain Name System
Domain Name System --Berkeley Internet Name Domain (BIND)

RHEL 5 includes BIND version 9.3

TCP/IP port 53

system-config-bind

 /etc/hosts 
/etc/ resolv.conf

Provides resolution of names to IP addresses
and resolution of IP addresses to names.

Defines a hierarchical namespace where each level of
the namespace is separated by a "."

How DNS works?
-----------------
we ask DNS server for www.cloudnetwork.in resolution it asks Root(.)then (.com ;.net; etc) then ( cloudnetwork.in) then IP address of
www.cloudnetwork.in is sent.

/etc/hosts

Host File provides resolution of hostnames
to IP addresses.

types of DNS servers
---------------------
A master DNS server for your domain(s), which stores authoritative records for your domain.

A slave DNS server, which relies on a master DNS server for data.

A caching-only DNS server, which stores recent requests like a proxy server. It otherwise refers to other DNS servers.

If the DNS server is outside your network, this request can take time. If you have a caching-only name server, these queries are stored locally, which can save significant time while you or others on your network are browsing the same sites on the Internet.

A forwarding-only DNS server, which refers all requests to other DNS servers.


Common host name services :
---------------------------
files /etc/hosts ; /etc/networks
DNS and NIS

/etc/nsswitch.conf determine the order in which to query name service

default is

hosts: files,dns

NIS domain and DNS domain names should usually be different to simplify torubleshooting and
avoid name collisions

Client-side resolvers:
----------------------
dig  ( never look /etc/nsswitch.conf)

dig +trace redhat.com ( reads /etc/nsswitch.conf to determine nameserver)
host ( never look /etc/nsswitch.conf)
nslookup


It can only resolve the names provide in the local host
file.

It cannot be used as central Database.

You can add the name and ip address in /etc/hosts


192.168.0.2      server1.learnadmin.com Server1

Using nslookup to Test DNS
--------------------------
nslookup www.learnadmin.com

Name:   www.learnadmin.com
Address: 192.168.0.2

Using the host Command to Test DNS
-----------------------------------
 host 192.168.0.2

ZONE
-----
Zone is a storage database which contains
all zone Records

 Forward Lookup Zone
--------------------
 Used for Resolving Host Names to IP-Address
 It maintains Host to IP Address Mapping Information

 Reverse Lookup Zone
--------------------
 Used for Resolving IP-Address to Host Names
 It maintains IP Address to Host Mapping Information


SOA is a Start Of Authority record, which is a first record in DNS, which controls the
startup behavior of DNS. We can configure TTL, refresh, and retry intervals in this
record.

###BIND DNS###
Features:
 1. Name-to-IP address mapping
 2. Name resolution for DNS clients
 3. Caching-only server (Default)
 4. Primary DNS server
 5. Slave server
 6. Replication of DNS database information between servers
 7. Dynamic DNS updates
 8. Provides numerous client tools: nslookup, dig, host

Tasks:
 1. Installation of BIND on the remote system: linuxcbtserv4
  a. yum -y install bind

 2. Setup service to auto-start at boot
  a. chkconfig --level 35 named on - enables the service in runlevels: 3,5

 3. Configure a default, caching-only, named.conf file
  a. rpm -ql bind - to see samples
  b. cp /usr/share/doc/bind*/sample/* to /etc/ and /var/named
  c. Modify /etc/named.conf - disable DDNS_KeyGen sections
  d. Start the server - service named start
 
 4. Query the server
  a. dig @localhost www.cloudnetwork.in
   a1. Returns: question, answer, authoritative DNS servers, query time
  b. nslookup www.cloudnetwork.in OR nslookup - server 127.0.0.1 - www.cloudnetwork.in

Note: The server has cached: www.cloudnetwork.in, evidenced by the decrementing TTL values for the various records associated with the zone

  c. host www.cloudnetwork.in - also performs a lookup

Note: /etc/resolv.conf controls the DNS servers that are consulted by lookup tools such as: Web browser, GFTP, LFTP, nslookup, dig, host, etc.

  d. dig cloudnetwork.in MX - queries the domain for mail exchangers

Note: DNS is organized into an inverted tree, with '.' representing the root of the DNS tree. e.g.

dig mail1.cloudnetwork.in.
 - . = root
  - .com = top level
   - .linuxgenius = second level
      -mail = third level
Note: A trailing '.' in a DNS query is implied, and may optionally be indicated if desired in any standard Internet application (web browser, FTP client, wget, nslookup, dig, host, etc.)


Primary & Secondary Zones:
 Features:
  1. Ability to service zones
  2. Authoritative support for a zone

Tasks:
 1. Create internal zone named 'linuxcbt.internal'
  a. modify /etc/named.conf to include the new zone

zone "linuxcbt.internal" {
                type master;
                #allow-update { key ddns_key; };
                file "linuxcbt.internal.db";
        };

  b. create the corresponding zone file
  c. restart named
  d. test resolution of DNS primary zone

Note: Install 'caching-nameserver*' for Caching-only DNS server

 2. Create a slave (Secondary) server
  a. yum -y install bind
  b. copy sample files from primary server to secondary server
  c. modify /etc/named.conf and set 'linuxcbt.internal' zone to slave
  d. start named service - 'service named start'
  e. chkconfig --level 35 named on
  f. Update: /var/named/linuxcbt.internal.db to reflect new name server

 3. Create a primary zone on the "secondary" server
  a. create a zone for: linuxcbt.external - in /etc/named.conf
  b. copy/create 'linuxcbt.external.db' zone file
  c. setup 'linuxcbtserv4' to be a slave for the zone: linuxcbt.external
 
 4. Start 'named' as a caching-only DNS server (Default)
  a. service named start
  b. 'dig @192.168.75.199 www.cloudnetwork.in' - forces a caching-only lookup query

Forward IPv6 Records:
Implemented primarily as AAAA records:

linuxcbtserv1    IN    AAAA    2002:4687:db25:3:202:b3ff:fe98:4108
linuxcbtserv4    IN    AAAA    2002:4687:db25:3:20c:29ff:feb5:1692
linuxcbtmedia1    IN    AAAA    2002:4687:db25:3:20a:5eff:fe1b:4aad
linuxcbtrouter1    IN    AAAA    2002:4687:DB25:3:21A:2FFF:FEE3:F240

Test IPv6 resolution using:
 1. ping6 linuxcbtrouter1.linuxcbt.internal
 2. dig @192.168.75.10 linuxcbtrouter1.linuxcbt.internal


Reverse Zones:
 Features:
  1. The ability to resolve a name, given an IPv4 or IPv6 address


Tasks:
 1. Define an IPv4 reverse zone for the local subnet:
  a. Define zone name: '75.168.192.in-addr.arpa' - /etc/named.conf
  b. Update: /etc/named.conf
  c. Create zone file in: /var/named
  d. Update configuration
  e. Restart named
  f. test using 'dig -x 192.168.75.1'

Note: Reverse zones are built from the prefix in IPv4 subnets


IPv6 Reverse Zone:
 Requirements:
  1. /etc/named.conf entry
zone "3.0.0.0.5.2.b.d.7.8.6.4.2.0.0.2.ip6.arpa" {
        type master;
        file "3.0.0.0.5.2.b.d.7.8.6.4.2.0.0.2.ip6.arpa.reverse";
};

Note: IPv6 reverse zone names are in nibble format, with ALL zeros expanded for the network prefix portion of the address, which is usually 64-bits in length


  2. /var/named/zone_file
   a. Include entries using the last 64-bits or IPv6 host part

d.a.a.4.b.1.e.f.f.f.e.5.a.0.2.0 IN PTR linuxcbtmedia1.linuxcbt.internal.

Note: When creating reverse IPv6 entries for hosts, do the following:
 a. reverse the 64-bit portion of the address that corresponds to the host, expanding all zeros
 b. Create PTR record based on the reverse, nibble-format of the address

Test using dig:
 a. dig -x 2002:4687:db25:3:20a:5eff:fe1b:4aad


Thanking You
Hope U like it.....

Windows Server 2008

Orientdb NoSQL part2

Python 3.4.1

Install OrientDB Document Graph

Netbeans IDE
Vtiger CRM Database

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