Thursday, March 31, 2011

RPM and QUOTA MANAGEMENT


                       RPM [ Red Hat Package Manager ]
To check options for command “rpm”
$ man rpm

To Remove a Package :-

$ rpm -e (package name)

To Install RPM :-

$ rpm -ivh (package name)

To check whether Package is Already Installed or not :-

$ rpm -qa |grep (Package name)


                        Quota Management

1] Quota is applied on Partition basis
2] Quota is applied on user basis
3] Quota is applied on group basis

a) Edit /etc/fstab file
b) In the 'mount' command of a specified partition after defaults, type usrquota or grpquota or both.
e.g. /dev/hdc3 /data ext3 defaults,usrquota,grpquota 0 0

c) Run the 'quotacheck -a' command :- this will create 'aquota.user & aquota.grp' files on the partitions, where the quota is applied.
d) To specify user quota run 'edquota' command

Create Partition on Disk :-

$ fdisk -l
$ fdisk /dev/sda2
        press 'm' for help
        press 'n' To create new Partition
        Enter last cylinder size :
        press 'w' write table to disk and exit
        press 'q' quit

After that restart your machine [ If you dont want to restart machine give command  “$ partprobe /dev/sda2”]

Then Format that partitions

$ mke2fs -j /dev/sda2

Then edit “/etc/fstab” file
/dev/sda2 /abc auto defaults,usrquota,grpquota 0 0

Save and Exit

Then mount that partition, for that

$ mkdir /test
$ mount /dev/sda2 /test


Then come to root and give command,

$ quotacheck -a

Then goto “/test” directory. There is a new file created 'aquota.usr'

Then give,
$ edquota -u (user name)
i.e.
$ edquota -u user2


give this command in '/test' directory.

Here, the terms are,

Soft limits :- Warning period 2-3 days to delete data.
Hard Limit :- Above this limit user is not allowed to store data.
inodes :- Restriction on making files & directories. It has also soft & hard limit.
Blocks :- The limit upto which user can create data [e.g. 100Mb, 500Mb etc.]
i.e. Edit /etc/fstab
File System    Blocks    Soft     Hard    inodes    Soft     Hard
/dev/sda2          0           10        20          0             0         0

save & exit

For other user, $ edquota -u user2

To ON quota :-
$ quotaon /dev/sda2

Then login using user2 & try to make files or directories in /test directory. He can not make more files or directories.

After giving command '$ quotaon /dev/sda2' 'aquota.group' file is created in /test directory.

Some more Commands :-

$ man repquota

To OFF quota :      $ quotaoff /dev/sda2
To Check quota :   $ quotacheck -auvg

No comments:

Post a Comment