LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 11-28-2011, 12:04 PM   #1
holister
LQ Newbie
 
Registered: Oct 2010
Posts: 22

Rep: Reputation: 0
"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
 
Old 11-28-2011, 12:28 PM   #2
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by holister View Post
Goal: Use ext4 (faster than ext2) but completely remove "journaling" (not secure for sensitive data destruction - shred/wipe, etc...)
  1. Probably true (ext2 vs ext4) in most workloads, not clear if true in yours
  2. Untrue, if you are careful enough (which probably isn't very); and not really different because of journalling.


Quote:
Originally Posted by holister View Post
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.
 
Old 11-28-2011, 03:51 PM   #3
holister
LQ Newbie
 
Registered: Oct 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by salasi View Post
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 with data=writeback (if same option is taken out of 'root' but left in for these two.
sda4 = Vbox -> mounts fine with data=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?
 
Old 11-28-2011, 04:11 PM   #4
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 211

Rep: Reputation: 67
This bit me awhile ago. Change the default filesystem mount options in the filesystem itself.
Code:
# tune2fs /dev/sda2 -o journal_data_writeback
. Remount will no longer accept different journaling options even if the old mount was readonly.
 
Old 11-28-2011, 04:21 PM   #5
holister
LQ Newbie
 
Registered: Oct 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jthill View Post
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.
 
Old 11-28-2011, 06:01 PM   #6
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 211

Rep: Reputation: 67
Make fstab and the superblock match. You can tune2fs -l to check whether the filesystem features include has_journal.
 
Old 11-28-2011, 08:48 PM   #7
holister
LQ Newbie
 
Registered: Oct 2010
Posts: 22

Original Poster
Rep: Reputation: 0
conclusion...

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.
 
Old 11-28-2011, 09:47 PM   #8
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 211

Rep: Reputation: 67
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.

Last edited by jthill; 11-28-2011 at 09:58 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 04:08 PM
How to get the "data type" of an "unknown variable" in "C Language" ? Affair Programming 8 06-20-2009 12:30 PM
Logged in as "root"/Fedora 8 but get "Operation not permitted" when using "chmod etc gosunlee Linux - Newbie 7 02-10-2008 05:56 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Edit "read-only" /etc/fstab from "System Recovery#" (without boot cd?) charlweed Linux - General 1 12-31-2006 05:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration