Author Topic: Converting File System From Ext3 To Ext4  (Read 4800 times)

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Converting File System From Ext3 To Ext4
« on: November 27, 2009, 12:15:01 PM »
I've been using using kernel 2.6.27.31tex5 for a while now and finally had the time to convert everything over from Ext3 to Ext4 which I've been wanting to do for some time. But I'm having problems getting my root partition to boot using Ext4. My home partition worked without a hitch.
I decided to start a new post about this because I haven't found any guide specifically dedicated to upgrading to Ext4. Originally, I posted this in 'HD Installation' but I think this is a more appropriate place for it since Ext4 isn't officially supported by the most recent release. Anyway, here is what I did all in all:
For /home (sda6) I logged in as root then in the terminal ran these commands:
umount /dev/sda6
tune2fs -O extents,uninit_bg,dir_index /dev/sda6
fsck.ext4 -yfD /dev/sda6
Then I edited the relevant part of fstab to:
/dev/sda6 /home ext4 defaults 0 2
That all worked fine. Then I booted from a cloned PCLOS on an external usb hdd and tried the same thing for my root partition (sda5) editing fstab similarly for root:
/dev/sda5 / ext4 defaults 0 1
I got no errors doing the conversion. It seemed to work the same as when I did my home partition but when I try to boot from my internal hdd (usb hdd unplugged) I get these errors during boot:
mounting root filesystem.
EXT3-fs: sda5: couldn't mount because of unsupported optional features (40).
mount: error mounting /dev/root on sysroot as ext3: Invalid argument
At first I thought it might be because PCLOS grub version doesn't support Ext4 but now I know that's not the case. What am I doing wrong?
« Last Edit: November 28, 2009, 12:33:31 PM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline Joble

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6804
  • USA - Mountain Time
Re: Converting File System From Ext3 To Ext4
« Reply #1 on: November 27, 2009, 12:45:08 PM »
No idea what you might be doing wrong.  I've never converted a file system but I did manage to make an ext4 partition.  Pretty much a lucky accident on my part, not sure I could explain what I did or how I did it, cause I did it all wrong and it just worked out.
Search First.
Forum Rules
Hero means I talk a lot, nothing more, nothing less!
Have an Awesome Day!
Healthy System

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11547
  • ----IOFLU----
Re: Converting File System From Ext3 To Ext4
« Reply #2 on: November 27, 2009, 12:55:31 PM »
I've been using using kernel 2.6.27.31tex5 for a while now and finally had the time to convert everything over from Ext3 to Ext4 which I've been wanting to do for a while. But I'm having problems getting my root partition to boot using Ext4. My home partition worked without a hitch.
I decided to start a new post about this because I haven't found any guide specifically dedicated to upgrading to Ext4. Originally, I posted this in 'HD Installation' but I think this is a more appropriate place for it since Ext4 isn't officially supported by the most recent release. Anyway, here is what I did all in all:
For /home (sda6) I logged in as root then in the terminal ran these commands:
umount /dev/sda6
tune2fs -O extents,uninit_bg,dir_index /dev/sda6
fsck.ext4 -yfD /dev/sda6
Then I edited the relevant part of fstab to:
/dev/sda6 /home ext4 defaults 0 2
That all worked fine. Then I booted from a cloned PCLOS on an external usb hdd and tried the same thing for my root partition (sda5) editing fstab similarly for root:
/dev/sda5 / ext4 defaults 0 1
I got no errors doing the conversion. It seemed to work the same as when I did my home partition but when I try to boot from my internal hdd (usb hdd unplugged) I get these errors during boot:
mounting root filesystem.
EXT3-fs: sda5: couldn't mount because of unsupported optional features (40).
mount: error mounting /dev/root on sysroot as ext3: Invalid argument
At first I thought it might be because PCLOS grub version doesn't support Ext4 but now I know that's not the case. What am I doing wrong?

Try running mkinitrd, as root, for the 2.6.27.31tex5 kernel. That should put the correct driver for the ext4 filesystem into the new initrd, so the /dev/root uses ext4 instead of ext3.

You'll have to do this from the liveCD or the cloned OS on the external drive. Mount the / partition from the OS on the internal drive, chroot to the mount point directory, cd to /boot, then run mkintrd.
« Last Edit: November 27, 2009, 01:00:49 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Re: Converting File System From Ext3 To Ext4
« Reply #3 on: November 27, 2009, 04:13:49 PM »
Your instructions made a lot of sense and I was hopeful they would do the trick but still no joy. After running the command 'mkintrd' I got this ouput in the terminal:
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
Here is what my initrd-functions looks like:
http://pastebin.ca/1690274
In the meantime thanks for your help on this.
« Last Edit: November 27, 2009, 04:24:16 PM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11547
  • ----IOFLU----
