Выбрать главу

Examine an initrd Image File

The initrd.img file is automatically created during the installation process (if necessary) or with the mkinitrd command. You never need to examine it, but if you are curious about what's in the initrd.img file, just take a look: It is really just a gzipped ext2 file system. To examine it, first copy it to the /tmp directory and add the .gz suffix to it:

# cp /boot/initrd-2.6.7-1.478.img /tmp/initrd-2.6.7-1.478.img.gz

If your system does not have an initrd.img file in /boot, mount your boot floppy and see whether it has one. Next, uncompress it as follows:

# gunzip /tmp/initrd-2.6.7-1.478.img.gz

Mount it as follows:

# mount -o loop /tmp/initrd-2.6.7-1.478.img /mnt/image

and browse the directory to your heart's content.

Not every system has an initrd.img file. It is typically used to load device drivers for file systems (such as Reiser) or hardware (such as the Promise RAID IDE controller) that must be in place before the system can continue booting. Some floppy-disc-based Linux distributions use initrd.img to load a minimal operating system that can then uncompress and load the working file system from the floppy.

You can also mount .iso images in the same way, but remember that they are always read-only because of the nature of the underlying iso9660 file system; you can write to the other images unless you explicitly mount them as read-only. If you want to read and write to the files in an ISO file system, you must first copy the files to a device that is mounted read-write, make your changes, and then use mkisofs to create a new .iso image. This is a common "gotcha" for many users.

Relevant Fedora and Linux Commands

You use these commands when managing file systems in Fedora:

► df — Shows free disk space

► du — Displays disk usage

► dump — An ext2 file system backup utility

► dumpe2fs — Shows information about an ext2 file system

► e2fsadm — Administers an LVM/ext2 file system

► e2image — Creates an image file of ext2 file system data

► fdisk — The standard Linux partition table editor

► fsck — Checks or repairs a file system

► lsraid — Displays information about Linux RAID devices

► mformat — Formats a DOS floppy disk; part of the Mtools suite of tools

► mkfs — Creates various file systems and acts as a wrapper for the actual programs that do the work

► mkisofs — Creates a CD-ROM file system in iso960 format

► mkreiserfs — Creates a Linux reiserfs file system

► mkswap — Prepares a Linux swap device

► mount — Mounts a supported file system

► parted — The GNU partition editor and resizing utility

► reiserfsck — Checks a Linux reiserfs file system

► resize_reiserfs — Resizes a Linux reiserfs file system

► smbmount — Mounts an smbfs file system

► stat — Shows file or file system status

► swapon — Displays swap usage or start using system swap device

► swapoff — Turns off swap usage

► sync — Flushes file system buffers

► tune2fs — Changes file system parameters on ext2 file systems

► umount — Unmounts a file systems

► usermount — The Fedora graphical file system mounting and formatting tool

Reference

 http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Ext2fs-Undeletion.html — You deleted a file on your ext2/3 partition? The Linux Ext2fs Undeletion mini HOWTO is there to help you out.

► http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/LVM-HOWTO.html — Throw away those concepts that marry physical disks to finite-sized file systems; the Logical Volume Manager HOWTO explains how to overcome that kind of restrictive thinking.

► http://www.math.ualberta.ca/imaging/snfs/ — Secure NFS via an SSH Tunnel is a very interesting attempt to address a security shortcomings of NFS over a public network.

► http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/NFS-Root.html — The NFS-Root mini HOWTO.

► http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/NFS-Root-Client-mini-HOWTO.html — Explains in detail how to set up and use NFS for exporting root file systems.

► http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Tips-HOWTO.html — The Linux Tips HOWTO provides some useful tips that make it worth the time to read because it addresses some file system problems such as "Is there enough free space?" and "How do I move directories between file systems?"

► http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/BootPrompt-HOWTO.html — The BootPrompt HOWTO informs you of boot time arguments that can be passed to the kernel to deal with misbehaving hardware, configure non-PNP devices, and so on.

► http://www.linux-usb.org/USB-guide/x498.html — The USB Guide for mass storage and other USB devices. If you have a USB device and need to know whether it is supported and how to access it, check here. (Tip: USB storage devices are emulated as SCSI devices.)

CHAPTER 36

Kernel and Module Management

A kernel is a complex piece of software that manages the processes and process interactions that take place within an operating system. As a user, you rarely, if ever, interact directly with it. Instead, you work with the applications that the kernel manages.

The Linux kernel is Linux. It is the result of years of cooperative (and sometimes contentious) work by numerous people around the world. There is only one common kernel source tree, but each major Linux distribution massages and patches its version slightly to add features, performance, or options. Each Linux distribution, including Fedora, comes with its own precompiled kernel as well as the kernel source code, providing you with absolute authority over the Linux operating system. This chapter examines the kernel and so you can learn what it does both for you and for the operating system.

In this chapter, you also learn how to obtain the kernel sources, as well as how and when to patch the kernel. The chapter leads you through an expert's tour of the kernel architecture and teaches you essential steps in kernel configuration, how to build and install modules, and how to compile drivers in Fedora. This chapter also teaches you important aspects of working with GRUB, the default Fedora boot loader. Finally, the chapter's troubleshooting information will help you understand what to do when something goes wrong with your Linux kernel installation or compilation process. As disconcerting as these problems can seem, this chapter shows you some easy fixes for many kernel problems.