Sunday, July 12, 2009

Backup , compressions, Automatic execution of commands

#du -sh dir name or file name ( to check size of file or directory )
# tar cvf filename .tar directory name (backup and compression done up to 40%-50%)
c- create
v - visual
f-file extension sport
# tar tf filename .tar ( to check the file )
#gzip -9 filename.tar ( high level compression and convert into file into .gz)

#tar zxvf filename.tar.gz ( decompress)

Automatic execution of commands
> first find path of command
#whereis command name
> then open crontab
#crontab -e
then add entry like this
*(for mintue) *(for hour) *( for date) *(for month ) *(for day of week 1-7)

forexample:-
44 19 12 7 7 /bin/reboot(path of commands)

save and exit

> then
# service crond restart

NFS( network file system)

>It is used to share the data between linux To linux system
>Sharing on the basis of IP address
>"ACL"( access control list) is defined the mange shared list
>configuration file is "/etc/exports"

Create The NFS
> First create check IP
#ifconfig
#service network restart
#mii-tool ( to check the cable connected or not)
#lokkit ( to mange firewall)
> then define ACL
# vim /etc/exports

and add entry
example : /dirname 10.0.0.256(rw,sync)


#chkconfig portmap on
#service nfs restart
#chkconfig nfs on
#showmount -e IP address
#mount 10.0.0.55:/dirname /mnt

after mounting we can share the data

Friday, July 10, 2009

USER QUOTA

Quota is used to retrick the user for the space limit and number of file limits

quota has 2 limit
> soft limit (show warning only )
> hard limit (retrick the last limit)

Step to creating quota

> first create The partition using
# fdisk /dev/sda
>then
#partprobe /dev/sda
> then format
#mkfs.ext3 /dev/sda5
> then create entery in fstab
#vim /etc/fstab
example :- /dev/sda5 /home ext3 defaults.usrquota 0 0
#mount -a
>refresh or restart the system
#mount -o remount /home
#ll /home
>then create database file
#quotacheck /home
>database file is "aquota user"
> then make active the file aquota use command
#quotaon -v /home
>then add user
#useradd username
#passwd -------
#ll /home
>then edit and gave the limits to user open file then add limits
#edquota username
> don't change intial reading
blocks = size
inodes= number of file limits
then give soft and hard limits
save and exit
and logout
#logout

then login to user and check limits and its work or not
#repquota -av
#quota

Remove quota
>first delet user
#userdel
#umount /home
>remove entery to fstab
#vim /etc/fstab
#mount -a
>then delet partition
#fdisk /dev/sda

Saturday, July 4, 2009

LVM( logical Volume Managment )


Create a LVM


>first create Three Partition

>change ID of created partitions 83 to 8e

#partprobe /dev/sda
> create LAYER 1

#pvcreate /dev/sda5 /dev/sda6 /dev/sda7

#pvdisplay |less


> Create LAYER 2

#vgcreate volume1 /dev/sda5 /dev/sda6 /dev/sda7

#vgdisplay

> create LAYER 3

#lvcreate -l 25GB -n logical1 volume1

#lvdisplay
> format partition
#mkfs.ext /dev/volume1/logical1

#mkdir /dirname

#vim /etc/fstab

/dev/volume1/logical1 /dirname ext3 defaults 0 0

#mount -a
#df -TH

> How to extend the LVM?


#vgdisplay

if free space is there then uses command:-

# lvextend -L +10GB -n /dev/volume1/logical1

> then online format

#resize2fs /dev/volume1/logical1

otherwise create partition and change ID of partition

#partprobe /dev/sda

#pvcreate /dev/sda8

#vgextend volume1 /dev/sda8

#vgdisplay

#lvextend -L 10GB -n /dev/volume1/logical1

#resize2fs /dev/volume1/logical1

#df -TH

REMOVE LVM


#df -TH

#umount /dirname

Remove fstab entry

#vim /etc/fstab

#mount -a
#lvdisplay

#lvremove /dev/volume1/logical1

#vgremove /dev/volume1

#fdisk -l

#pvremove /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8

then delete the partitons

Friday, July 3, 2009

RAID

It is basicaly a file system use to manage data over multiple harddisk with and without backup depending upon the level of RAID (0,1,5)

The principle of raid is to use same make and model of harddisk.

How to create RAID ?


> first create three partitions

> then change TD from 83 to fd

> now create RAID by using these commands:

#mdadm -C /dev/md0 -l 5 -n 3 /dev/sda /dev/sdb /dev/sdc

> to check the details

#mdadm -D /dev/md0

> to watch online status of RAID

# watch cat /proc/mdstat

> now formatting the RAID partition

# mkfs.ext3 /dev/md0

> then make directory

# mkdir /dirname

> for permanent mounting add entry in fstab

# vim /etc/fstab
for eg. /dev/md0 /dirname ext3 defaults 0 0

# mount -a

> to show the RAID partition :

# df -TH

"FAULT TOLRENCE OF RAID"


> first to make faulty the partition

# mdadm /dev/md0 -f /dev/sdb ( this command is to use only to make faulty the partiton )

> then remove the faulty partition

# mdadm /dev/md0 -r /dev/sdb

> now create a new partition then add this partition on RAID

#mdadm /dev/md0 -a /dev/sdd

Create and Delete partitions in Linux system

Installation of REDHAT LINUX

Select option of Custom Layout and then
Make the three partitions in your free hardisk :-
1) /boot ( containing booting files ) Size= 100MB approx.
2) / (System files ) Size= 3 -10GB
3) Swap (virtual memory ) Size = Double of RAM

Creating Partitions

First check the Hard disk free space using command
#fdisk -l
Then create a partitions following commands and steps
#fdisk /dev/sda(if you have sata hard disk ) or /hda (if you have pata hard disk)

[""(then display)
The number of cylinders for this disk is set to 77520.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)


Command (m for help):

Press n to create partition

first create extended partition

By press e

then create logical drives with different size

To refresh the commonds partition use command

#partprobe /dev/sda

then format it

#mkfs.ext3 /dev/sda5( "5" is your drive number)


Then create mount point first make directory

#mkdir /directoryname

#mount /dev/sda5 /directoryname

then edit entry in fstab by

#vim /etc/fstab


then edit entry

for ex:- /dev/sda5 /dirname ext3 defaults 0 0

then save and exit form vim editor

#mount -a




Delete partition

first check the name of directory name &then
#umount /dirname
#vim /etc/fstab
delete entry from fstab

#mount -a

and delete partiton in
#fdisk /dev/sda
#partprobe