Archive for the ‘ General ’ Category

Grub re-install


All I get is "grub" or a "grub>" prompt when I try and boot


You have to install GRUB on the MBR (Master Boot Record). To do this just follow this steps:


First you will need to know what Grub calls the hard disk drive partition that holds the required files.

A quick aside :- There are three ways of defining hard disk drives and their partitions. The first, that you’re most probably familiar with, is Windows/MS-DOS letters (such as C: or D: ).

The second is Linux’s method, which is to give the first device (hard disk drive or CD-ROM drive) on the first IDE (ribbon) cable the name /dev/hda, the second device (hard disk drive or CD-ROM drive) on the first cable is called /dev/hdb, the first device (hard disk drive or CD-ROM drive) on the second cable is called /dev/hdc and the second device on the second cable is called /dev/hdd .

So, you’ve got the names hda, hdb, hdc, and hdd for all of your four possible IDE/SCSI attached devices, although you probably only have a hard disk on hda and a CD ROM / DVD drive on hdb.

The hard disks are, probably, cut up into partitions that are numbered from one. So the first partition on the first hard disk attached to the first IDE cable will be called /dev/hda1, while the second will be called /dev/hda2 and, for further example, the fifth partition on the second hard disk on the second IDE cable would be called /dev/hdd5.

Get the idea?

Now to the third way of naming a hard disk and partition. Grub uses the letters “hd” followed by a number starting at zero to name the hard disks. To denote a particular partion a comma and a further number, again starting at zero is added. All of this is surrounded by brackets ().

So to Grub, the first hard disk drive attached to the first IDE/SCSI cable is called (hd0) , and to specify the first partition on that drive you would need to type (hd0,0)

(First of all, enter your BIOS setup and in BOOT Sequence window choose to boot with CDROM first.) Once the server is up in the live CD, you need to find out which is the correct partition containing the boot directory.

Issue the below command to find this.

grub> find /boot/grub/stage1

and you’ll get returned the hard disk name and partition that has that file (see above for how Grub names these). However, if you have a separate /boot partition, remove /boot from the above command.

grub> find /grub/stage1

You can see (hd0,0). The output of this command is the name of the hard disk and partition that holds the stage1 file.

So, when you tried this, you got (hd0,0) returned to you. This tells me that your /boot/ folder lives on the first partition on hard disk on the first IDE cable. If it had returned (hd0,1) instead, that would have shown you that the /boot/ folder lived on the second partition of the first hard disk on the first IDE cable.

Once we have found this out we need to give Grub this in the next commands.

The root command tells Grub where to base all of its file path searches from. We take the hard disk and partition, given by the find command and use it with the root command, like so :-

grub> root (hd0,0)

Next comes the kernel command. This tells Grub the name of the kernel (core part of Linux) that you want to load when, later, you do the boot command.

As there is no way that you can remember the full name of the kernel, you can use the tab key facility in Grub (the tab key is that one with two opposite facing horizontal arrows that sit above the Caps Lock key on most keyboards).


Let me explain the root command with example. If I did nor give root hd0,0) and pressed tab after typing kernel, you can see no output fro grub. This happens as we have not specified to grub a base harddisk and partition where it can look for kernel files.

grub> find /grub/stage1

grub> kernel /
Error 12: Invalid device requested

Now I am giving root (hd0,0) to grub. Now grub can suggest you options as grub now know where to look for possible files.

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> kernel /
 Possible files are: grub symvers-2.6.9-100.ELsmp.gz boot symvers-2.6.9-89.35.1.ELsmp.gz vmlinuz-2.6.9-89.35.1.ELsmp initrd-2.6.9-100.ELsmp.img grub.OLD
.9-023stab053.2-enterprise initrd-2.6.9-89.35.1.ELsmp.img config-2.6.9-89.35.1.ELsmp message config-2.6.9-100
.ELsmp initrd-2.6.9-023stab053.2-enterprise.img vmlinuz-2.6.9-100.ELsmp lost+found message.ja vmlinux-2.6.9-023stab053.2-enterprise vmlinuz-2.6.9-023stab053.2-enterpri

Thats enough for root stuff. Carry on below.

Load the kernel. If you dont know with which kernel the server was up, follow the steps below.

