Fix ext4-fs cannot change data mode on remount with tune2fs 1


I thought I’d be smart and enable data=journal on my root file system. I know its slower, but I prefer data integrity over speed on this system. Even if its not my main data volume, I like the idea of the whole OS running with the best integrity.

So, here’s what I did… I edited my /etc/fstab file, and added “data=journal” in the mount options. Here’s my old fstab:

/dev/mapper/vg1-root / ext4 defaults,errors=remount-ro 0 1

I changed it to:

/dev/mapper/vg1-root / ext4 rw,data=journal,journal_checksum 0 1

Well… upon reboot, I got an error and it wouldn’t load the system:

EXT4-fs: cannot change data mode on remount

Turns out, during boot it’s first mounted as read only, if I understand things correctly, then remounted per your fstab options. When I created the file system I didn’t use the option to journal_data, which is not “ordered” mode, per ext4 default. And the root file system is remounted during boot. (correct Linux Pros out there? I have that right, right?) So to fix this, I booted into my trusted SystemRescueCD (on USB) and ran this:

tune2fs -o journal_data /dev/vg1/root

Yahoo! It booted right up with my new fstab options. Note that YOU MUST have created that file system with journaling enabled in the first place, like you would with “mkfs.ext4 -j /dev/sda1”. (with the -j option)

PS. You can list the options on the file system with “tune2sf -l /dev/sda1”.

BTW, I am using Ubuntu 10.04 server, in case you wondered. :)