Upgrade root (also boot) filesystem from ext3 to ext4 on Debian

2

After upgrading a Debian system from 5.0 to 6.0 (Lenny to Sqeeze), how do I go about upgrading the root filesystem (which in this case is also boot) from ext3 to ext4?

pauldoo

Posted 2010-12-17T14:44:19.307

Reputation: 586

Answers

5

This was no big deal at all, here's what I did:

  1. Edit /etc/fstab, replacing "ext3" with "ext4" for my root filesystem. (I also removed "barrier=1", which is now the default on ext4.)
  2. Reboot into single user mode with read only root filesystem.
  3. Run tune2fs -O extents,uninit_bg,dir_index /dev/DEV
  4. Reboot, again into single user mode with read only root filesystem. (Observe some mount warnings.)
  5. Run e2fsck -fDC0 /dev/DEV to patch up the filesystem.
  6. Reboot normally.

Most of this was taken from here.

pauldoo

Posted 2010-12-17T14:44:19.307

Reputation: 586

FYI the EXT4 Howto URL is now https://ext4.wiki.kernel.org/articles/e/x/t/Ext4_Howto_d00b.html

– zarkdav – 2011-11-11T10:04:39.357

2You'll probably want to convert the files and directories on the filesystem to use "extents" too, by using chattr +e file on everything. – Legooolas – 2012-07-20T22:16:26.397

0

additionaly to pauldoo's answer

  1. you might need to add rootfstype=ext4 to kernel boot options
  2. if you've converted a fairly old ext2 to ext4, it might be lacking online resize capability with the only solution - create new ext4 fs and then move your files there (sad, but true)
  3. if you've converted a fairly old ext2 to ext4, you might notice a .journal file at the root. it does not appear on other mount points, since fsck -f hides it automatically. Sadly it canot do the same to / mount point - you need live cd or any other running system to hide this .journal node

PS still actual for wheezy

PF4Public

Posted 2010-12-17T14:44:19.307

Reputation: 246