Mount the harddrive partition to get the /boot partition. If the /boot is separate partition, mount it, otherwise mount / partition. In the below example, its separate partition.

[root@vps9 grub]# fdisk  -l

Disk /dev/sda: 139.9 GB, 139978604544 bytes
255 heads, 63 sectors/track, 17018 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          65      522081   83  Linux
/dev/sda2              66         587     4192965   82  Linux swap
/dev/sda3             588        1109     4192965   82  Linux swap
/dev/sda4            1110       17018   127789042+   5  Extended
/dev/sda5            1110        1370     2096451   83  Linux
/dev/sda6            1371       17018   125692528+  83  Linux

How to confirm which is the /boot partition? Look for the * in the “Boot” coloumn in the fdisk output. Now mount it.

mkdir /oldboot
mount /dev/sda1 /oldboot
cat /oldboot/grub/grub.conf

Note the default loaded kernel grub lines. Eg :

title Virtuozzo (2.6.9-023stab053.2-enterprise)
        root (hd0,0)
        kernel /vmlinuz-2.6.9-023stab053.2-enterprise ro root=LABEL=/ console=ttyS0,57600 console=tty debug
        initrd /initrd-2.6.9-023stab053.2-enterprise.img

Go back to grub prompt and pass the kernel

grub> kernel /vmlinuz-2.6.9-023stab053.2-enterprise ro root=LABEL=/


If with “root=LABEL=/” the kernel failed to boot, then get the / partition and supply it as root=/dev/sda5. You can check it by using e2label.

[root@vps9 grub]# e2label /dev/sda5

Now pass the initrd

grub> initrd /initrd-2.6.9-023stab053.2-enterprise.img

Boot the passed kernel

grub> boot

Linux will now boot.

Re-installing Grub from within Linux

Once the server is up, ssh into the server. From command prompt you will need to enter the grub-install command. This takes one parameter – the name of the hard disk whose master boot record (mbr) will be having grub installed on it.

[root@vps9 grub]# grub-install /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

# this device map was generated by anaconda
(fd0)     /dev/fd0
(hd0)     /dev/sda

That will do.


If you’re still having boot problems

Grub errors messages

The complete list of error messages are at the end of this HowTo.

The two that I’ve bumped into are

Error 15
File note found.

Which normally means that you have mistyped the file name. Try using the tab key to help you fill in Grub commands.

Error 17
Unable to mount (use) the partition.

This may be that you have mistyped the number (remember, Grub counts from zero and not one), or that the partition that you pointed at does not have a valid file system.

Kernel panics If you get an error message, while booting, along these lines :-


Kernel panic: No init found. Try passing init= option to kernel

Your kernel needs something called an “initrd” and can’t find one. There are a number of reasons that this can happen.

-> You haven't put an initrd statement in your Grub.conf or while at the Grub prompt.

Easy one to fix, just make sure that you have the correct (and correctly spelt) initrd for Grub to pass to the kernel. Have a look at the “All I get is either a “grub>” prompt or just “grub” when I try and boot” section of this HowTo.

-> The "root=" parameter on the kernel statement does not point to the correct hard disk and partition.

The “root=” parameter on the kernel statement often says “root=LABEL=/”, which often works just fine, but sometimes you have to be more exact. I’ve only found this to be a problem when I’m using a separate /boot and root (/) partition, or when Mandrake is involved. So change the “LABEL=/” bit to the partition that contains your root (/) folder. If your root (/) partition is on /dev/hda6, for example, then make the root statement look like “root=/dev/hda6”.

-> The initrd file has become corrupted or been deleted.

You’ll need to get a Linux up using either a distribution/rescue CD or a rescue diskette. Then change the root to your hard disk drive by entering, from the shell command prompt, chroot /dev/hdxy . Where the “x” is the letter of the hard disk and the “y” is the number of the partition. So, if your normal /boot folder is on /dev/hda2 , then enter chroot /dev/hda2/

Then change directory to the /boot folder, move the old .img file out of the way – assuming it’s still there – by renaming it to *.img.old , and then create a new initrd by typing mkinitrd -v -f initrd-KERNEL-VERSION.img KERNEL-VERSION . Replace “KERNEL-VERSION” with the version of the kernel that you are trying to load. If you do a full listing of the /boot folder you’ll see the same numbers and letters in the full kernel file’s name (eg. for the kernel called “vmlinuz-2.4.22-10mdk” , you would want to create an initrd called “initrd-2.4.22-10mdk.img” and the kernel version would be “2.4.22-10mdk” ).


