OpenWrt Forum Archive

Topic: HOW TO: Enable ext3 on /root on x86 (alix)

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,

My Alix 2D13 arrived today. I got a 2gig compact flash card for it. I wanted to be able to use all the available space on the flashcard. Unfortunately, the traditional file system, squashfs+jffs2 aren't really appropriate for a large flash card so I set about getting ext3 working. The ext2 filesystem is available from menuconfig as a target image, however, ext2 doesn't necessarily play well with sudden power outages. I plan on carrying this alix box with me when I travel on business so I want to be able to just unplug it and go. ext3, with its journal, is better suited for this. I've done the following procedure several times to make sure it works. I verified it in VMware Fusion (on the Mac) and also on the Alix board itself. It works well. Here's what I did:

Important notes:
1. This assumes you already have a functional build machine. I'm using Ubuntu Server 10.10 running in VMware Fusion.
2. I did this using the latest backfire source. I didn't test this on the trunk or any older versions.

Step 1 - Check out the latest backfire source:

svn co svn://svn.openwrt.org/openwrt/branches/backfire

Step 2 - Update and installs the feeds:

./scripts/feeds update -a
./scripts/feeds install -a

Step 3 - Build menuconfig:

make menuconfig

Step 4 - Inside menuconfig, select the following (and any other packages you want):

1. Select Target System ---> x86
2. Select Target Profile ---> PCEngines Alix
3. Select Kernel Modules ---> Filesystems ---> kmod-fs-ext3 ---> <*>
4. Exit and Save

Step 5 - Build the image:

make

***wait for the image to build, this will take a while***

Step 6 - Build the kernel menuconfig:

make kernel_menuconfig

Step 7 - Inside the kernel menuconfig, select the following:

1. File systems ---> Ext3 journaling file system support ---> <*>
2. Exit and Save

Step 8 - Build the image again:

make

***wait for the image to build, this shouldn't take nearly as long as the first time***

Step 9 - When the build is complete, you should have an image in ./bin/x86 called openwrt-x86-generic-combined-ext2.img.gz. In order to copy this over to a compact flash card you need to un-g-zip it using this command:

gunzip openwrt-x86-generic-combined-ext2.img.gz

Step 10 - Once the file is extracted you need to copy it over to your compact flash card. On my system I use a card reader and the card shows up as /dev/sdc. You'll need to determine what device your compact flash card shows up under. Copy the image to the card using this command:

sudo dd if=openwrt-x86-generic-combined-ext2.img of=/dev/sdc

Step 11 - Now what you have is a regular ext2 build loaded up on the flash card. To convert it to ext3, do the following:

sudo e2fsck /dev/sdc1
sudo e2fsck /dev/sdc2
sudo tune2fs -j /dev/sdc1
sudo tune2fs -j /dev/sdc2

This does two things. First, it runs fsck on the disk, just to be safe. Second, it adds a journal to each partition. This converts it to ext3.

Step 12 - Once that's done, its a good idea to run fsck again. It will complain about the revision being 0, answer yes to correct the issue.

sudo e2fsck /dev/sdc1
sudo e2fsck /dev/sdc2

Step 13 - Almost done, the last thing to do is mount the first partition and edit a couple lines within the grub menu.lst. To do that:

sudo mkdir /openwrt-ext3
sudo mount /dev/sdc1 /openwrt-ext3
nano /openwrt/boot/grub/menu.lst

Substitute "nano" for the text editor of your choice. There should be two lines that contain:

rootfstype=ext2

Change those to:

rootfstype=ext3

Save and close the file.

Step 14 - Unmount the compact flash card, install it in your Alix, and you should be good to go.

cd
sudo umount /dev/sdc1

Hope this helps!

Adam

Another thing to note, every 20 mounts the system will pop a warning up about running e2fsck on the file system. This will most likely be rarely needed, the journal inside of ext3 should fix whatever issues arise. However if you want to run e2fsck, you need to do the following:

opkg install e2fsprogs

This will install the necessary programs, including e2fsck.

mount -o remount,ro /dev/root

This will remount the root filesystem as readonly so you can safely run e2fsck on it.

e2fsck /dev/root

This will perform e2fsck and will remove the boottime message about needing to run it.

mount -o remount,rw /dev/root

This will bring the root filesystem back to a read/write state.

This also works for ext4.

The discussion might have continued from here.