posted by Clinton De Young on Mon 3rd Mar 2003 03:07 UTC

"ext3 journaling, troubleshooting, conclusion"
SETTING UP YOUR MACHINE TO USE THE EXT3 JOURNALING FILE SYSTEM

Remember a while back when I said we weren't done with the EXT3 stuff yet? Well, it's now time to remedy that situation. Before beginning, you will need to have a text editor such as vim, nano, pico, or any of the graphical ones available. Please pick one that you like and then let's continue.

First, you will need to know which partitions you have on your machine. If you don't remember, you can type the command "df" at the command line, and it should list all the partitions mounted on your machine. Here is an example of df's output:

Filesystem		Mounted on
/dev/hda1	. . .	/
/dev/hda3	. . .	/usr
/dev/hda5	. . .	/var
/dev/hda6	. . .	/home

Now you need to use this information in the following command. You can either type:
"/sbin/tune2fs -j /dev/hdxx" (where x is the drive and partition number, such as /dev/hda1, or /dev/hdb3) at the command line for each partition you have, or you can do it all at once using the following script command (don't type the '#' or '>', those are the prompts. Also, press after each line, and make sure your devices are separated by a space):

#  for each in /dev/hda1 /dev/hda3 /dev/hda5 /dev/hda6
>  do
>  /sbin/tune2fs -j $each
>  done

If you get an error, you either didn't type it correctly, or you have put an invalid device in the list. Make the appropriate corrections and retype the command.

This will convert all of your partitions from ext2 to ext3. Once this is done, you need to tell Linux to mount all your partitions as ext3 partitions. This is where we need the text editor.

As root, open the file /etc/fstab. Wherever you see the word "ext2", change it to "ext3". Once you are finished, save the file and exit the editor.

Now, we have to do one more thing before we reboot again (you could manually unmount and remount all your partitions into ext3, but it's probably easier to just have you reboot again and have Linux automatically mount everything using ext3 for you).

I briefly hinted at this before, but we need to fix our /mnt/cdrom device. It is currently pointing somewhere like /dev/hdb, however since we made our CDs emulate SCSI, our CDROM doesn't exist there any more. We need to fix the /dev/cdrom link.

To do this, you first need to know where to change the /dev/cdrom link to point to. Usually, it will be /dev/scd0, but let's make sure. Place a data CD in the CDROM drive and type:
"Mount /dev/scd0 /cdrom"

If all goes well, you should be able to type "ls /cdrom" at the command prompt and get a directory listing of your CD. If not, and especially if you have more than one CD device in your computer, then try other devices, such as /dev/scd1, /dev/scd2, etc.

Once you know which drive you want to be the default CD drive, change the /dev/cdrom symbolic link to point at it (you probably remember symbolic links from our discussion on where to save the Linux kernel source code. /dev/cdrom is just a symbolic link that points to a device on your computer). To demonstrate how to do this, I am going to use my system, on which the default CD drive is on /dev/scd0. To change the /dev/cdrom link to point to the right device, type these commands at the command line:
"rm /dev/cdrom" (this removes the current, incorrect /dev/cdrom link)
"ln -s /dev/scd0 /dev/cdrom" (this will create a new /dev/cdrom link that points to the correct device)

Now you should be done. To make sure, at the command prompt, type "umount /cdrom" to unmount the CD you mounted a few minutes ago. Next, you should type "mount /cdrom" at the command prompt. You should now be able to type "ls /cdrom" and get a directory listing of your CD. If so, you have done everything correctly. If not, go back and check your settings again. Also, it should be there already, but if something isn't working, type "cat /etc/fstab" at the command prompt and make sure your fstab file contains a line that begins "/dev/cdrom /cdrom". If not, you will need to add the following line to your fstab file:

/dev/acd0c              /cdrom          cd9660  ro,noauto       0       0

If everything is working, it is time to reboot. If you have placed a bootable CD in your drive during this process, remove it before rebooting.

WHAT IF SOMETHING GOES WRONG?

Seeing as this is probably the first time you have compiled your kernel, it is possible, although entirely unwanted, that you will make a mistake (such as including the wrong sound card in the kernel).

There are a few things that you need to do before trying to recompile your kernel again. First, you need to delete or rename the .deb file in your /usr/src directory (or change the name you give it during the "make kpkg" steps listed earlier in the article).

Next, if you are attempting to recompile the same kernel version as before (for example, 2.4.20), you will need to rename or delete some things before you can recompile again. The nice thing is that during the "dpkg -i " you will get a message telling you exactly what to delete or rename. When you get this message, open a new xterm window, delete or move the offending directory, hit CTRL+C to abort the "dpkg -i" process in the first xterm window, and then restart the "dpkg -i" again. Everything should go fine.

If there is one point that I want to emphasize in this article, it is to read everything; both this document and the help screens. Don't guess; that will pretty much guarantee failure.

CONCLUSION

That is it. Hopefully you are a little more comfortable with obtaining, configuring and compiling your Linux kernel under Debian. I hope you have fun learning with Debian.

About the Author:
My name is Clinton De Young and I work as a Development Manager for a software company called Altiris. I am a native English speaker, and am fluent in Japanese. On the side I translate documents to and from Japanese and sometimes freelance with companies to write software for the Japanese market. In spite of all that, my family comes first. They are the most important people in my life.

Table of contents
  1. "Intro, Downloading the kernel"
  2. "Step by Step Kernel building, requirements"
  3. "Configuring the kernel"
  4. "Configuring for sound, ext3 and burners"
  5. "Compilation, Installing the kernel"
  6. "ext3 journaling, troubleshooting, conclusion"
e p (0)    59 Comment(s)

Technology White Papers

See More