Footnote: – Search order at boot up time. Your PC will look for an operating system in a number of places, in an order set out in the BIOS. If you find that your PC refuses to look for an operating system in either your floppy diskette drive (if you are attempting to boot from a rescue diskette) or from your CD-ROM / DVD drive (if you are trying to boot from an installation CD / DVD), then you’ll need to enter your BIOS setup.

To enter the BIOS setup screens you will need to press either the Del key or the F2 key during the POST checks (which one is dependent on your PC). So, turn your PC on and while it is giving you all of those messages about how much RAM you have and what disks it knows about, press the relevant key for your PC. Keep pressing until you are presented with either a blue or grey BIOS screen.

Using a combination of the cursor arrow keys, the tab key and the enter key, navigate your way to the option to change the boot order.

On an AMIBIOS (grey) screen, you will need to move right to the Boot option, press Enter and then move down to the Boot Device Priority option and press Enter , then select the first device, press Enter and select from the list. When you’ve picked the correct boot device (Floppy or CDROM), press the Esc key to exit up the levels, then move across to Exit and select Exit saving changes .

On an Award BIOS (blue) screen, move down to the Advanced BIOS Features, press Enter, then move down to the First Boot Device, again press Enter and select from the list. Once done, press the Esc key to move back up levels and then across and down to the Save & Exit Setup option.
There are other BIOSs out there , but these are to only two that I have access to. Hopefully, though, you’ll have got the idea of what to do, from the above description. And you can always escape out of trouble by repeatedly pressing the Esc key.


Grub Error messages :-

1 : Filename must be either an absolute filename or blocklist This error is returned if a file name is requested which doesn’t fit the syntax/rules listed in the Filesystem.

2 : Bad file or directory type This error is returned if a file requested is not a regular file, but something like a symbolic link, directory, or FIFO.

3 : Bad or corrupt data while decompressing file This error is returned if the run-length decompression code gets an internal error. This is usually from a corrupt file.

4 : Bad or incompatible header in compressed file This error is returned if the file header for a supposedly compressed file is bad.

5 : Partition table invalid or corrupt This error is returned if the sanity checks on the integrity of the partition table fail. This is a bad sign.

6 : Mismatched or corrupt version of stage1/stage2 This error is returned if the install command points to incompatible or corrupt versions of the stage1 or stage2. It can’t detect corruption in general, but this is a sanity check on the version numbers, which should be correct.
7 : Loading below 1MB is not supported This error is returned if the lowest address in a kernel is below the 1MB boundary. The Linux zImage format is a special case and can be handled since it has a fixed loading address and maximum size.

8 : Kernel must be loaded before booting This error is returned if GRUB is told to execute the boot sequence without having a kernel to start.

9 : Unknown boot failure This error is returned if the boot attempt did not succeed for reasons which are unknown.

10 : Unsupported Multiboot features requested This error is returned when the Multiboot features word in the Multiboot header requires a feature that is not recognized. The point of this is that the kernel requires special handling which GRUB is probably unable to provide.

11 : Unrecognized device string This error is returned if a device string was expected, and the string encountered didn’t fit the syntax/rules listed in the Filesystem.
12 : Invalid device requested This error is returned if a device string is recognizable but does not fall under the other device errors.

13 : Invalid or unsupported executable format This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).

14 : Filesystem compatibility error, cannot read whole file Some of the filesystem reading code in GRUB has limits on the length of the files it can read. This error is returned when the user runs into such a limit.

15 : File not found This error is returned if the specified file name cannot be found, but everything else (like the disk/partition info) is OK.

16 : Inconsistent filesystem structure This error is returned by the filesystem code to denote an internal error caused by the sanity checks of the filesystem structure on disk not matching what it expects. This is usually caused by a corrupt filesystem or bugs in the code handling it in GRUB.

17 : Cannot mount selected partition This error is returned if the partition requested exists, but the filesystem type cannot be recognized by GRUB.

18 : Selected cylinder exceeds maximum supported by BIOS This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB in general).

19 : Linux kernel must be loaded before initrd This error is returned if the initrd command is used before loading a Linux kernel.

