Further Scenarios

The following scenarios describe real-world failures with tactical solutions. Use the scenarios to develop troubleshooting skills and broaden the foundation of your knowledge.

Scenario 6-3: Drives Scan in the Wrong Order

After adding the driver to scan external storage, the drives scan in the wrong order on boot. The boot drive was once at the beginning of the linethat is, /dev/sda or hda. However, now the boot drive fails inline after all other disks are found.

Solution 6-3

There are several ways to work around the issue. The simplest way is to modify /etc/modules.conf.

alias eth0 tulip alias scsi_hostadapter sym53c8xx alias scsi_hostadapter1 cciss alias scsi_hostadapter2 lpfcdd

In this example, lpfcdd is the last driver loaded. Any devices found on the lpfcdd driver must follow any device found on the cciss and sym53c8xx drivers.

Scenario 6-4: vgcreate Fails

In this scenario, vgcreate fails when using a 1TB LUN.

# vgcreate /dev/vg01 /dev/sdb1 vgcreate -- INFO: using default physical extent size 4 MB vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte vgcreate -- doing automatic backup of volume group "main" vgcreate -- volume group "main" successfully created and activated

The command completed but only used 256GB of a 1TB disk. How do we correct this issue?

Solution 6-4

The default PE size for LVM in Linux equals 4MB. To resolve the issue, use the -s option under LVM to choose larger PE size.

Extend the PE size to 32MB, and then you can create the maximum 2TB VG.

# vgcreate -s 32M /dev/vg01 /dev/sdb1

Scenario 6-5: Not Possible to Put /boot under LVM Control with Linux

With Linux, it's not possible to put /boot under LVM control due to bootloader constraints. However, / can be managed by LVM. For this to be successful, we must separate /boot from /.

Solution 6-5

Bind /boot to a physical partition with the ext2 filesystem to enable the bootloader(s) to find the kernel in /boot. Afterward, / can be placed within LVM control.

An example follows:

/boot /dev/sda1 /    /dev/vg00/lvol1


Make sure you have created an lvol (this example uses lvol1). Don't forget to copy / data to your new lvol. /boot is not needed, but for simplicity, use it in the copy command.

Generic steps to achieve this solution follow this example:

lvcreate -n lvol1 -L 200m /dev/vg00 mke2fs /dev/vg00/lvol1 mount /dev/vg00/lvol1 /lvol1fs find / -xdev | cpio -pdumv /lvol1fs

Now for the procedure:


Boot from a Linux rescue CD.


Activate LVM and mount filesystems.

/sbin/vgscan /sbin/vgchange -a y mount /dev/vg00/lvol1 /lvol1fs mount /dev/sda1 /boot


Create your own initrd.

dd if=/dev/zero of=/lvol1fs/tmp/initrd.uncompressed bs=1024 \ count=8192 mke2fs -m 0 /lvol1fs/tmp/initrd.uncompressed


Mount the initrd filesystem.

mkdir /new_initrd mount -o loop /lvol1fs/tmp/initrd.uncompressed /new_initrd


Use an existing initrd.

Create an initrd using the command mkinitrd if you do not have an image.

export INITRD_MODULES=" ";mk_initrd /new_initrd

However, because we copied / to lvol1, the original initrd image is now located under both /lvol1fs/boot/initrd and /boot.

gzip -cd /lvol1fs/boot/initrd > /lvol1fs/tmp/orig_initrd.uncompressed mkdir /orig_initrd mount -o /lvol1fs/tmp/orig_initrd.uncompressed /orig_initrd


Copy all files from this image to our new initrd image.

cp -a /orig_initrd/* /new_initrd


Add files necessary for LVM (if you have static binaries, use them; otherwise, make sure to copy all needed shared libraries, too).

cp /sbin/vg* /new_initrd/bin

Confirm that all dynamic libraries are included. For example:

nc6000:/tmp/init # ldd /sbin/lvm linux-gate.so.1 => (0xffffe000) libdevmapper.so.1.00 => /lib/libdevmapper.so.1.00 (0x4003c000) libdl.so.2 => /lib/libdl.so.2 (0x40043000) libc.so.6 => /lib/tls/libc.so.6 (0x40047000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Next, copy them to /new_initrd/lib.


Create LVM device files.

cp /dev/sda* /new_initrd/dev (remember sda = scsi, hda = ide)


We also must provide for the proc filesystem:

mkdir /new_initrd/proc mkdir /new_initrd/etc cp -a /bin/mount /bin/umount /bin/rm /new_initrd/bin


Modify the linuxrc script so that all modules are loaded to recognize the discs.

echo "Mounting /proc" /bin/mount -t proc proc /proc echo "Activating lvm" /bin/vgscan /bin/vgchange -a y echo "Unmounting /proc" /bin/umount /proc


Clean up the files.

umount /new_initrd umount /orig_initrd rm -rf /new_initrd /orig_initrd


Put the new initrd image into place.

gzip -c /lvol1fs/tmp/initrd.uncompressed > /boot/initrd.lvm

Change /lvol1fs/etc/lilo.conf.


Update the bootloader.

lilo -C /lvol1fs/etc/lilo.conf


/dev/sda1 will be mounted to the /boot directory, but all the kernel's images and initrd images reside in a directory called boot because this was the original / filesystem. We need to clean up this issue at a later date, but it works for now.

Reboot and enjoy our LVM as root-filesystem.

Scenario 6-6: LUN Limitation

We want to have over 140 LUNs visible from our storage array. Each LUN has an alternate path, which equals more than 280 LUNs visible. The problem is that a default Linux kernel only allows 128 LUNs.

Solution 6-6

One solution is to increase the size of the LUNs to reduce the count and then to create a large number of logical volumes under LVM. However, another solution is to modify the kernel to expand the total number of allowed LUNs.

By default, the maximum number of SCSI LUNs that can be loaded as modules is 128, which depends on the vendor kernel build.

Under "SCSI Support," you could modify CONFIG_SD_EXTRA_DEVS to a number greater than 128 and recompile the kernel.

Linux Troubleshooting for System Administrators and Power Users
Real World Mac Maintenance and Backups
ISBN: 131855158
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Joe Kissell

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net