Re: Converting File System From Ext3 To Ext4
« Reply #4 on: November 27, 2009, 04:44:49 PM »
Your instructions made a lot of sense and I was hopeful they would do the trick but still no joy. After running the command 'mkintrd' I got this ouput in the terminal:
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
/usr/libexec/initrd-functions: line 64: /dev/stderr: No such file or directory
Here is what my initrd-functions looks like:
http://pastebin.ca/1690274
In the meantime thanks for your help on this.



Don't know what you actually used for the command, but I'd try this;

[root@localhost ~]# mkinitrd -vf --preload=jbd --preload=ext4 --force-usb initrd-2.6.27.31.tex5.img 2.6.27.31.tex5
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Re: Converting File System From Ext3 To Ext4
« Reply #5 on: November 27, 2009, 07:30:27 PM »
Unfortunately, Konsole still gives me the same output. When it comes to Linux me and the number 4 don't seem to agree. First KDE and now Ext. Maybe, I should just make boot and root a separate partition and leave boot as Ext3.
« Last Edit: September 17, 2010, 10:18:10 PM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11547
  • ----IOFLU----
Re: Converting File System From Ext3 To Ext4
« Reply #6 on: November 27, 2009, 07:56:29 PM »
Unfortunately, Konsole still gives me the same output. When it comes to Linux me and the number 4 don't seem to agree. First KDE and now Ext. Maybe
I should just make boot and root a separate partition and leave boot as Ext3.

Leaving the boot partition ext3 wouldn't do anything to help. The reported problem is an inability to transfer /dev/root to the / partition, and it's trying to mount that as ext3.

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6232
Re: Converting File System From Ext3 To Ext4
« Reply #7 on: November 27, 2009, 08:09:13 PM »
what does the following command give you?

cat /proc/filesystems | grep ext

try to open "/boot/grub/menu.lst" and add "rootfstype=ext4" at the end of the kernel line and reboot and see it it helps

the line should like something like this:
Code: [Select]

kernel (hd0,0)/boot/vmlinuz-2.6.31.3 BOOT_IMAGE=2.6.31.3 root=/dev/hda1 splash quiet splash=verbose vga=788 rootfstype=ext4




« Last Edit: November 27, 2009, 08:30:23 PM by muungwana »
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Re: Converting File System From Ext3 To Ext4
« Reply #8 on: November 28, 2009, 10:04:27 AM »
what does the following command give you?

cat /proc/filesystems | grep ext

try to open "/boot/grub/menu.lst" and add "rootfstype=ext4" at the end of the kernel line and reboot and see if it helps

the line should like something like this:
Code: [Select]

kernel (hd0,0)/boot/vmlinuz-2.6.31.3 BOOT_IMAGE=2.6.31.3 root=/dev/hda1 splash quiet splash=verbose vga=788 rootfstype=ext4



This is what I got from 'cat /proc/filesystems | grep ext'
ext4
ext4dev
ext2
ext3

So I edited menu.lst and booted the drive. This time boot fails with these errors:
VFS: Cannot open root device or unknown block (0,0)
Please append a correct "root=" boot option; here are all the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown block (0,0)

Upon further investigation now I'm not sure PCLOS grub version supports Ext4 so even if I get my root partition figured out I'm not sure that it would boot anyway:
http://ext4.wiki.kernel.org/index.php/Ext4_Howto#Booting_from_an_ext4_filesystem

But I must report a definite speed increase using Ext4 for my /home partition. Noticeable difference (on new files that is, next I was gonna use Clonezilla to get all files using extents).
I'm going to start from scratch and try again. Maybe I missed something early on.


 

