[SOLVED] "data=writeback" in fstab mounts root partition as "read-only"
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"data=writeback" in fstab mounts root partition as "read-only"
Goal: Use ext4 (faster than ext2) but completely remove "journaling" (not secure for sensitive data destruction - shred/wipe, etc...)
Exact same fresh install on Debian Squeeze works perfectly. On fresh Wheezy install (kernel 3.0), including "data=writeback" for the / partition causes it to mount read-only, which prevents mounting of other partitions, causing loss of Xserver (drops to shell).
Taking "data=writeback" off the / partition but leaving it in for /boot and /home partitions and everything mounts just fine. Put the option back on / = read-only. Take it off = mounts fine.
Steps taken:
1. (live CD) Use cfdisk to cut up the drive
2. do: mke2fs -t ext4 -O ^has_journal /dev/sdaX (root)
3. do: tune2fs -O ^has_journal /dev/sdX
4. do: tune2fs -o journal_data_writeback /dev/sdX
5. in /etc/default/grub: GRUB_CMDLINE_LINUX="rootflags=data=writeback" -> update-grub2
6. edit /etc/fstab (for all partitions). ( / options) errors=remount-ro,noatime,nodiratime,data=writeback,barrier=0 (mounts "read-only")
I've read dozens of threads and everything points to "tune2fs -o journal_data_writeback /dev/sdX" solving the issue. I believe I've done all the steps correctly, yet still unable to mount root. Thank you for the help
Goal: Use ext4 (faster than ext2) but completely remove "journaling" (not secure for sensitive data destruction - shred/wipe, etc...)
Probably true (ext2 vs ext4) in most workloads, not clear if true in yours
Untrue, if you are careful enough (which probably isn't very); and not really different because of journalling.
Quote:
Originally Posted by holister
Exact same fresh install on Debian Squeeze works perfectly. On fresh Wheezy install (kernel 3.0), including "data=writeback" for the / partition causes it to mount read-only, which prevents mounting of other partitions, causing loss of Xserver (drops to shell).
So, in order to avoid journalling completely, you have decided to change from one journalling mode to another journalling mode.
Code:
data=writeback Data ordering is not preserved, data may be written
into the main file system after its metadata has been
committed to the journal.
I wonder if you are getting caught by this:
Code:
errors=remount-ro Remount the filesystem read-only on an error.
errors=continue Keep going on a filesystem error.
errors=panic Panic and halt the machine if an error occurs.
(These mount options override the errors behavior
specified in the superblock, which can be configured
using tune2fs)
That is (and this is speculation), there is an error, and the filesystem is being remounted ro as a consequence.
So, in order to avoid journalling completely, you have decided to change from one journalling mode to another journalling mode.
I have 6 pages of notes on this research and still not clear. I was under the impression that formatting the partition using -O ^has_journal and including "data=writeback" in fstab mounts the partition without journal. In addition, this part of 'dmesg' made me believe that "data=writeback" is, in fact the right option (suggesting that data=writeback results in sda3/sda4 being mounted "...without journal"):
Code:
] EXT4-fs (sda2): Cannot change data mode on remount
] EXT4-fs (sda2): Cannot change data mode on remount
] EXT4-fs (sda3): mounted filesystem without journal. Opts: data=writeback,errors=remount-ro
] EXT4-fs (sda4): mounted filesystem without journal. Opts: data=writeback,errors=remount-ro
sda2 = root -> mounts read only
sda3 = home -> mounts fine withdata=writeback (if same option is taken out of 'root' but left in for these two.
sda4 = Vbox -> mounts fine withdata=writeback
Maybe that's where the conflict is?!? Formatting with mke2fs -O ^has_journal followed by tune2fs -O ^has_journal accomplishes removing the journalling option and then 'data=writeback' conflicts in fstab??? Is there a command to see / verify if ext4 is journaling or not?
Change the default filesystem mount options in the filesystem itself.
So, you're saying that in /etc/fstab I should remove data=writeback and barrier=0. Right? But I can leave noatime.
With all the try-this and try-that, now I can't reproduce EXT4-fs (sda3): mounted filesystem without journal in 'dmesg'. Is there a way to verify that the system is mounted and is, in fact, running without journaling? Thanks.
I just want to clarify a few things (for my sake) before marking the thread "solved".
From tune2fs manpages: -O [features] tune2fs -O ^has_journal /dev/sdX -> Turns journalling OFF
journal_data_writeback - This mount option does write to journal. "When the filesystem is mounted with journalling enabled..." (Therefore, if journalling is turned off using the -O switch, then this mount option does not apply)
/etc/fstab - "Default mount options can be overridden by mount options specified in /etc/fstab..." (Putting journalling options in /etc/fstab (in this case - simply turning journaling off) is not necessary)
Conclusion: To completely turn off journalling in ext4, all that's required is command: tune2fs -O ^has_journal /dev/sdX
Using tune2fs -o journalling_data_writeback (mount option) and using "data=writeback" option in /etc/fstab as reported in so many threads regarding this issue is simply not required and might, in fact, be erroneous (correct?)
To verify whether journalling is turned off do: tune2fs -l /dev/sdX. Next to "Filesystem Features" - if 'has_journal' does not appear, then journalling has been turned off
Please let me know if anything here is incorrect or missing and I will update it, so there is no more confusion. Thank you all for your help.
In my experience, for something like this, "correct" is what works, the man pages tell you what to try. The man pages didn't warn you about the superblock-consistency requirement for ext4, for instance.
Frankly, a no-journal filesystem scares the crap out of me. Why Do That? Just run data=writeback,commit=600
(edit: should have been more explicit - only data=journal journals your data. nothing else does. my source on that: the filesystem author's documentation on it in the kernel source, Documentation/fs/ext4.txt. Anyway I wonder what kind of hardware and workload make zero-before-rm cheaper or safer than encrypt-it-in-the-first-place.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.