I'm automating a process to upgrade my ext3 filesystem to ext4. Following the instructions from here I'm able to successfully migrate my filesystem. I've scripted the vast majority of the work, and it's working pretty nicely.

However, the final step in the migration is running fsck on the unmounted partition. The issue is that I'm trying to migrate the root partition, which can't be unmounted during normal operations. So to run fsck, I need to boot into recovery mode, enter the root password, and run fsck that way.

Is it possible to configure CentOS to automatically run fsck on boot into recovery?

  • I just read the instructions you referenced - this looks awful. I think that upgrade procedure is weird - there has to be a better way to do it. A simple "needs check" will not work according to the procedure...
    – Nils
    Jan 6, 2012 at 21:15
  • Agreed, those instructions are forked, why isn't that guy just doing an rsync from one partition to the other. The part about creating a new initrd might be viable though, since the original might not include the ext4 driver.
    – Tim
    Jan 6, 2012 at 21:39
  • @Tim I'm attempting to upgrade the root partition, as opposed to creating a new one. Is there an easier way to get an ext4 partition? Jan 6, 2012 at 22:11
  • Not that I know of, but I certainly feel more comfortable with a clean partition opposed to an upgraded one.
    – Tim
    Jan 6, 2012 at 23:07
  • 1
    @Tim right. Especially if I were starting off a soft-raid-device - like in the instructions. I would break the mirror into two degraded mirrors, make a clean ext4, rsync -aHS, modify grub, boot it and reattach the other side.
    – Nils
    Jan 7, 2012 at 20:19

1 Answer 1


Why running an automatic fsck on system start won't work? fsck -pvfDC0 isn't doing anything special, just optimising the directories (the -D option) -- that's only part of ext4 file system. Extents is what makes it ext4. Just make it do fsck and reboot:

touch /forcefsck
shutdown -r now

Ext4 driver can read ext2, ext3 and ext4 file system, it's all the same for it. So yes, making sure your system is can boot from ext4 is important, having pure ext4 fs isn't.

That being said, I'd still go for creating a new partition as ext4 and copying data over -- it will be faster (access to partition, not the migration) and safer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .