Tar Backup/Restore Grub Boot Issues

We have two machines with identical hardware. The second machine is a backup to the first machine to be used if any issues arise with the primary machine/service.
So we created a tar backup of the primary machine using:

/bin/nice /bin/tar czpf /www/archive/backup/system/system_full.tar.gz \
–same-owner  \
–exclude=/proc/* –exclude=/media/* \
–exclude=/dev/* –exclude=/mnt/* –exclude=/sys/* –exclude=/tmp/* \
–exclude=/home/* –exclude=/var/backups/* –exclude=/var/lib/mysql/* \
–exclude=/var/www/* –exclude=/www/* / \

We could consid also exclude the /boot directory so as not to run in to boot problems on the second machine.
When we extracted this tar file onto the second machine and rebooted we encountered two issues which would need to be resolved  before the secondary backup machine could be used for the primary service:
1. Grub did not boot with the following error message
2. The network interfaces would not come up as the mac addresses were obviously different

The error message we received when booting was:

filesystem type unknown partition type 0x8e

Type 0x8e represents an LVM partition but we need 0x83 ext2 filesystem.
Examining the /boot/grub/menu.lst config file we can see that Grub was trying to boot the following:

title CentOS (2.6.18-128.2.1.el5)
        root (hd0,1)
        kernel /vmlinuz-2.6.18-128.2.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-128.2.1.el5.img

The problem was the “root (hd0,1)” line which should be “root (hd0,0)” on the secondary machine. On the first primary machine /dev/sda2 was mounted to /boot but on the secondary machine /dev/sda1 was mounted to /boot. So I am putting this issue down to slightly different partitioning during initial setup (even though we tried to get them completely mirrored I think there was some Sun FAT partitions left on the primary machine as /dev/sda1).

To resolve the issue temporarily from within Grub:

  • Go to the command line by typing ‘c’
  • Set the root device:
    root (hd0,0)
  • Boot

It is also possible to set the kernel and ramdisk as explained in this post:

  • Set the kernel
    kernel /vmlinuz[tab to find available kernels]
  • Set the ram disk
    initrd /initrd[tab to find available ram disks]
  • Boot

To resolve the boot issue permanently: 
After booting edit the menu.lst file:

vi /boot/grub/menu.lst

Replace root (hd0,1) with root (hd0,0)

When the secondary machine booted the interface configuration files in /etc/sysconfig/network-scripts contained the MAC addresses for the primary machine which did obviously not exist on the secondary machine. Red Hat/Centos thankfully backed up the existing config files with a .bak extension and created new ones with the correct mac addresses. So To keep the secondary machine as a potential backup to the primary machine I will create 2 sets of network config files with the relevant IP addresses and mac addresses.

Apache LDAP Authentication to Active Directory

I was testing authentication against Active Directory (LDAP) using Apache 2. The following worked for me in a .htaccess file but only after adding:

LDAPVerifyServerCert Off

in the main httpd.conf file. I presume this is related to the server name in the SSL certificate on the Active Directory server.

AuthBasicProvider ldap
AuthzLDAPAuthoritative Off
AuthLDAPURL ldaps://adserver.prefix.tld.co.uk:636/DC=prefix,DC=tld,DC=co,DC=uk?sAMAccountName?sub?(objectClass=user)
AuthLDAPBindDN “CN=someuser,OU=some ou,OU=another unit,OU=department,OU=directorate,OU=Administration,OU=another big unit,DC=prefix,DC=tld,DC=co,DC=uk”
AuthLDAPBindPassword secret
AuthType Basic
AuthName “Protected”
require valid-user

Normal users should then be prompted for a username and password to access the directory and if correct credentials are supplied should be given access to the content.

iPhone IMAP Settings for Students

Students can not use the MAPI/Exchange mode supplied with the iPhone due to our QUB settings.  However, IMAP connections should work as follows:

  • Setup
  • Other account, Fill in :- Name, Address       
  • Choose IMAP
  • Incoming mail server is: student-xchange.ads.qub.ac.uk,Username,Password
    Advanced incoming settings:-Use SSL = on,Authentication = password, Server Port = 993
  • Outgoing mail server is: smtp.qub.ac.uk,Username,Password,Use SSL on,Authentication = password,Server port is 465