Monday, February 15, 2010

password protected grub

1> open vim /etc/grub.conf
2>Add password --md5 (copy and paste the md5 value)
3>save and exit grub.conf file

Now
1>In terminal run grub-md5-crypt
2>chose a password for grub.conf file
3>copy the md5 value and paste the grub.conf file in Add password --md5 value section

Now if all done successfully .You have to put password by press p to open the grub.conf file .

Sunday, February 14, 2010

Linux LVM

Creating A LVM
--------------------
1>pvcreate /dev/hdb5 --pvdisplay /pvs
2>vgdisplay myvg1 /dev/hdb5 --vgs /vgdisplay
3>lvdisplay -L 5000M -n mylv1 myvg1 -- lvs /lvdisplay

Create a partition and mount the Lvm on it
-------------------------------------------

1>Using fdisk create a partitions and then toggle the value to 8e.
2> save and exit fdisk utility .Now run partprobe.It will now show linux lvm in partition section.
To see it using fdisk -l command.
3>Now make a partition (e.g -mkdir -p /lvm )
4> mkfs -t ext3 /myvg1/mylv1
5> mount /myvg1/mylv1 /lvm
6>Now df -h to see the mounted lvm partition and lvdisplay to see the lvm size.

Extending the Logical Volume:
-----------------------------------
lvextend -L +1000M /dev/mylv1/myvg1
resize2fs /dev/mylv1/myvg1

Reducing the Logical Volume:
---------------------------------
umount /lvm
fsck -f /dev/mylv1/myvg1
resize2fs /dev/myvg1/myvg1 1000M
lvreduce /dev/myvg1/mylv1 -L 1000M

Delete cache file
--------------------
rm -rf /etc/lvm/.cache

Thursday, February 11, 2010

Redhat linux Raid configuration

Step by step creating Raid 5 in Rhel5
===========================
1>create a petition /dev/hda5 , /dev/hda6 and /dev/hda7 of each 1000 mb
2> toggle the parition to fd
3> partprobe
4>create a directory /raid5
5> mdadm -C /dev/md0 -a yes --level=5 -n 3 /dev/hda{5,6,7, }
6>mkfs -t ext3 /dev/md0
7>mount /dev/md0 /raid5

Adding another partion in existing raid 5
=============================
1>umount /dev/md0 /raid5
2>mdadm -S /dev/md0
3>cat /proc/mdstat
4>mdadm --add /dev/md0 /dev/hda8
5>mount /dev/mdo /raid5
6>mdadm --detail /dev/md0

Deleting existing Raid
================
1> umount /dev/md0 /raid5
2>mdadm -S /dev/md0
3>cat /proc/mdstat
4>mdadm --remove /dev/md0 /dev/hda{5,6,7}
5>mdadm --detail /dev/md0
6> fdisk /dev/hda
7>delete 5,6,and 7 pertition
8>w
9>partprobe