Tech Tips with Gnull and Voyd

 in
New tech tips column.

This forces the script to discover the 3ware RAID card first and assign it as /dev/sda before udevplug discovers the rest of the PCI storage controllers.

The trick here is that you need to unpack the default initrd file that comes with Ubuntu, modify this script, and then repack it and use it instead of the default initrd.

Here's one way to do that. These instructions assume you are using Ubuntu Dapper AMD64 with the kernel 2.6.15-27-amd64-generic. If you're using some other kernel, you must change the command accordingly. You can be more careful than I have been with these instructions and use sudo for all the appropriate commands. However, I jumped into a root shell with the sudo -s -H command to make this easier to read:

$ sudo -s -H
(enter password)
# cd /root
# mkdir initrd-tmp
# cd initrd-tmp
# gzip -dc /boot/2.6.15-27-amd64-generic | cpio -id

This unpacks your initrd so that you can manipulate its contents. Now, edit this file. (Use whichever editor suits you. I am using vi as an example.)

# vi scripts/local-top/udev

This is the file that contains the code in Listing 1. Add the modprobe command as shown in Listing 2. Save the file.

All this assumes that the module 3w-9xxx exists in your initrd. If it doesn't, or you need some other module in your initrd, you'll have to copy it to the following location (once again, this assumes you are using the 2.6.15-27-amd64-generic kernel—modify as necessary for your setup):

# cp <module> /root/initrd-tmp/lib/modules/
↪2.6.15-27-amd64-generic/kernel/drivers/scsi

Now you need to repack the initrd file. I suggest that you name this initrd something other than the original, so that if you have done something wrong, you can revert to the original easily.

Here is how to repack the file to a new initrd. This assumes your current working directory is still /root/initrd-tmp:

# find . | cpio --quiet --dereference -o -H newc | gzip
 ↪-9 > /boot/2.6.15-27-amd64-generic-3w

Now change your bootloader to add another boot option to use the new initrd file. You can replace the existing boot entry, but that's asking for trouble (although GRUB, for example, lets you edit a boot entry at boot time, so there's always hope if you use GRUB). If you use GRUB, specify the modified initrd as the initrd image, like this:

initrd    /boot/initrd.img-2.6.15-27-amd64-generic-3w

Reboot, and try it out.

This should work for cards other than the 3ware if you are having the same problem with another RAID card (or even some other storage card). All you have to do is change /sbin/modprobe to load the appropriate module for your card. Don't forget to check to see whether the driver module exists in the unpacked initrd before you pack it again.

—Nicholas Petreley

Knoppix Does More Than Show Off Linux to Windows Users

Your computer won't boot because you been using one of them unofficial kernels, I bet. That'll get you in a heap of trouble. It's yer own fault. Boot a Linux live CD to fix the damage you did. —Chester

It happens to the best of us, you sit at your computer in the morning, turn it on, and find that it won't boot properly. After an hour of troubleshooting, diagnostics and grumbling, you come to the conclusion that something about your hard drive is toast. You think of all the files you may have just lost in the process and curse the fact that you didn't back up diligently enough.

Most of the time when your OS is dead, your files are still intact on the drive; you just have to find a way to get to them. In some cases, your problem may be that the root partition is too corrupted to mount it, but not so corrupt that you can't restore it. For example, your root partition may be formatted as XFS, and all you need to do is run a utility like xfs_repair on the partition to get things back in order.

Some distributions come with a repair disk, and some installation disks have a repair option. But, you might find it more useful to boot to a live CD to make repairs, because a live CD may put more utilities at your disposal than a repair disk. Knoppix is one of many live CD versions of Linux that runs straight from the CD and allows you access to the hard drives.

Even if you are in a worst-case scenario and have to recover individual files, all you need to recover files, or possibly the entire contents of the hard drive, is a copy of Knoppix (or your favorite live CD distro) and a portable hard drive, jump drive or some other kind of USB portable storage device. Or, if you have an unused SATA or IDE spot in your system, you always can open up the computer and plug in the extra drive (properly configured, of course). If you go portable, then how big the portable storage device is depends on how much you want to save.

Double-check the BIOS on your target computer to make sure it is set to boot from a CD. If your BIOS allows you to interrupt the boot sequence with the Esc key, F8, or some other key in order to choose which drive to boot, you may not even have to reconfigure your BIOS. Regardless, boot from CD, and Knoppix should boot up automatically into the desktop.

Once in the desktop, all that's left to do is search the computer's hard drive and find the files to salvage and transfer to your portable media device or additional internal device. Finding the files will require that you know where the file is on the hard drive, and this will be more or less difficult depending on the filesystem on the drive that was corrupted.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I find the attempt at humor offensive

Anita Lewis's picture

I will publish my opinion that this is not where I would choose to get information on anything. My first and last trip here unless I hear about some big changes.

Excuse me?

rottie's picture

".. I don't know nothing about Linux. Chester, he's the smart one, .. "

What planet do you live on? I've been on linux for 10 years now. Not once have I had a boyfriend that could fix his own computer without coming to me.

I concur, this is a magazine I wont be buying again.

Wow

Babs's picture

I sure wish I wasn't a girl confused by all this Linus stuff. Gosh. Computers sure are hard.

Oh, no, wait, that's right. My husband comes to me when he needs help with Linux or any open source technology.

I first saw this article in

Anonymous's picture

I first saw this article in the printed version of the magazine. It directly contributed to my not renewing my subscription. LJ: stop dumbing everything down. Surely not all your readers are teenage misogynists.

Ugh. I guess you've decided

Anonymous's picture

Ugh. I guess you've decided that you can do without female subscribers, eh? I know I'm not going to be renewing.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState