Grub re-install

Problem

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

Solution

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

READ THIS FIRST !!

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
(hd0,0)

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).

HOLD ON !!

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
 (hd0,0)

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 System.map-2.6
.9-023stab053.2-enterprise System.map-2.6.9-89.35.1.ELsmp initrd-2.6.9-89.35.1.ELsmp.img config-2.6.9-89.35.1.ELsmp System.map-2.6.9-100.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
se

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=/

NOTE:-

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/device.map.
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.

Install and patch Nethog

Error:

———-

nethogs: cui.cpp:80: void Line::show(int, unsigned int): Assertion `m_pid <= 100000′ failed.
Aborted (core dumped)

———

Soln:

wget http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download?use_mirror=iweb
tar -xvzf nethogs-0.8.0.tar.gz
cd nethogs/
yum install libpcap libpcap-devel
http://sourceforge.net/p/nethogs/patches/_discuss/thread/f9045ed7/107d/attachment/nethogs-0.8.0-alt-pid32.patch
/usr/bin/patch -p1 < nethogs-0.8.0-alt-pid32.patch
make
make install

/usr/local/sbin/nethogs eth0

MySQL repair

When you get the following error when repairing database —

error    : Incorrect key file for table './DB/table'; try to repair it
Error    : Incorrect key file for table 'DB_table'; try to repair it

Try the following steps

1. Stop mysql

2. rename the .myi file to something else, like “DISK.BAD”.

  mv /var/lib/mysql/database/*.MYI /root/database_MYI/

3. restart mysql

4. REPAIR TABLE — MySQL will see that the .MYI file is missing and rebuild it. But this time, it will be in a different spot on disk.

  for i in `cat /root/tbs`;do mysql -e "REPAIR TABLE database.$i USE_FRM;";done

when you get the following error


error    : Can't create new tempfile: './DB/table.TMD'
status   : Operation failed

  myisamchk -r -v -f  tables.MYI

Df -h and du showing different result

We may come across the situation in which “du -sch” and “df -h” will show different result.

In our case, we can take the example of /var partition.

/dev/sda3             146G  144G     0 100% /var

But, du -sch result show only 82 GB.

# du -sch *
7.8G    cpanel
70G     lib
7.1G    lve
86G     total

The difference is that whenever an application has an open file, but the file is already deleted, then it is counted in the df output (because the space is certainly not free) but not in du (because it is not being used by a file).

The problem we will face here is mysql may not start. Here we cannot kill all the processes of mysql and free up /var partition.

But, the real issue is when /var is used by a process which we cannot kill. For example, lets take r1soft backup is running. In that case we cannot kill those processes because it will create issue with replication of data.

So, use the following command to find out the files, which is using large space.

lsof | grep deleted | grep var
cdp-2-6     783208     root  txt       REG       8,2    2497576960  6033403 (deleted) /var/r1soft/bin/2-6/cdp-2-6

Now, go to the file descriptor of that particular process.

# cd /proc/783210/fd
[/proc/783208/fd]# ll
total 0
dr-x------ 2 root root  0 May  6 04:16 ./
dr-xr-xr-x 5 root root  0 May  5 16:48 ../
lrwx------ 1 root root 64 May  6 04:16 10 -> /dev/hcp
lrwx------ 1 root root 64 May  6 04:16 11 -> (deleted)\ /var/.r1soft_hcp_sda3.cow_hcp1_1

10 –> points to /dev/hcp 11 –> points to /var/.r1soft_hcp_sda3.cow_hcp1_1

which is actually deleted. Now, just null those files as

>10
>11

Now, see the result.

# df -h | grep var
//dev/sda3             146G   86G   53G  63% /var

Done :)

Dns issue rndc: connect failed: 127.0.0.1#953: connection refused

[root@testserver ~]# /usr/local/cpanel/scripts/fixrndc
warn [fixrndc] /usr/sbin/rndc status failed: WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)rndc: connect failed: 127.0.0.1#953: connection refused

The problem was that you had portreserve reserving port 953 so named could not bind to the port. I moved the offending file out of the way, restarted portreserve & named and was able to resolve the error for you:

[root@testserver ~]# netstat -tplanu|grep :953|grep LIST
[root@ testserver  ~]# cat /etc/portreserve/named/rndc/tcp
[root@ testserver  ~]# mv /etc/portreserve/named /etc/portreserve/.named
[root@ testserver 1 ~]# /etc/init.d/portreserve restart
Stopping portreserve: [ OK ]
Starting portreserve: (not starting, no services registered)
[root@ testserver  ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@ testserver  ~]# netstat -tplanu|grep :953|grep LIST
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 26055/named
[root@ testserver  ~]# rndc reload
WARNING: key file (/etc/rndc.key) exists, but using default configuration file (/etc/rndc.conf)
server reload successful

Now run this command,
[root@ testserver  ~]# /usr/local/cpanel/scripts/fixrndc

FSCK on LVM from Live CD or From Single User Mode

As it is an important issue to deal with low level thing in the server archtecture. Being an GNU/Linux administrator/NOC/Ops one has to have the clear cut understanding what they are doing.Because handling the production box require lot of common sense and in depth knowlegde about the platform/OS.

So without much ado lets play with it or let me show you the simple tricks.

I do not issue any guarantee that this will work for you.

So the first question come into the mind why the hell you need to check the filesystem?? Specially the root(/) part of it…sound pretty dull and boring…huh..please don’t ignore this.You know ignorance is a sin…so do not commit it.

Now filesystem can be corrupted in various ways..few common ways are :

1) Not properly shutdown the server(although most of the cases journaling will do the healing)

2) Sudden power cut left your system down with lot of processing going on

3)Somebody has done something special(bad sense) to corrupt the data on that particular partition.

It is a bad idea and not recommended to run fsck(yes,this is the inbuilt tool you need to use)the mounted partition or drive.So don’t do that.

Now, running fsck on other partition like /home,/var,/usr …

First and foremost thing to be done is get into a single user mode..how do you do that?

ok once you type init 1 at the terminal prompt you will be taken to the singe user mode.From there simply unmount the partions as show below:

root@laptop_:/home/ # init 1 —> this will bring to the single user mode

root@laptop:/home/ # umount /dev/sda2 —> assuming this partion hold the /home section.

Now run the fsck:

root@:/home/ # e2fsck -y /dev/sda2

Ok..let me explain the flags or switch I passed with the fsck .

y——> it will try to detect and fix any filesystem related corruption without manual intervention.

f———–> this will force check even the system check says it’s clean.

v——–> It will provide you the verbose explanation what that comming going through on the terminal screen.

Now a major problem in our hand. That we find out that root(/)partition of the filesystem gor corrupted due to some reasons.So we need to fix that issue to get back the system as soon as possible on the track.

For this kind of problem..it significant that on a mounted system you just cannot run fsck…as I said earlier..becauase it will corrupt the data on it.So we need a installation cd/dvd for our rescue. The first cd/dvd will do the job for us or get a systemrescuecd to do that.

Once you boot with one of those cd/dvd and put the below text at the command prompt it presents:

#linux rescue nomount

Now once you fire that one you are on the prompt so you can begin work on that.First we need to do is fire a mknod command.Now ask me why need to do that???

Because we had passed the option nomount in the last section so it will not parse any file system or it will not initialize any filesystem or create any device to operate on.If you try to run fsck now it will fail.

So to run correctly the fsck to on a filesystem we need to create device file for that.For that we need to run mknod.But to use mknod we need to know the Major number and Minor number of the device.Lets get those number…wait before that I need to tell you few thing about what Major number and Minor number of a device and how it signifies.

What is Major Number and Minor number??

Traditionally, the major number identifies the driver associated with the device. For example, /dev/null and /dev/zero are both managed by driver 1, whereas virtual consoles and serial terminals are managed by driver 4; similarly, both vcs1 and vcsa1 devices are managed by driver 7. Modern Linux kernels allow multiple drivers to share major numbers, but most devices that you will see are still organized on the one-major-one-driver principle.

The minor number is used by the kernel to determine exactly which device is being referred to. Depending on how your driver is written, you can either get a direct pointer to your device from the kernel, or you can use the minor number yourself as an index into a local array of devices. Either way, the kernel itself knows almost nothing about minor numbers beyond the fact that they refer to devices implemented by your driver.

So it’s clear?? right.lets move on we need to find out the major number and minor number of the device to run mknod:

root@bhaskar-laptop_08:42:30_Mon Aug 16:/home/bhaskar # ls -al /dev/sda
brw-rw—- 1 root disk 8, 0 Aug 16 07:15 /dev/sda

See it will look like this…as 4the and 5th column holds the major number and minor number.Now create the device file:

#mknod /dev/sda b 8 0

It will create the device file.Once it’s done you are safe to run fsck on that particular partition holding your root(/) filesystem.

#e2fsck -yfv /dev/YourRootPartition(sda,hda,….)

Now lets have some fun with LVM.

We need few tools to manipulate that kind of partition which will provide the lvm package within the os or in come inbuilt with other rescue cd.

We need to find out physical disk,volume group and logical partition ..where we are going to run fsck..right?

pvscan :Physical scanning of particular disk

root@-laptop:/home/ # pvscan
PV /dev/sda8 VG laptop lvm2 [46.15 GiB / 21.15 GiB free]
Total: 1 [46.15 GiB] / in use: 1 [46.15 GiB] / in no VG: 0 [0 ]

vgscan :Volume group scanning

root@-laptop:/home/ # vgscan
Reading all physical volumes. This may take a while…
Found volume group “laptop” using metadata type lvm2

lvscan :Logical volume scanning

root@-laptop:/home/ # lvscan
ACTIVE ‘/dev/laptop/data’ [25.00 GiB] inherit

Now it is not activates then you need to activate the specific logical volume like this:

#lvchange -ay “yourLogicalVolume”

The final step:

Run the fsck on logical volume:

#e2fsck -yfv /YourLogicalVolume

IMAPsync

imapsync – Imapsync is a program to synchronise two IMAP mailboxes, mailbox trees or servers.

We can use this tool for migrating emails from the server that we don’t have back-end access.

imapsync installation

perl -MCPAN -e "install Test::Inter"
perl -MCPAN -e "install Parse::RecDescent"
perl -MCPAN -e "install Getopt::Long"
perl -MCPAN -e "CPAN::Shell->force(qw(install Date::Manip));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Mail::IMAPClient));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Term::ReadKey));"

wget http://packages.sw.be/imapsync/imapsync-1.350-1.el5.rf.noarch.rpm
rpm -i --nodeps imapsync-1.350-1.el5.rf.noarch.rpm

Syntax:

imapsync --host1 <Source_Server> --user1  <source_server_username> --password1 <source_server_pass> --host2 <Desination_Server> --user2   <Destination_Server_username> --password2 <Destination_Server_pass>

Eg:

imapsync --host1 source.com --user1  user@source.com --password1 XXXXXXX --host2 localhost --user2  user@destination.com --password2 XXXXXX

Error: If you receive an error like auth [CRAM-MD5]: 2 NO [ALERT] Unsupported authentication mechanism then please add “–noauthmd5” to the above command.

imapsync --host1 source.com --user1 user@source.com --password1 XXXXXXX --host2 localhost --user2 user@destination.com --password2 XXXXXX --noauthmd5

 

Follow

Get every new post delivered to your Inbox.