« Last Edit: June 01, 2010, 06:50:32 AM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline tschommer

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1890
  • MLU and BLU (Bacon lovin' user)
Re: Converting File System From Ext3 To Ext4
« Reply #9 on: January 01, 2010, 12:37:00 AM »
First of all - happy new year, everybody!

A late post regarding this topic. I was pretty frustrated trying to convert an installation I had made on a second partition (sda8) using LXDE. I always had the boot procedure ending in trying to mount the root filesystem with ext3 instead of ext4.

Today I finally figured out what I had done wrong, and what I had to do to correct it. To summarize:

1. Run e2fsck /dev/sda<n> on the partition
2. Reboot
3. Convert to ext4 using tune2fs -O extents,uninit_bg,dir_index /dev/sda<n>
4. Run fsck on the partition (fsck.ext4 -yfD /dev/sda<n>)
5. chroot into the partition
6. Change /etc/fstab to use ext4 on the root partition
7. In /boot, backup the original initrd file, run mkinitrd -v -f initrd-<kernel version>.img <kernel version>

Because I had previously omitted step 6., I was always unsuccessful, because the image didn't contain the info that the partition was ext4. But now it's all solved!

Thanks so much to everbody that has participated in this and similar threads!

Torsten
Our defense is in the preservation of the spirit which prizes liberty as the heritage of all men, in all lands, everywhere."
Abraham Lincoln --September 11, 1858 Speech at Edwardsville, Illinois

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11547
  • ----IOFLU----
Re: Converting File System From Ext3 To Ext4
« Reply #10 on: January 01, 2010, 05:34:30 AM »
tschommer:

Good catch on the /etc/fstab entry edit to ext4.  ;D

Another item to watch for is if the drive with the / partition being used is an IDE/PATA drive, and the kernel being used is the new 2.6.31 or 2.6.32, the entry in /boot/grub/menu.lst must either use the UUID number of the partition, a partition LABEL, or a /dev/sdxn designation, for the root= entry.

If one is using the root=/dev/hdxn for previous kernels, the new entry made for the new kernels should do the conversion automatically when the newer kernels are installed. The older kernels can and should still use the /dev/hdxn entry, but the new kernels no longer differentiate between /dev/hdxn and /dev/sdxn, all drives are seen as /dev/sdxn.

If one has a mix of IDE/PATA and SATA drives, the drive designations for all drives will change, so if UUID numbers or LABELs are not used in /etc/fstab, all partition designations of the /dev/<whatever> type will need to be changed to how the newer kernels see the partitions. If one reverts back to the older kernels, if the changes made in /etc/fstab were not to UUID or LABEL type designations, they will all need to be changed again.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2428
  • Any Bugs in site?
Re: Converting File System From Ext3 To Ext4
« Reply #11 on: September 13, 2010, 06:47:11 AM »
4evergr8ful
I am rather curious about what the outcome of thread was?  Did you ever follow though on this conversion to ext4 ??
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline everge48

  • Sr. Member
  • ****
  • Posts: 383
Re: Converting File System From Ext3 To Ext4
« Reply #12 on: September 17, 2010, 03:26:17 PM »
4evergr8ful
I am rather curious about what the outcome of thread was?  Did you ever follow though on this conversion to ext4 ??

No, things got busy for me again so root ended up being left as it was. Then before I knew it PCLinux 2010 KDE4 was released and I did a fresh install choosing Ext4 during the installation process.
« Last Edit: September 17, 2010, 03:28:07 PM by 4evergr8ful »
Any sufficiently advanced technology is indistinguishable from magic.

Offline Yankee

  • Hero Member
  • *****
  • Posts: 1477
  • In theory, theory=practice, in practice ???
Re: Converting File System From Ext3 To Ext4
« Reply #13 on: September 17, 2010, 05:46:00 PM »

I've been using using kernel 2.6.27.31tex5 for a while now and finally had the time to convert everything over from Ext3 to Ext4 which I've been wanting to do for some time.



I'm probably going to be considered a newbie by someone for this post but am going to
make it anyway.  Why ext4 ?   My flash and portable drives are both xfs and working
perfectly.  Partimage however does tell me it's xfs procedure is beta.

patrick013

ASUS EeePc 900HA netbook  1.6 Ghz Atom CPU  1GB RAM
160 GB internal HD    Seagate 250 GB USB portable drive 
Intel ‎Mobile 945GSE Integrated Graphics Controller
Atheros AR242x/AR542x Wireless Network Adapter
Intel (N10/ICH7 Family) High Definition Audio
Dynex 5-Button Wired Optical Mouse
LXDE

Offline wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2428
  • Any Bugs in site?
Re: Converting File System From Ext3 To Ext4
« Reply #14 on: September 18, 2010, 05:37:13 AM »
patrick013
Fairly short answer, ext4 is better than ext3 which is/was good.  Search the forum I have seen the question a number of times and there are some better technical answer.  :)

4evergr8ful
Thanks, I like to see outcomes of interesting threads. This will do.  :)
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen