Thursday, December 30, 2010

Procedure to create a Dual bootable rootdisk and broken mirror (OS sliced disk) on Linux

Problem

Procedure to create a Dual bootable rootdisk and broken mirror (OS sliced disk) on Linux

Solution

Procedure to create a Dual bootable rootdisk and broken mirror (OS sliced disk) on Linux.
Note: The purpose of root disk encapsulation and mirroring process is to maintain redundancy in case of a disk failure. We do not test manual unencapsulation of a root mirror disk to make it bootable on disk slices for back up purposes. The procedure below will allow such operation. It is up to the admin to test and verify procedure.
*Verify what the current encapsulated bootdisk is.
 # /etc/vx/bin/vxgetrootdisk
 sda
 
**Next run the grub utility to check which hard disks contain the menu.lst. This will be important when modifying the grub menu.lst
 
#echo "find /boot/grub/menu.lst" | grub
 
grub> find /boot/grub/menu.lst
 
(hd0,0)
 
(hd1,0) <<<< This is the mirror.
 
* Current vxprint after mirroring process is completed.
 
# vxprint -g rootdg -ht
dg rootdg default default 0 1240923974.32.sprs1950a0-27
 
dm rootdisk sda auto 65535 143363997 -
 
dm rootmirr sdb auto 65535 143363997 -
 
sd meta-rootdisk-04 - rootdisk 65529072 63 METADATA sda ENA
 
sd meta-rootdisk-05 - rootdisk 69383333 63 METADATA sda ENA
 
sd meta-rootdisk-07 - rootdisk 69448932 63 METADATA sda ENA
 
sd mirmeta-rootdisk-04 - rootmirr 65529072 63 METADATA sdb ENA
 
sd mirmeta-rootdisk-05 - rootmirr 69383333 63 METADATA sdb ENA
 
sd mirmeta-rootdisk-07 - rootmirr 69448932 63 METADATA sdb ENA
 
sd mirrootdiskPriv - rootmirr 69383396 65536 PRIVATE sdb ENA
 
sd rootdiskPriv - rootdisk 69383396 65536 PRIVATE sda ENA
 
v datavol - ENABLED ACTIVE 73915002 ROUND - fsgen
 
pl datavol-01 datavol ENABLED ACTIVE 73915002 CONCAT - RW
 
sd rootdisk-03 datavol-01 rootdisk 69448995 73915002 0 sda ENA
 
pl mirdatavol-01 datavol ENABLED ACTIVE 73915002 CONCAT - RW
 
sd mirrootdisk-03 mirdatavol-01 rootmirr 69448995 73915002 0 sdb ENA
 
v rootvol - ENABLED ACTIVE 61432497 ROUND - root
 
pl mirrootvol-01 rootvol ENABLED ACTIVE 61432497 CONCAT - RW
 
sd mirrootdisk-02 mirrootvol-01 rootmirr 0 61432497 0 sdb ENA
 
pl rootvol-01 rootvol ENABLED ACTIVE 61432497 CONCAT - RW
 
sd rootdisk-02 rootvol-01 rootdisk 0 61432497 0 sda ENA
 
v swapvol - ENABLED ACTIVE 3854198 ROUND - swap
 
pl mirswapvol-01 swapvol ENABLED ACTIVE 3854198 CONCAT - RW
 
sd mirrootdisk-01 mirswapvol-01 rootmirr 65529135 3854198 0 sdb ENA
 
pl swapvol-01 swapvol ENABLED ACTIVE 3854198 CONCAT - RW
 
sd rootdisk-01 swapvol-01 rootdisk 65529135 3854198 0 sda ENA
 
*Note: Important make sure to remove the correct plex/mirror. Incorrectly removing the mirror plex will result in loss data and unbootable disk.
 
*For a test example remove root mirror sdb plexes.
 
# vxplex -g rootdg -o rm dis mirswapvol-01
 
# vxplex -g rootdg -o rm dis mirrootvol-01
 
# vxplex -g rootdg -o rm dis mirdatavol-01
 
*Remove the meta objects:
 
# vxedit -g rootdg -rf rm mirmeta-rootdisk-04
 
# vxedit -g rootdg -rf rm mirmeta-rootdisk-05
 
# vxedit -g rootdg -rf rm mirmeta-rootdisk-07
 
# vxedit -g rootdg -rf rm mirrootdiskPriv
 
*After removal of mirrors and meta objects vxprint will look as follows.
 
dg rootdg default default 0 1240923974.32.sprs1950a0-27
 
dm rootdisk sda auto 65535 143363997 -
 
dm rootmirr sdb auto 65535 143363997 -
 
sd meta-rootdisk-04 - rootdisk 65529072 63 METADATA sda ENA
 
sd meta-rootdisk-05 - rootdisk 69383333 63 METADATA sda ENA
 
sd meta-rootdisk-07 - rootdisk 69448932 63 METADATA sda ENA
 
sd rootdiskPriv - rootdisk 69383396 65536 PRIVATE sda ENA
 
v datavol - ENABLED ACTIVE 73915002 ROUND - fsgen
 
pl datavol-01 datavol ENABLED ACTIVE 73915002 CONCAT - RW
 
sd rootdisk-03 datavol-01 rootdisk 69448995 73915002 0 sda ENA
 
v rootvol - ENABLED ACTIVE 61432497 ROUND - root
 
pl rootvol-01 rootvol ENABLED ACTIVE 61432497 CONCAT - RW
 
sd rootdisk-02 rootvol-01 rootdisk 0 61432497 0 sda ENA
 
v swapvol - ENABLED ACTIVE 3854198 ROUND - swap
 
pl swapvol-01 swapvol ENABLED ACTIVE 3854198 CONCAT - RW
 
sd rootdisk-01 swapvol-01 rootdisk 65529135 3854198 0 sda ENA
 
*Now remove disk from diskgroup note after removal only one disk in diskgroup rootdg.
 
# vxdg -g rootdg rmdisk rootmirr
 
# vxdisk list|grep rootdg
 
sda auto:sliced rootdisk rootdg online
 
*Remove vxvm tags from disk.
 
# fdisk -ul /dev/sdb
 
Disk /dev/sdb: 73.4 GB, 73407820800 bytes
 
255 heads, 63 sectors/track, 8924 cylinders, total 143374650 sectors
 
Units = sectors of 1 * 512 = 512 bytes
 
Device Boot Start End Blocks Id System
 
/dev/sdb1 * 63 61432559 30716248+ 83 Linux
 
/dev/sdb2 63 143364059 71681998+ 7e Unknown <<<<<<Needs to be removed
 
/dev/sdb4 65529135 143364059 38917462+ 5 Extended
 
/dev/sdb5 65529198 69383395 1927099 82 Linux swap
 
/dev/sdb6 69383459 69448994 32768 7f Unknown <<<<<<Needs to be removed
 
/dev/sdb7 69449058 143364059 36957501 83 Linux
 
* Use fdisk utility to remove private and public partitions belonging to VxVM.
 
# fdisk /dev/sdb
 
The number of cylinders for this disk is set to 8924.
 
There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
 
1) software that runs at boot time (e.g., old versions of LILO)
 
2) booting and partitioning software from other OSs
 
(e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): p
 
Disk /dev/sdb: 73.4 GB, 73407820800 bytes
 
255 heads, 63 sectors/track, 8924 cylinders
 
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
 
/dev/sdb1 * 1 3824 30716248+ 83 Linux
 
/dev/sdb2 1 8924 71681998+ 7e Unknown
 
/dev/sdb4 4080 8924 38917462+ 5 Extended
 
/dev/sdb5 4080 4319 1927099 82 Linux swap
 
/dev/sdb6 4319 4323 32768 7f Unknown
 
/dev/sdb7 4324 8924 36957501 83 Linux
 
Command (m for help): d
 
Partition number (1-7): 2
 
Command (m for help): d
 
Partition number (1-7): 6
 
Command (m for help): p
 
Disk /dev/sdb: 73.4 GB, 73407820800 bytes
 
255 heads, 63 sectors/track, 8924 cylinders
 
Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
 
/dev/sdb1 * 1 3824 30716248+ 83 Linux
 
/dev/sdb4 4080 8924 38917462+ 5 Extended
 
/dev/sdb5 4080 4319 1927099 82 Linux swap
 
/dev/sdb6 4324 8924 36957501 83 Linux
 
Command (m for help): w
 
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
 
The kernel still uses the old table.
 
The new table will be used at the next reboot.
 
Syncing disks.
 
***Note because device is busy in kernel reboot is required to update new table.
 
*Note: Do not reboot yet. Continue with mount of mirrored disk.
 
**MODIFICATION TO BE DONE ON MIRRORED DISK SDB
 
# mount /dev/sdb1 /mnt
 
* vi the contents of fstab. Currently they will have vxvm root volume entries they will have to reflect /dev/sdb.
 
* Current view /dev/sdb fstab
 
# cat /mnt/etc/fstab
 
# This file is edited by fstab-sync - see 'man fstab-sync' for details
 
/dev/vx/dsk/bootdg/rootvol / ext3 defaults 1 1
 
none /dev/pts devpts gid=5,mode=620 0 0
 
none /dev/shm tmpfs defaults 0 0
 
none /proc proc defaults 0 0
 
none /sys sysfs defaults 0 0
 
/dev/vx/dsk/bootdg/swapvol swap swap defaults 0 0
 
/dev/vx/dsk/bootdg/datavol /data ext3 defaults 0 0
 
#NOTE: volume rootvol (/) encapsulated partition sda1
 
#NOTE: volume swapvol (swap) encapsulated partition sda5
 
#NOTE: volume datavol (/data) encapsulated partition sda7
 
/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0
 
/dev/scd0 /media/cdrom auto pamconsole,exec,noauto,managed 0 0
 
*After modification of fstab.
 
# cat /mnt/etc/fstab
 
# This file is edited by fstab-sync - see 'man fstab-sync' for details
 
/dev/sdb1 / ext3 defaults 1 1
 
none /dev/pts devpts gid=5,mode=620 0 0
 
none /dev/shm tmpfs defaults 0 0
 
none /proc proc defaults 0 0
 
none /sys sysfs defaults 0 0
 
/dev/sdb5 swap swap defaults 0 0
 
/dev/sdb6 /data ext3 defaults 0 0
 
#NOTE: volume rootvol (/) encapsulated partition sda1
 
#NOTE: volume swapvol (swap) encapsulated partition sda5
 
#NOTE: volume datavol (/data) encapsulated partition sda7
 
/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0
 
/dev/scd0 /media/cdrom auto pamconsole,exec,noauto,managed 0 0
 
*Next modify SDB grub menu.lst sample after modification.
 
#vi /mnt/boot/grub/menu.lst
 
# cat /boot/grub/menu.lst
 
# grub.conf generated by anaconda
 
#
 
# Note that you do not have to rerun grub after making changes to this file
 
# NOTICE: You do not have a /boot partition. This means that
 
# all kernel and initrd paths are relative to /, eg.
 
# root (hd0,0)
 
# kernel /boot/vmlinuz-version ro root=/dev/sda1
 
# initrd /boot/initrd-version.img
 
#boot=/dev/sda
 
#default=0
 
timeout=5
 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
 
hiddenmenu
 
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
 
root (hd1,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=/dev/sdb1 elevator=deadline rhgb quiet
 
initrd /boot/initrd-2.6.9-42.ELsmp.img
 
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
 
root (hd1,0)
 
kernel /boot/vmlinuz-2.6.9-42.EL ro root=/dev/sdb1 rhgb quiet
 
initrd /boot/initrd-2.6.9-42.EL.img
 
*Next modify the grub menu.lst file so you can boot off of sdb.
 
**Note: this will have to be done from sda point of view as this is the first disk on the scsi chain.
 
#vi /boot/grub/menu.list
 
*Current view of root disk menu.lst.
 
# cat /boot/grub/menu.lst
 
# grub.conf generated by anaconda
 
#
 
# Note that you do not have to rerun grub after making changes to this file
 
# NOTICE: You do not have a /boot partition. This means that
 
# all kernel and initrd paths are relative to /, eg.
 
# root (hd0,0)
 
# kernel /boot/vmlinuz-version ro root=/dev/sda1
 
# initrd /boot/initrd-version.img
 
#boot=/dev/sda
 
#default=0
 
timeout=5
 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
 
hiddenmenu
 
#vxvm_root_default_START ( do not remove)
 
# Default menu entry number has been set to vxvm_root.
 
# - the vxvm_root default entry number is: 2
 
# - the original default entry number is: 0
 
# - the selected default entry number is: 0
 
# - the original grub configuration is in: /boot/grub/menu.lst.b4vxvm
 
default=2
 
#vxvm_root_default_END ( do not remove)
 
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=/dev/sda1 elevator=deadline rhgb quiet
 
initrd /boot/initrd-2.6.9-42.ELsmp.img
 
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.EL ro root=/dev/sda1 rhgb quiet
 
initrd /boot/initrd-2.6.9-42.EL.img
 
#vxvm_root_START ( do not remove)
 
title vxvm_root
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp root=c700 ro elevator=deadline rhgb quiet
 
initrd /boot/VxVM_initrd.img
 
#vxvm_root_END ( do not remove)
 
*Modified menu.lst as follows,
 
*Note: Important is to set default otherwise select proper title to boot from, at the boot screen
 
# cat /boot/grub/menu.lst
 
# grub.conf generated by anaconda
 
#
 
# Note that you do not have to rerun grub after making changes to this file
 
# NOTICE: You do not have a /boot partition. This means that
 
# all kernel and initrd paths are relative to /, eg.
 
# root (hd0,0)
 
# kernel /boot/vmlinuz-version ro root=/dev/sda1
 
# initrd /boot/initrd-version.img
 
#boot=/dev/sda
 
#default=0
 
timeout=5
 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
 
hiddenmenu
 
#vxvm_root_default_START ( do not remove)
 
# Default menu entry number has been set to vxvm_root.
 
# - the vxvm_root default entry number is: 2
 
# - the original default entry number is: 0
 
# - the selected default entry number is: 0
 
# - the original grub configuration is in: /boot/grub/menu.lst.b4vxvm
 
default=2
 
#vxvm_root_default_END ( do not remove)
 
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=/dev/sda1 elevator=deadline rhgb quiet
 
initrd /boot/initrd-2.6.9-42.ELsmp.img
 
title Red Hat Enterprise Linux AS-up (2.6.9-42.EL)
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.EL ro root=/dev/sda1 rhgb quiet
 
initrd /boot/initrd-2.6.9-42.EL.img
 
#Dual boot disk for sdb device
 
title Red Hat Enterprise Linux AS bootdisk SDB(2.6.9-42.ELsmp)
 
root (hd1,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp ro root=/dev/sdb1 elevator=deadline
 
initrd /boot/initrd-2.6.9-42.EL.img
 
#vxvm_root_START ( do not remove)
 
title vxvm_root
 
root (hd0,0)
 
kernel /boot/vmlinuz-2.6.9-42.ELsmp root=c700 ro elevator=deadline rhgb quiet
 
initrd /boot/VxVM_initrd.img
 
#vxvm_root_END ( do not remove)
 
*Finally System is now ready for reboot.
 
Note: Depending on what is set for the default boot in menu.lst will depend on which disk gets booted. If the mirrored disk is chosen to boot off of, then it will boot off of sliced partitions not under VxVM control; otherwise as previously noted select the correct disk when prompted to get the title selection on boot

No comments:

Post a Comment