Posts

Showing posts from January, 2011

Handling RAID 5 Failover, when 1 disk gets dead .

Image
Handling RAID 5 Failover, when 1 disk gets dead . As everything eventually does break (some sooner than others) a drive in the array will fail. It is a very good idea to run smartd on all drives in your array (and probably ALL drives period) to be notified of a failure or a pending failure as soon as possible. You can also manually fail a partition, meaning to take it out of the RAID array, suppose in your scenario " /dev/sdc1 " drive is faulty, then first we add another drive " /dev/sde " change it to "RAID auto detect partition", 1. Now here we make a RAID partition by, #fdisk /dev/sde Now, make a primary partition with full size and "fd" partition id. After creating RAID partition "/dev/sde1", it'll look like as below snap; 2. Next, we will detach faulty drive "/dev/sdc1" by, #mdadm /dev/md0 -f /dev/sdc1 3. Add new RAID partition "/dev/sde1" in RAID 5 device "/dev/md0",

How to extend LVM Volume online ?

Image
How to extend LVM Volume online ? Note : If you see my current setting of LVM is as below; 1. Here with below command i am extending my "/dev/vg0_data/vol0_Data" volume by "2GB" #lvextend -L +2048M /dev/vg0_data/vol0_Data But to get that 2GB memory online you need to execute one more command, # resize2fs /dev/vg0_data/vol0_Data Now to verify, do as below in snap;    In LVM, online memory extend of LV is possible, but to reduce LV size will need a reboot. #lvreduce -L -1024M /dev/vg0_data/vol0_Data

Implimenting LVM over RAID 5

Image
Implimenting LVM over RAID 5  What is LVM : LVM stands for Logical Volume Manager, It is needed to be implimented if you want to increase your Logical Volume size in online (Increase without restart) condition, mostly in case of large production scenarios. In normal scenarios, we just setup server with normal "Ext3" to which we cant expand if it gets full. So here LVM concept comes. Why LVM on RAID 5 : To get data redundancy as well as online memory expand. As you saw in my previous article, how to impliment RAID 5 on RHEL / CentOS now next step is what you will do if you want Data redundancy as well as online memory expanding feature ? Yes, we impliment LVM over the RAID 5 volume. See below how ??? 1. Here i am assuming that we have successfully created a "/dev/md0" raid volume. 2. Now in LVM 1st we will create Physical Volume #pvcreate /dev/md0    Physical volume "/dev/md0" successfully created (Output) 3. Next create Volume Grou

How to implement and configure RAID 5 on RHEL / CentOS ?

Image
How to implement and configure RAID 5 on RHEL / CentOS ? What is RAID 5 : RAID-5 eliminates the use of a dedicated parity drive and stripes parity information across each disk in the array. Why we use RAID 5 : RAID-5 has become extremely popular among Internet and e-commerce companies because it allows administrators to achieve a safe level of fault-tolerance without sacrificing the tremendous amount of disk space necessary in a RAID-1 configuration or suffering the bottleneck inherent in RAID-4. RAID-5 is especially useful in production environments where data is replicated across multiple servers, shifting the internal need for disk redundancy partially away from a single machine. RAID level 5 can replace a failed drive with a new drive without user intervention. This functionality, known as Hot-spares. Also supports Hot-Swap, Hotswap is the ability to removed a failed drive from a running system so that it can be replaced with a new working drive. This means drive replacement

Simple Nagios Installation and Configuration.

Nagios Prerequisites: 1. Packages - Apache Web Server, PHP, gcc & gd libraries for compilation. 2. Should be configured with static IP & valid FQDN. 3. All the monitoring devices should be accessible from Nagios Host. A. Installation of Apache : #yum install httpd* Note : Now after httpd installation start webserver by, #service httpd start #chkconfig httpd on B. Install all dependency packages like, #yum install php* gcc* gd* C. Download Nagios "nagios-3.2.3.tar.gz" & "nagios-plugins-1.4.15.tar.gz" packages from below website, URL :  http://www.nagios.org/download D. Nagios Installation : 1. Extract nagios-3.2.3.tar.gz package, #cd /root/Desktop/ #tar -zxvf nagios-3.2.3.tar.gz It will extract all files in "nagios-3.2.3" folder, 2. Add User "nagios"  & provide password, #useradd nagios #passwd nagios #usermod -a -G nagios apache Note : The above command will p

What is Patch ?

What Is a Patch? A patch is an update. It incorporates changes in source code. Patches are normally applied to specific software components, such as the kernel, or a service, such as vsFTP. Patches may fix bugs, address security issues, or incorporate new features. As an administrator, you're responsible for testing the new software, making sure that it addresses any problems before your users see them on their systems. Patches can be released from developer or some 3rd parties. It can be apply for, 1. Security Fixes 2. Service Upgrades 3. Bug Fixes 4. Kernel Patches 5. Kernel Upgrades Patch Sources: There are several sources for patches and upgrades. The best source is generally the upgrade repository preconfigured for your distribution. However, there is often a delay when distribution developers process updates from other sources, such as the kernel, or services, such as the Apache Web server. Red Hat Enterprise Linux Updates : If you want RHEL, you may have

Sudo How to ..?

Sudo (superuser do) allows a system administrator to work using his own account and switch to root or other user identity available on the system only for commands that need it. Here i have added four users ashish, akshay, agent and mach for this tutorial to make them sudo users. Log File for Sudo : /var/log/messages SUDO file: /etc/sudoers What we will do here: 1. User "ashish" will have access of all commands as root, but with password. 2. User "akshay" will have access of all commands as root, but without password. 3. User "agent" will have limited access of network service, but with password. 4. User "mach" will have limited access of adding users & setting password for them, with password. To Set sudo users, #visudo To set access for Users "Ashish" and "Akshay" add entry as below after "root    ALL=(ALL)       ALL", ashish  ALL=(ALL)       ALL akshay  ALL=(ALL)       NOPASS

How to install Grub natively on your HDD ?

Installing GRUB natively : Caution : Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS. GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS). If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create the GRUB boot disk, and reboot your computer with it. Once started, GRUB will show the command-line interface. First, set the GRUB's root device, to the boot directory, like this: grub> root (hd0,0) If you are not sure which partition actually holds these files, use the command like this; grub> fi

"grub-install" How to.

1. How to create GRUB boot floppy with a filesystem ? # mke2fs /dev/fd0 # mount -t ext2 /dev/fd0 /mnt # grub-install --root-directory=/mnt fd0 # umount /mnt 2. How to install GRUB in USB pendrive ? Some BIOSes have a bug of exposing the first partition of a USB drive as a floppy instead of exposing the USB drive as a hard disk (they call it “USB-FDD” boot). In such cases, you need to install like this: # losetup /dev/loop0 /dev/sdb1 # mount /dev/loop0 /mnt/usb # grub-install --boot-directory=/mnt/usb/bugbios --force --allow-floppy /dev/loop0 3. How to install GRUB if you have saparate /boot partition on any Hard disk ? # grub-install --root-directory=/boot /dev/hda OR, in grub menu to install GRU on available hardisk, root (hd0,0) setup (hd0) grub-install accepts the following options: ‘--help’ Print a summary of the command-line options and exit. ‘--version’ :Print the version number of GRUB and exit. ‘--root-directory=dir’ :Install GRUB image

What is GRUB ?

What is GRUB ? GRUB (GRand Unified Bootloader) : A boot loader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to an operating system kernel software. The kernel, in turn, initializes the rest of the operating system. GRUB is a very powerful boot loader, which can load a wide variety of free operating systems, as well as proprietary operating systems with chain-loading (chain-load is the mechanism for loading unsupported operating systems by loading another boot loader. It is typically used for loading DOS or Windows). One of the important features in GRUB is flexibility; GRUB understands filesystems and kernel executable formats, so you can load an arbitrary operating system the way you like, without recording the physical position of your kernel on the disk. Features: 1. Support multiple filesystem types like, ext2/3/4, DOS, FAT12/16/32, NTFS, ReiserFS and many more. 2. Suppoerts automatic & transpar

How to recover bad partition or superblock on Ext3 partition ?

How to recover bad partition or superblock on Ext3 partition ? What if you are getting below two errors ? 1. /dev/sdb2: Input/output error 2. mount: /dev/sdb2: can't read superblock Steps : 1. If you can go to Emergency Mode in the Linux and it directely asking for password or else Go to rescue mode, by booting with 1st Linux cd or a DVD then on "boot:" prompt "linux rescue" and press enter. 2. Unmount the partition first on which you getting the error. 3. Next find out bad superblock to recover, #dumpe2fs /dev/sdb2 | grep superblock Sample Output : ------------------------------------------------------------------ Primary superblock at 0, Group descriptors at 1-6   Backup superblock at 32768, Group descriptors at 32769-32774   Backup superblock at 98304, Group descriptors at 98305-98310   Backup superblock at 163840, Group descriptors at 163841-163846   Backup superblock at 229376, Group descriptors at 229377-229382   Backup superb

How to delete file permanentely so that no one can recover ?

How to delete file permanentely so that no one can recover ? shred: Shred utility overwrites a file to hide its contents, and optionally delete it if needed. The idea is pretty simple as it overwrites the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data. By default file is overwritten 25 times. When you move your rented server you should consider running file shredding; otherwise new owner can get data including passwords. 1. Shred a single file; Securely delete a file called /root/passwd.info: #shred -u /root/passwd.info You can add a final overwrite with zeros to hide shredding: #shred -u -x /root/passwd.info Where, -u : Remove file after overwriting -x : Add a zero to hide shredding -n <Number> : Overwrite number of times instead of the default 25 2. To shred on entire partition; #shread -n 30 -vz /dev/sdb

How to use dd command ?

How to use dd command ? DD - Disk Dump 1.  Create an empty file of 650MB size. #dd if=/dev/zero of="empty_file" bs=1024k count=650 2. To Create ISO from CD OR DVD #dd if=/dev/cdrom of=file.iso 3. Create an exact image of this floppy-disk by issuing the command #dd if=/dev/fd0 of=floppy.img 4. Create backup of HDD or partition #dd if=/dev/sdb of=backup.dd You can check the backup image consistency to check for any problem with backup image #fsck -y backup.dd 5. Creating backup of one hardisk in to second HDD. #dd if=/dev/sda of=/dev/sdb conv=noerror,sync bs=4k Note :  dd with conv=noerror writes nothing in the image in case of a bad block.     You can check the backup image consistency to check for any problem with backup image #fsck -y /dev/sdb 6. How to take backup of only MBR and MBR + Partition Table; #dd if=/dev/sda of=mbr.bak bs=1 count=446 (Backup only MBR) #dd if=/dev/sda of=mbr_part.bak bs=1 count=512 (Backup MBR + P