OK, we Linux users all know of the ext2 and ext3 filesystems. Ext2 and ext3 -the latest years- are ones of the most widely used filesystems for Linux. Ext3 was not much different from ext2, it's just a ext2 filesystem with a journal. In fact, you can mount a ext3 partition as ext2; the only difference is that you wοn't have a journal enabled.
Now the time has come and ext4 has emerged. After Linux 2.6.28 was released (remember, Linux is the kernel), ext4 was marked as stable. Ext4 is somewhat backwards compatible with ext3. You can mount an existing ext3 filesystem as ext4 and the new files will use the new ext4 features. You can also mount a ext4 partition as ext3, provided that you don't use extents, a new ext4 feature.
Anyway, what's the point to have a mixed ext3 and ext4 filesystem? This is a quick guide to convert your existing ext3 (or other FS type) partition to ext4, which I followed today.
Requirements:
- Linux 2.6.28
- e2fsprogs-1.41.0 and greater, though the latest is the better
- Free space on a hard disk partition of size that is at least the used size of the current / filesystem
- Your Linux kernel configuration must include ext4 in its supported filesystems (better included)
OK, go to Parted Magic's homepage and download the latest iso file (current is pmagic-3.7.iso.zip). Unzip and burn in an empty CD or CD-RW. From your current Linux system, make note of the partition that is mounted as / (in my case, it was /dev/sda11). Insert the Parted Magic CD in your CD/DVD rom drive and boot the system from it. After a while, you will be presented with a minimalistic Gnome environment.
Parted Magic is a Linux live CD with a few system utilities. It's a CD that in case of a system disaster can be used to recover things. It includes GParted, a graphical tool for partitioning the disks. Version 3.7 runs Linux 2.6.28.7 and has the latest e2fsprogs, so, it fulfills our requirements.
Start GParted and select your disk (if you have more than one) that contains the / filesystem and right click Mount on the / partition of your disk (the one that you made note of). GParted will mount the partition under /media.
Now, use the terminal (ROXterm) to create a backup of the / partition. The syntax that does the trick is:
tar czpvf <backup file> <mounted / directory>
where <backup file> is the tar.gz file that will be created and <mounted / directory> is the directory under which / is mounted (eg. sda11). Run the command inside the /media directory. Notice the z and p options for tar. The first is to create a tar gzipped file and the second is for preserving the permissions and ownership of the files (which is very important). The backup file must be stored inside another partition of your disk, where there is enough free space (1/3 of the current used space of / should be enough, since compression will be used, but this is not a rule). You must also mount this partition under /media to make use of it.
Run the command and you will have a backup of your / partition.
Now, unmount the / partition. Issue the following command from the terminal:
mkfs.ext4 </ partition>
where / partition is the / partition on your disk (eg. sda11). Say bye-bye to your last filesystem. The partition will be formatted as ext4.
Mount it using either GParted or the terminal:
mount -t ext4 </ partition> <mount dir>
where mount dir is the directory under which the / partition will be mounted (eg. /media/sda11). Now, go one directory up (eg. /media) and issue the command:
tar xzpvf <backup file>
Tar will extract the / files inside the new / partition, which is ext4 formatted. After the decompression, go to the the etc directory inside the mounted / (eg. /media/sda11/etc) and use vi to change the filesystem type of the / partition to ext4 by editing the fstab file.
Unmount all partitions and you are ready to go. Provided that your current kernel includes support for ext4, you should be fine.
In my case, I got this warning:
EXT3-fs: sda11: couldn't mount because of unsupported optional features (240).
I guess the system tries to mount the / partition as ext3 (close relative to ext4) first and issues this warning. Other users see this too. Then it mounts it as ext4 without a hitch.
I suppose you find this little guide useful. Your comments are welcome.