Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is Ext4 a safe bet now?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 2590

PostPosted: Tue Jan 26, 2010 5:45 pm    Post subject: Reply with quote

Carps wrote:
That mount line above do you use that for all ext4 partitions?

Concerning the filesystem: yes. (I use also other options like nosuid,nodev, or noexec for some other partitions, but this is of course a different topic).
Quote:
and would you advise ext4 for all partitions? normally i use ext2 for boot, and ext3 for the rest

I use ext4 for everything except for boot and external harddisks for which I use ext2 format (but I mount them as ext4; in the kernel I have completely removed ext2/ext3 support); if you use encrypted partitions, I would also recommend ext2 for those.
Quote:
edit: if i use gentoo-sources-2.6.31-r6 do i still need the nobarrier option

I don't remember the defaults. I suppose the description in the kernel sources (Documentation/filesystem/ext4.txt) should tell what it is for that kernel.
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 2590

PostPosted: Tue Jan 26, 2010 5:58 pm    Post subject: Reply with quote

Shining Arcanine wrote:
mv wrote:
Edit: I really cannot see a reason why anybody would care more about speed than data safety. Even if you have a multimedia partition in which you need low safety because you do not write often, it makes no sense: If you do not write often then barrier/journal does not matter concerning speed.


You could have a SSD that has a built-in capacitor to allow the drive to flush its cache in the event of a power outage, in which case the journal is pointless and harmful to both your SSD's performance and its life span.

Yes, I admit that this was not clearly formulated: I was speaking about using the filesystem journaled for harddisks. For SSDs it's a different story. But also in this case, one will probably not put speed as the highest priority but instead attempt to reduce the number of write cycles. Of course, switching off the journal is the first step in doing so, but there are also other things you can do (shrink sector sizes etc.); IIRC there was a thread about this topic somewhere here.
Back to top
View user's profile Send private message
Dark Foo
l33t
l33t


Joined: 21 Nov 2008
Posts: 921
Location: 127.0.0.1

PostPosted: Tue Jan 26, 2010 6:13 pm    Post subject: Reply with quote

mv wrote:

I don't remember the defaults. I suppose the description in the kernel sources (Documentation/filesystem/ext4.txt) should tell what it is for that kernel.


Thanks i will give that a look over in a little while
_________________
I know 43 ways to kill with a SKITTLE, so taste my rainbow bitch.
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1427

PostPosted: Tue Jan 26, 2010 11:11 pm    Post subject: Reply with quote

mv wrote:
Cyker wrote:
If it was only a few percent I wouldn't mind, but when I tried it I found the penalty was more in the order of 30-50% (!!)

Of course, because only due to barriers your journaling option actually takes effect. Probably without barriers, your "journal" was just modified in the disk cache and never written to disk, because it was changed immediately afterwards. As I told you: Journaling without barriers is just useless or even worse.
Quote:
... with full journalling and journal checksum enabled, a lot of the potential for corruption by crashes during inopportune out-of-order writes is mitigated

Not if the journal is not written or not at the correct time due to missing barriers.


It can't be that simple... what you're saying would mean that ext2 is safer than ext3/4 without barriers, and faster than ext3/4 with barriers!

Wait, that is actually true isn't it?

Remind me why the heck we're using journalling file systems again?
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 2590

PostPosted: Wed Jan 27, 2010 10:57 am    Post subject: Reply with quote

Cyker wrote:
It can't be that simple... what you're saying would mean that ext2 is safer than ext3/4 without barriers, and faster than ext3/4 with barriers!

Wait, that is actually true isn't it?

Essentially it is true (of course, extents are ignored in this consideration which also influence the speed): That's why I never understood why ext3 default is "nobarriers" - it just makes no sense. Well, of course one has to see: At the time ext3 was developed there was practically no harddisk cache, and the recommendation was to disable it. With disabled cache, barriers are not needed of course; maybe if they are very badly implemented in the hardware, it can be even faster to disable the cache and barriers. However, if they are well implemented, barriers should be faster than a disabled cache.
Quote:
Remind me why the heck we're using journalling file systems again?

The advantage is only data safety - of course, at the cost of speed. Well, you can have it also without speed loss, but then you need a much more clever file system like Reiser4. Unfortunately, there are the kernel developers' aversions against Reiser4.
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1427