20 : Multiboot kernel must be loaded before modules This error is returned if the module load command is used before loading a Multiboot kernel. It only makes sense in this case anyway, as GRUB has no idea how to communicate the presence of such modules to a non-Multiboot-aware kernel.

21 : Selected disk does not exist This error is returned if the device part of a device- or full file name refers to a disk or BIOS device that is not present or not recognized by the BIOS in the system.

22 : No such partition This error is returned if a partition is requested in the device part of a device- or full file name which isn’t on the selected disk.

23 : Error while parsing number This error is returned if GRUB was expecting to read a number and encountered bad data.

24 : Attempt to access block outside partition This error is returned if a linear block address is outside of the disk partition. This generally happens because of a corrupt filesystem on the disk or a bug in the code handling it in GRUB (it’s a great debugging tool).

25 : Disk read error This error is returned if there is a disk read error when trying to probe or read data from a particular disk.

26 : Too many symbolic links This error is returned if the link count is beyond the maximum (currently 5), possibly the symbolic links are looped.

27 : Unrecognized command This error is returned if an unrecognized command is entered on the command-line or in a boot sequence section of a configuration file and that entry is selected.

28 : Selected item cannot fit into memory This error is returned if a kernel, module, or raw file load command is either trying to load its data such that it won’t fit into memory or it is simply too big.

29 : Disk write error This error is returned if there is a disk write error when trying to write to a particular disk. This would generally only occur during an install of set active partition command.

30 : Invalid argument This error is returned if an argument specified to a command is invalid.

31 : File is not sector aligned This error may occur only when you access a ReiserFS partition by block-lists (e.g. the command `install’). In this case, you should mount the partition with the `-o notail’ option.

32 : Must be authenticated This error is returned if you try to run a locked entry. You should enter a correct password before running such an entry.

33 : Serial device not configured This error is returned if you try to change your terminal to a serial one before initializing any serial device.

34 : No spare sectors on the disk This error is returned if a disk doesn’t have enough spare space. This happens when you try to embed Stage 1.5 into the unused sectors after the MBR, but the first partition starts right after the MBR or they are used by EZ-BIOS.



dmidecode is a tool for dumping a computers DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the systems hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. You can retrieve this information without having to probe for the actual hardware.

Options are:

-d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem)
-h, --help             Display this help text and exit
-q, --quiet            Less verbose output
-s, --string KEYWORD   Only display the value of the given DMI string
-t, --type TYPE        Only display the entries of given type
-u, --dump             Do not decode the entries
    --dump-bin FILE    Dump the DMI data to a binary file
    --from-dump FILE   Read the DMI data from a binary file
-V, --version          Display the version and exit

In the options we need to learn about –type

-t, --type TYPE --> Only display the entries of type TYPE. TYPE can be either a DMI type number, or a comma-separated list of type numbers, or a
keyword  from  the following list: bios, system, baseboard, chassis, processor, memory, cache, connector, slot

The complete list is pasted below.

     Type   Information
         0   BIOS
         1   System
         2   , type the following command 
         3   Chassis
         4   Processor
         5   Memory Controller
         6   Memory Module
         7   Cache
         8   Port Connector
         9   System Slots
        10   On Board Devices
        11   OEM Strings
        12   System Configuration Options
        13   BIOS Language
        14   Group Associations
        15   System Event Log
        16   Physical Memory Array
        17   Memory Device
        18   32-bit Memory Error
        19   Memory Array Mapped Address
        20   Memory Device Mapped Address
        21   Built-in Pointing Device
        22   Portable Battery
        23   System Reset
        24   Hardware Security
        25   System Power Controls
        26   Voltage Probe
        27   Cooling Device
        28   Temperature Probe
        29   Electrical Current Probe
        30   Out-of-band Remote Access
        31   Boot Integrity Services
        32   System Boot
        33   64-bit Memory Error
        34   Management Device
        35   Management Device Component
        36   Management Device Threshold Data
        37   Memory Channel
        38   IPMI Device
        39   Power Supply
        40   Additional Information
        41   Onboard Device


If you want to get information about Base Board, type the following command

dmidecode -t 2
SMBIOS 2.3 present.
Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
Manufacturer: Supermicro
Product Name: X5DPA-TGM+
Version: A1
Serial Number: 00000000

If you want get the full details information regarding your processor type the command “dmidecode -t 4” . You will get the information about all the processors. A sample output with one processor detail is pasted below.

dmidecode -t 4

Using dmidecode to find out what memory chips you have
dmidecode -t 16

This confirmed the ECC type is not defined and Maximum Capacity is 4GB. Here the number of device is 4 which means we have 4 slots to place the ram sticks.You will get the details of each memory device using the command dmidecode -t 17. Since you have 4 devices, you will get the details of each of the 4 devices.

A sample output is pasted below.

Memory Device
Array Handle: 0x001F
Error Information Handle: 0x001E
Total Width: 64 bits
Data Width: 64 bits
Size: 128 MB
Form Factor: DIMM
Set: None
Locator: DIMM4
Bank Locator: BANK1
Type Detail: Synchronous
Speed: Unknown
Manufacturer: Manufacturer2
Serial Number: SerNum2
Asset Tag: AssetTagNum2
Part Number: PartNum2

Here you will see the details of a RAM chip like “type” which is SDRAM and size which is 128MB

In the same way, you will get information regarding bios, chasis, processor….




If you get the following error while running the command dmidecode


  1. dmidecode 2.9

/dev/mem: No such file or director

Do the following

mknod -m 660 /dev/mem c 1 1

Also check the permission of the file “/dev/mem”. It should be like the following

chown root:kmem /dev/mem

How to create SWAP space in Linux Servers

You need to use the dd command to create swap file. The mkswap command is used to set up a Linux swap area on a device or in a file.

Login as root user, and use the following command to create a swap file.

The following dd command example creates a swap file with the name “tmpDSK” under /backup directory with a size of 2000MB (2GB)

# dd if=/dev/zero of=/backup/tmpDSK bs=1M count=2000

Setup correct file permission for security reasons, enter:

# chown root:root  /backup/tmpDSK
# chmod 600 /backup/tmpDSK

Make this file as a swap file using mkswap command.

# mkswap /backup/tmpDSK
Setting up swapspace version 1, size = 2097147 kB

To make this swap file available as a swap area even after the reboot, add the following line to the /etc/fstab file.

/backup/tmpDSK       swap                     swap     defaults        0 0

Enable the newly created swapfile.

# swapon /backup/tmpDSK

# free -m
             total       used       free     shared    buffers     cached
Mem:          4050       3222        828          0        210       2589
-/+ buffers/cache:        422       3628
Swap:         1999          0       1999

Remove “eval(base64_decode” using linux commands from all php files across multiple WordPress

Assuming you have logged into a Linux Shell and already have BACKUP of all files (including infected files) lets move ahead!

Command to list all infected files:

grep -lr --include=*.php "eval(base64_decode" /path/to/webroot

This is not necessary but its better to check some files manually to confirm if they have malicious code we are looking for. Also we can use this command after running cleanup command to crosscheck if cleanup is really successful.

Command to remove malicious code:

If above command gives you correct output, execute following command to perform actual cleaning:

grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak 's/<?php eval(base64_decode[^;]*;/<?php\n/g'

Executing above will remove eval(*) codes.  Above command will also generate a backup version of files it will modify. For example, if it removes code from index.php, you will find a new file index.php.bak in same directory with original content of index.php

Now after running above command, you still find some more infected files, then you need to adjust search and replace parameters in for “sed” part.    You may also use following command for a “liberal” cleaning at the risk of breaking something. (in case you really break something, like I did, you can jump to “Troubleshooting” section below!)

grep -lr --include=*.php "eval(base64_decode" /path/to/webroot | xargs sed -i.bak '/eval(base64_decode*/d'

Trying to avoid re-appearance of this code injection

Its really though to cover every possible way to protect yourself from such attach in this post.

If you remember, WordPress community faced this kind of issue because of WP-PhpMyAdmin plugin sometime back. In our case, we found some old WordPress demo sites were having that plugin installed.

To remove WP-PhpMyAdmin plugin form all WordPress sites on your server, execute following command:

find /path/to/webroot -name "wp-phpmyadmin" -type d | xargs rm -rf

Above is all we did to get rid of eval(base64_decode(*)) codes from all files on our test server. If this happens again on our server, I will update this post with added info.


Just in case you end up in a mess, below are some useful commands.

Missing <?php tag in the beginning:

To add “<?php: tag in the beginning of index.php files, in case if you remove it accidentally use following command:

find /var/www/ -name "index.php" | grep "/htdocs/index.php" | xargs grep -L "<?php" | xargs sed -i "1s/^/<?php \n/"

Don’t worry. If you already have a “<?php ” tag in the beginning, it won’t be added again.

Extra Newlines at the top!

If you find after cleanup, extra newlines at the top of your code, then use following command to remove trailing newlines. Extra newlines creates problem for blog feeds.

find . -name '*.php' -exec sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' '{}' \;

Hard Disk Not Showing in fdisk after replacement.

Use “hdparm -I /dev/sdX” to find the HDD serial number and Model Number, we may need this information while contacting DC for the HDD replacement.

The above command wont work if the HDDs are connected to RAID cards, see below.

[~]# hdparm  -I /dev/sdb

HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device

In that case you can use RAID command line tools to find the details.

To find the RAID card in the server use:

lspci |grep -i raid

[~]# lspci |grep -i raid
01:00.0 RAID bus controller: Adaptec AAC-RAID (rev 09)

Here RAID controller is Adaptec

tw_cli — Commandline Interface for 3ware RAID
arcconf — CLI for Adaptech RAID
Megacli — CLI for MegaRaid RAID

Use Following command to Get information about Physical Devices and Logical Devices of Adaptech RAID controller:

Use following command to get the details of physical devices connected to the RAID controller, it will show all the HDDs connected as Device 1,2…

/usr/StorMan/arcconf GETCONFIG 1 PD

To get details of logical devices connected to the RAID controller use following comand, it will show how the HDDs combined to use with RAID arrays and RAID levels.

/usr/StorMan/arcconf GETCONFIG 1 LD

You will get the idea of serial number and model number of HDDs from above commands

Also you can use “smartctl” command for the same. You cannot run smartctl command directly to the HDDs connected to to RAID array(like samrtctl -a /dev/sdb). You need to run the command on sg module. The sg module helps to access the physical hard drives behind the controller.

 smartctl -d sat -a /dev/sg1X

Below is the Logical device information,  “Logical device number 0” is the main drive and created as RAID 1 using 2 HDDs(segment0 and 1). (0,0) and (0,1) showing the HDD position (channel,port)

Logical device number 1 is the backup drive which was created as simple volume without no RAID level, so only one HDD is enough.

Logical device number 0
Logical device name                      :
   RAID level                               : 1
Status of logical device                 : Optimal
Size                                     : 953334 MB
Read-cache mode                          : Enabled
MaxIQ preferred cache setting            : Disabled
MaxIQ cache setting                      : Disabled
Write-cache mode                         : Enabled (write-back)
Write-cache setting                      : Enabled (write-back)
Partitioned                              : Yes
Protected by Hot-Spare                   : No
Bootable                                 : Yes
Failed stripes                           : No
Power settings                           : Disabled
Logical device segment information
   Segment 0                                : Present (0,0)      WD-WCATR3143256
   Segment 1                                : Present (0,1)      WD-WCATR3253450

Logical device number 1
Logical device name                      : Device 1
   RAID level                               : Simple_volume
Status of logical device                 : Optimal
Size                                     : 953333 MB
Read-cache mode                          : Enabled
MaxIQ preferred cache setting            : Enabled
MaxIQ cache setting                      : Disabled
Write-cache mode                         : Enabled (write-back)
Write-cache setting                      : Enabled (write-back)
Partitioned                              : Yes
Protected by Hot-Spare                   : No
Bootable                                 : No
Failed stripes                           : No
Power settings                           : Disabled
Logical device segment information
Segment 0                                : Present (0,2) S246J9FC428963

Here we are going to replace backup drive. The HDD may not show in fdisk after the replacement. In this case you need to check the Physical Device and Logical Device information of RAID controller.

If the HDD is showing in Physical Device and not in Logical Device then you need to create Logical Device for new drive.

Command to create LD:

arcconf CREATE 1 LOGICALDRIVE <SIZE_OF_LOGICAL_VOLUME> <RAID LEVEL>  <channel,phisical_device_id_of_hdds>

Eg: RAID 1 setup :
arcconf CREATE 1 LOGICALDRIVE MAX 1 0,0 0,1

MAX – indicate max size
channel,phisical_device_id_of_hdds : check Physical device info to get this(see the lines like “Reported Channel,Device(T:L)       : 0,1” under each physical devices)

If the backup drive not showing in fdisk then we cannot mount it. We need to add LD for backup drive in this case.

arcconf CREATE 1 LOGICALDRIVE MAX Simple_volume 0,2

You can say some comment like “Simple_volume” in the place of RAID level if you are not using any raid levels on this HDD.

Now check fdisk.

cdp (pid XXX?) not running

root@ [~]# /etc/init.d/cdp-agent status
/etc/init.d/cdp-agent status: cdp (pid 753?) not running

If you face this problem again, please check the log file 
(/usr/sbin/r1soft/log/cdp.log), there you can fine the exact reason.

Here the error I have got is the following.

,[ERROR],[NO-CONNECTION],Exception from network
server: Address already in use

This happened when the port 1167 is in use. We can sort this issue 
by using the following

If your Agent hang ! and is not restarting properly, 
check Agent port is used by hcp demon 

lsof -i :1167 #1167 default agent port

~]# lsof -i :1167
hcp_io/1/ 2250 root    8u  IPv4 191316993       TCP *:1167 (LISTEN)
hcp_io/1/ 2256 root    8u  IPv4 191316993       TCP *:1167 (LISTEN)
hcp_io/1/ 2257 root    8u  IPv4 191316993       TCP *:1167 (LISTEN)
hcp_io/1/ 2258 root    8u  IPv4 191316993       TCP *:1167 (LISTEN)

you see that hcp working so , you must stop hcp activity :

hcp -r /dev/hcp1 (/dev/hcp1 : example)

now ! you can restart agent easily :
/etc/init.d/cdp-agent restart

Thats all!

Install And Configure PPTP VPN

Install And Configure PPTP VPN

Install PPTP


rpm --import


rpm -Uvh


yum install ppp pptpd

Configure PPTP

1) Change the nameserevr info in /etc/ppp/options.pptpd. The default settings are already optimal, but you must specify which server to use DNS to resolve domain names

Collect the namservers from resolve.conf

vi  /etc/ppp/options.pptpd

Try (Find command in the toolbar) string #ms-dns. Then replace it with this statement:

ms-dns xx.xx.xx.xx(your NS IP)

2) Now edit the main configuration /etc/pptpd.conf, replace localip and remoteip in pptpd.conf.

localip (local IP of VPN server)

remoteip (IP range that needs to assign to the clients connected to the server)

3) Add Vpn users in /etc/ppp/chap-secrets

# Secrets for authentication using CHAP
# client	server	secret			IP addresses
testuser	*	pass		        *

4) Edit the sysctl file to enable Forwarding:

vi /etc/sysctl.conf

Find the “net.ipv4.ip_forward” and uncomment it by removing the “#”:


You can either restart the system or issue this command for the setting to take affect:

sysctl -p

5) Allow IP masquerading in IPtables by executing following line:

Below rule will route all connections from VPN client machine to via eth1(private interface)

iptables -t nat -A POSTROUTING -s -d -o eth1 -j MASQUERADE

Below rule will route all connections from VPN client machine to any network other than via eth0(public interface)

iptables -t nat -A POSTROUTING -s  -o eth0 -j MASQUERADE

Also open port 1723 if firewall is blocking it. 6) Restart the pptpd for the settings to take affect:

Also make sure nessessary kernel modules are loaded for the working of pptp

[@ ~]# lsmod |grep ppp
ppp_mppe                4328  0
ppp_async               4975  0
crc_ccitt               1023  1 ppp_async
ppp_generic            16864  2 ppp_mppe,ppp_async
slhc                    3613  1 ppp_generic
[@ ~]#

/etc/init.d/pptpd restart
chkconfig pptpd on

Configure Client Machine

1.Log on to any windows box in the network.

2.Click on my network place option.

3.Select create new connection

4.Select connect to the network at my workplace. on next,select virtual private network connection. on select Do not dial initial connection. on next.enter the vpn server ip add. on next.finish

9.right click on your vpn connect. will popup user name and passwd.

11.enetr the vpn username and passwd.