I have a root filesystem thats live and mounted and I'd like to convert it to ext4. All the howto's i've read deal with booting off a live CD but thats not an option.
-
It can be done live. I've done it live plenty of times, but there are some possible caveats. Distro? Version? – Chad Feller Aug 22 '11 at 06:33
3 Answers
It appears that my original post was completely wrong. You can convert an ext3fs partition to an ext4fs partition while it is mounted, because the conversion process doesn't actually change the files that were previously written to use extents. This is documented in the ext4 howto along with all the reasons why it's a really bad idea for you to try:
- None of the existing files are converted, so you will not receive any performance boost (and according to the per-distribution instructions, some kernels have bugs dealing with these imported files)
- You need to have a bootloader that supports ext4, if you don't, you won't know until it stops booting (since the file isn't changed during the conversion, the bootloader will still be able find it, until the file has been replaced or moved).
- If ext4 isn't built into your kernel, you must make sure your initrd/initramdisk has the module for it.
- You need to update all your fstab and kernel boot parameters to show that the filesystem is ext4 since it will no longer mount as ext3.
- The system must be rebooted
- The partition will require a fsck once rebooted (with a fsck version that understands ext4)
The howto lists some of the changes required on a per-distribution basis as well, so you can determine the correct versions of which packages to install.
If booting off a LiveCD is not an option, I presume that this is a remotely hosted server that you can't just go and boot off a cd. If one of those above fails, how are you going to deal with it when it doesn't come back after you reboot? How long does it take to fsck your root partition, so you'll know how long to give it before you start worrying, and how much longer 'til you start sweating?
Otherwise, if you're confident you've done everything right and have everything set up the right way, just run
tune2fs -O extents,uninit_bg,dir_index /dev/partitiondevice
shutdown -r now
![](../../users/profiles/56830.webp)
- 19,313
- 2
- 35
- 51
You can not simply convert between ext3 and ext4... You can however convert between ext3 and ext2 by removing or adding the journal and remounting the file system. Selecting the file system format you want when installing is always the best course of action as changing it later is not always an option.
![](../../users/profiles/9052.webp)
- 11,241
- 2
- 27
- 40
-
1you can upgrade an ext3 to ext4. its well documented and relatively safe, its not as simple as the change between ext2 and ext3 and it is one way but it is very much possible and fairly straightforward. – Silverfire Aug 22 '11 at 03:07
One option would be to change the fstab file to specify to mount it as an ext4 partition, this will allow you to take advantage of a few features of ext4. This will require a reboot.
You cant really change a file system while its mounted. if its not a system drive you may be able to unmount it and then follow the steps similar to the ones you saw using a live cd but this depends on your setup.
In general if you cant afford downtime you dont do things like this, its potentially dangerous and unnecessary in 99% of cases. ext3 is very solid and i would trust storing my data on it for years to come.
remember to do a full backup first :)
![](../../users/profiles/78498.webp)
- 780
- 4
- 14
-
Changing the fstab entry will do nothing. As the accepted answer mentioned, you need to use tune2fs to enable some of the new features in ext4. Not all of them can be enabled on an existing fs; for those you need to reformat. – psusi Sep 12 '11 at 00:24