PostPosted: Wed Jan 27, 2010 4:46 pm    Post subject: Reply with quote

But journals don't make things safer; All they do in practice is reduce the time needed to fsck after a system crash, but at the cost of either a significant speed loss if barriers are enabled, or possibly undetectable data corruption if they aren't enabled!

I mean, I get why they defaulted to nobarriers - Originally we didn't have barrier support (Even now, some hard disks do not honour it apparently!), but when we did, the kernel devs turned it on and saw the same 30-50% speed hit I got and freaked out, realizing that the vast majority would find this was unacceptable, so they left the default as disabled.

When ext4 came out, someone (I think Ted?) decided they should stop ignoring the problem and just bite the bullet, and that's when we saw all these posts about the sudden speed drop and counter-posts about the barriers=0.

I gotta say, I just updated to ext3 and 4 because it just seemed like the thing to do, but never really questioned the downsides; You've really opened my eyes to that...! :eek:

Since mdadm doesn't support barriers, I'm in a particularly big quandary now as to what would be a safer FS... I'm half tempted to just turn off the journal for my ext4 RAID except for the big downside; Pros: Faster, less chance of data corruption, Cons: Crashes would require a 2 day fsck (Which would be slowed down even more by the RAID resync!)

Ugh, roll on copy-on-write and continuous-write file systems...!
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 2590

PostPosted: Wed Jan 27, 2010 5:14 pm    Post subject: Reply with quote

Cyker wrote:
But journals don't make things safer; All they do in practice is reduce the time needed to fsck after a system crash

This is not true: If the fsck after a system crash can repair the things you were lucky. But the last blocks written, especially on a powerloss, can contain practically any rubbish. Actually, the data could even be written in the wrong sector and thus destroy arbitrary things - no filesystem can save you from that - but if at least the sector numbers are still correct, journaling will prevent any further damage. Without journaling almost anything bad can happen.
Back to top
View user's profile Send private message
InExile
n00b
n00b


Joined: 29 Jan 2010
Posts: 13

PostPosted: Wed Feb 03, 2010 6:27 pm    Post subject: Reply with quote

ext4 is pretty good on power outages. I have a laptop with a dead battery and where I plug it in is powered by a wall switch which was constantly getting flipped off by my family when they turned out the lights.

Needless to say it had happened about 20 times before I taped the switch into the ON position and my laptop recovered every single time without any intervention by me.
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 5345
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Wed Feb 03, 2010 9:51 pm    Post subject: Reply with quote

the MD and DM-System support more and more Write-Barriers now:

*) http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a2826aa92e2e14db372eda01d333267258944033
*) http://thread.gmane.org/gmane.linux.kernel.device-mapper.devel/10759

for more info on 2.6.33 storage improvements:
Kernel-Log – Was 2.6.33 bringt (2): Storage
<-- you have to translate it into English or any other language if German isn't one of the languages you speak or can read/understand
_________________
Unofficial minimal livecd x86/amd64 w/reiser4+truecrypt (by Neo2)
2.6.37.2_plus_v1: BFS, CFS,THP,compaction, zcache or TOI
Hardcore Linux user since 2004 :D
Back to top
View user's profile Send private message
dusanc
Apprentice
Apprentice


Joined: 19 Sep 2005
Posts: 210
Location: Serbia

PostPosted: Sat Feb 06, 2010 9:32 am    Post subject: Reply with quote

Dunno I always liked when barrier worked, but you had to watch how you make your fs setup.
Use fs-es that support it (ext3/4 if U're conservative :) , R4 if u like it fast and checksummed, dunno bout btrfs), use no md/dm/LVM or only Raid1 ( my option :) ).
But then U get used to feeling of safety when someone mangles cables between ups and your machine, some noob hard reboots it like it's windows :) , or just plain kernel crash when you play with some bleeding edge drivers :)

It can make you feel so much safe that you don't make backups, but you'll regret that, sooner or later.

Now it's even better as barriers get through more raid levels, LVM will get them eventually.

For me everything else is just plain gamble and waste of time.

PS. It'll be even better as DM and MD merge but that'll take few years :)
http://lwn.net/Articles/354769/
_________________
Reiser4 Gentoo FAQ [11Jun2011]
Back to top
View user's profile Send private message
alligator421
Apprentice
Apprentice


Joined: 30 Jul 2003
Posts: 191

PostPosted: Thu Feb 11, 2010 10:03 am    Post subject: Reply with quote

After a failing hdd (thanks backups !), same machine, I remade partitions with "new" ext4 fs on new hdd and it feels like I got a fresh cpu for free :wink:
As already mentionned, I think it's better to put explicit journal and barriers options in fstab as upstream likes to change the defaults.
Note that I had to put rootflags option in grub for / base partition because when / is remounted rw after boot, it can't change data/journal mode.
Still keeping legacy ext2 for boot :o
Code:

~ $ mount
rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,noatime,barrier=1,data=writeback)
none on /proc type proc (rw,relatime)
rc-svcdir on /lib/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sda3 on /home type ext4 (rw,noatime,data=journal,barrier=1)
/dev/sda5 on /root type ext4 (rw,noatime,data=journal,barrier=1)
/dev/sda7 on /var type ext4 (rw,data=ordered,barrier=1)
/dev/sda8 on /usr/portage type ext4 (rw,noatime,nodiratime,data=writeback,barrier=0)
/dev/sda9 on /usr/distfiles type ext4 (rw,noatime,nodiratime,data=writeback,barrier=0)
/dev/sda10 on /chroot type ext4 (rw,noatime,nodiratime,data=ordered,barrier=1)
none on /tmp type tmpfs (rw,noexec,noatime,nodiratime,size=1000M)
none on /var/tmp/portage type tmpfs (rw,noatime,nodiratime,size=2000M,nr_inodes=1M)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)
~ $
Back to top
View user's profile Send private message
Herring42
Guru
Guru


Joined: 10 Mar 2004
Posts: 334
Location: Buckinghamshire

PostPosted: Thu Feb 11, 2010 10:32 am    Post subject: Reply with quote

alligator421 wrote:

As already mentionned, I think it's better to put explicit journal and barriers options in fstab as upstream likes to change the defaults.
Note that I had to put rootflags option in grub for / base partition because when / is remounted rw after boot, it can't change data/journal mode.


So what are you fstab options and rootflags?
_________________
"The problem with quotes on the internet is that it is difficult
to determine whether or not they are genuine." -- Abraham Lincoln
Back to top
View user's profile Send private message
alligator421
Apprentice
Apprentice


Joined: 30 Jul 2003
Posts: 191

PostPosted: Thu Feb 11, 2010 2:09 pm    Post subject: Reply with quote

Herring42 wrote:
So what are you fstab options and rootflags?

By default, / gets mounted ordered or journal (I don't remember) by kernel at boot time. Or maybe I missed something in kernel config. When fstab is read, it remounts writeback but it can't change mode. So it needs to be put in writeback mode from the start by passing the option at kernel.
From what I have read, I don't think mounting writeback should be considered safe right now, especially since /etc lives in / but that's what backup are for :)

in menu.lst of grub :
Code:

root (hd0,0)
kernel /bzImage ro root=/dev/sda11 rootflags=data=writeback

fstab :
Code:

/dev/sda1      /boot      ext2      noauto,noatime   1 2
/dev/sda11      /      ext4      noatime,data=writeback,barrier=1   0 1
/dev/sda2      none      swap      sw      0 0
/dev/sda3      /home      ext4      noatime,data=journal,barrier=1   0 0
/dev/sda5      /root      ext4      noatime,data=journal,barrier=1   0 0
/dev/sda7      /var      ext4      data=ordered,barrier=1   0 0
/dev/sda8      /usr/portage      ext4   noatime,nodiratime,data=writeback,barrier=0   0 0
/dev/sda9      /usr/distfiles   ext4   noatime,nodiratime,data=writeback,barrier=0   0 0
/dev/sda10      /chroot      ext4   noatime,nodiratime,data=ordered,barrier=1   0 0
none                    /proc           proc            defaults   0 0
none         /tmp      tmpfs      noexec,size=1000M,noatime,nodiratime   0 0
none         /var/tmp/portage   tmpfs    size=2000M,nr_inodes=1M,nodiratime,noatime   0 0
devpts /dev/pts devpts
shm         /dev/shm   tmpfs      nodev,nosuid,noexec   0 0
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum