Ext4 vs. Btrfs: Why We’re Making The Switch [Linux]

Ads by Google

switch linux root filesystemQuite honestly, one of the last things people look at is which file system is being used. Windows and Mac OS X users have even less reason to look, because they really have only one choice for their system –¬†NTFS and HFS+, respectively. Linux, on the other hand, has plenty of different file system options, with the current default being ext4.

However, there’s been another push to change the file system to something called btrfs. But what makes btrfs better, and when will we see distributions making the change?

What Do File Systems Do?

In case you’re unfamiliar about what file systems actually do, it’s pretty simple when summarized. File systems are used to control how data is stored after a program is no longer using it, what other information – known as metadata – is attached to the data itself, how access to data is controlled, and so on.

It doesn’t sound like an easy thing to program, and it’s definitely not. File systems are still continually being revised to include more functionality while becoming more efficient in what it needs to do. Therefore, although it’s a basic necessity for all computers, it’s not quite as basic as it sounds.

Why Switch File Systems?

switch linux root filesystem

ext4 has been another improvement to the ext3 file system, which was an improvement over the ext2 file system. While the ext4 is a very solid file system which has been the default choice for almost all distributions for the past few years, it is made from an aging code base. Additionally, Linux users are seeking many new different features in file systems which ext4 does not handle on its own.

Ads by Google

There is software that takes care of some of those needs, but in the performance aspect, being able to do those things on the file system level would be faster.

ext4

linux switch root filesystem

ext4‘s limits are still pretty impressive. The largest volume/partition you can make with ext4 is 1 exbibyte – the equivalent of roughly 1,152,921.5 terabytes. While the maximum file size is 16 tebibytes – or roughly 17.6 terabytes, which is much bigger than any hard drive a regular consumer can currently buy.

ext4 is known to bring speed improvements over ext3 by using multiple different techniques. Like most modern file systems, it is a journaling file system, which means that it keeps a “journal” of where files are located on the disk and of any other changes to the disk. Despite all of its features, it does not support transparent compression, transparent encryption, or data deduplication. Snapshots are technically supported, but that feature is experimental at best.

Btrfs

Btrfs, which can be pronounced as “Butter FS”, “Better FS”, or “B-Tree FS”, is a file system made completely from scratch. Btrfs exists because the developers wanted to expand the functionality of a file system to include pooling, snapshots, and checksums among other things.

While independent from ext4, it wants to build off the ideas present in ext4 which are great for consumers and businesses alike and incorporate those additional features which will benefit everyone (but specifically enterprises). For enterprises who use very large programs with very large databases, having a seemingly continuous file system across multiple hard drives would be very beneficial because it can make consolidation of data much easier. Data deduplication would reduce the amount of actual space data would occupy, and data mirroring would become easier with btrfs as well when there is a single, broad file system that needs to be mirrored.

Of course, you can still choose to create multiple partitions so that you don’t have to mirror everything. The maximum partition size of a btrfs file system is 16 exbibytes, and the maximum file size is also 16 exbibytes. Considering that btrfs will be able to span over multiple hard drives, it’s a good thing that it supports 16 times more drive space than ext4.

Conclusion

switch linux root filesystem

Sadly, the arrival date for btrfs isn’t quite known. Officially, the next-generation file system is still classified as unstable, but if you download the latest version of Ubuntu you can choose to install on a btrfs partition. It has been reported Fedora 18 will use btrfs as its default file system, as by the time of its release a file system checker for btrfs should exist.

When btrfs will actually be classified as stable is still a mystery, but don’t expect Ubuntu to use btrfs by default until it is indeed considered stable. There is still a good amount of work left for btrfs, as not all features are yet implemented and performance (in my experience) is a little sluggish when compared to ext4.

What’s your opinion of btrfs? Do you think it’ll be any better than ext4 for regular desktop users? Anything you’d like to see implemented in btrfs? Let us know in the comments!

Image Credits: Internet background with binary code via Shutterstock, Jackson Carson, dthprod

Ads by Google

68 Comments - Write a Comment

Reply

Eric Wardowski

When it comes to a corrupted hard drive, how do these Linux file systems stack up against NTFS and HFS+ for data recovery? I’ve worked with all three systems, however have never had to attempt data recovery on either Mac or Linux. (knock on wood)

Quinton Reeves

Haha. Still a good idea nonetheless :)

Danny Stieben

Data recovery should be perfectly fine, as NTFS, HFS+, ext4, and btrfs are all journaling file systems. I know ext4 was also created as an update to ext3 which made the possibility of corrupting the file system much smaller.

David Kastrup

A journaling file system protects against data corruption in the case of the computer crashing or the power failing in a manner where the drive will cease operations without damaging the platter.

It does not protect against disk damage.

Danny Stieben

There is a button for that, Elijah. It’s the little flag next to the Reply button.

Elijah Swartz

Ah, hidden in plain sight. It was so small, I must have missed it and mistaken it for being part of the reply button. Thanks!

What about an edit button is that hidden somewhere? Those come in handy.

Danny Stieben

An edit button could be handy. I wonder if I can poke James about it…

jesse

NTFS still requires defragging. None of the native Linux filesystems do.

NTFS still looses files occasionally when it gets corrupted. And it can loose the entire filesystem if the corruption occurs at the right time.

pepe

Not true:

# xfs_db -r -c frag /dev/sdb1
actual 49742, ideal 526, fragmentation factor 98.94%
# xfs_db -r -c frag /dev/sdc1
actual 11074, ideal 540, fragmentation factor 95.12%
# xfs_db -r -c frag /dev/sdd1
actual 4334, ideal 545, fragmentation factor 87.43%

I need to do an xfs_fsr at some time!

old486whizz

I’m sorry but XFS is not ‘native’ Linux (although it is supported).. It’s an old IRIX filesystem which Linux decided to support.

On the other hand, riserFS and ext3 both have defrag utilities and I would class them as “native”.

Danny Stieben

Question is, do you ever use those defrag utilities for ReiserFS and ext3/4? I know I don’t…and there aren’t any known graphical tools for them either.

Danny Stieben

It’s true that NTFS still requires defragging. Linux filesystems actually do too eventually, but fragmentation happens so much slower that most people don’t need to bother with it.

Reply

ernest

my first hard didk had 20 Mb ..and I thought it was huge !

Reply

GodSponge

Microsoft made a file system that could span drives in xp, but i ALWAYS had problems with it. If a hard drive failed it broke everything. I think they abandoned it because it sucked. I hope this one is better than that one at least.

Danny Stieben

Do you mean the Drive Extender technology which they used in Windows Home Server? Because I’ve never heard of it being available in XP directly.

GodSponge

No, it was called a dynamic disk or something like that. It was primarily so that you could make several drives show up as one.

Danny Stieben

Interesting! If you could maybe find a link about it, that would be awesome!

GodSponge

I may be wrong. It may still be in Windows 7. Not sure.

GodSponge

“Extend Volume…” is still in Disk Management in my Windows 7 Pro machine. That leads me to believe that it is still around, though I really can’t see why. Software RAID isn’t a great idea in my experience.

Danny Stieben

Oh wow that’s really cool! Thanks for those links! And Extend Volume only grows them within the disk…I only know because I use it often to shrink partitions to make room for Linux.

DD

If you mean dynamic disk, it simply appends disks (JBOD) to the file system. If you do this without any redundancy (RAID), of course you will lose your entire file system if a disk goes bad, this is not unique to Windows.

Reply

App Crush

Makes very much sense! Thanks!

Danny Stieben

Glad you enjoyed it! :)

Reply

Kenny Jackson

Hopefully Fedora 18 will have a version of Grub that supports btrfs so that we don’t have to have a separate /boot partition. I know that that’s good form anyway, but it annoys me.

Danny Stieben

Don’t worry, I usually still use a single partition for everything, and that’s REALLY bad form. But I think I’m using btrfs on my main desktop, and I don’t believe I’m using a separate boot partition, although I’ll be able to check in about a week. Don’t have access to it right now.

Benjamin Hodgetts

Careful with that. I was using BTRFS as the single partition on a drive and everything was fine until I enabled compression, at which point syslinux (the boot manager I was using) failed to load the kernel anymore as it doesn’t support BTRFS compression. I’m not sure about the state of GRUB2 in this regard.

Danny Stieben

Oh, nice pointer. I assume the same is with GRUB2, but I’m not sure. Safer to just assume it doesn’t though. :P

Reply

Pedro Oliva

interesting :)

Reply

Chris Hoffman

Hm, btrfs includes pooling like LVM? Interesting. I haven’t been paying attention to btrfs at all.

ken

yes, it supports drive pools and even raid (thought raid5/6 aren’t done yet AFAIK).

On new system builds, I’ve been using btrfs…prior to that, I’ve been doing LVM/RAID1 mostly…

Danny Stieben

I’m pretty happy about that feature, actually. A little curious as to how it’ll be implemented and configured during an install, but it sounds awesome. :D

Reply

Shannon_Moss

How do ZFS compare to ext / btrfs,I heard it is superior to both of them,I have used ext 3/4 but not the others.

Danny Stieben

I actually don’t know a lot about ZFS right now, but I might write another article pertaining to ZFS once I know enough. ;)

Reply

Stephan

In my experience new file system features or any other underlying features have no meaning to end users unless they are made available to the end user in a convenient and easily understandable way. This can be done via a well designed and double blind tested GUI or via some other less or non technical interface (HUD, Voice etc).

Therefore the usefulness or utility of the BTRFS to the end user will depend on projects like Gnome, KDE etc. This requires involvement on their part… a lot of involvement.

Danny Stieben

I agree. Of course, there will always be those hardcore Linux users who won’t need that and can make use of the features right away, but it’s a very valid point if Linux is to gain market adoption with those new features.

Reply

Elder-Geek

It will come to pass that the file check tools will work, that it will provide better speed, be more robust than ext4 and eventually adopted by the entire Linuxsphere.

A better question is btfs vs zfs. That my friends depends very much on where home users are going. If home users want to keep adding more storage to their system in the form of multiple drives, which one will they choose?

ZFS is stable, mature and awesome…but eats memory like a pig. If I was setting up a box to do nothing else but serve files, I would want a system with 8 gigs of RAM and to use zfs to manage a large array of drives.

If I wanted to actually use a computer for day to day work and NOT have go dedicate 6 gigs of RAM to working my disk array, bfts will be the way to go.

Really how many small businesses or home users are interested in building a working desktop system with a array of 4 to 10 hard drives set up so you only get 70% of the storage space, but can survive a drive failure and can add more drives and have your files adjust across all the drives. These arrays don’t shrink well, you and add drives but not remove them. And your data no longer exists on one disk, but only as part of a working array of disks.

BTFS will replace EXT4, but will desktop users ever embrace it’s most important features? And for those that care about those features, will ZFS always remain a better choice?

Danny Stieben

Great questions indeed. I can’t say much because I’m not well-informed about ZFS, but there definitely is a big focus on btrfs compared to ZFS and that will probably make itself more noticeable later on, especially when it comes to the number of users.

Reply

Dudley Overbey

What about SUN/Oracle’s ZFS filesystem?
Doesn’t it contain many of the attributes btrfs has?

Elder-Geek

I am looking at adding a new file server at work and have been looking at both btfs and zfs.

ZFS is great as long as you have lots of memory and you keep adding disks not take them away. It scales very well, is mature. As long as you boot from ext4 on another drive or flash drive any linux can add the zfs kernel modules.

btfs will not scale as well. But is much better on memory. It you want to use 3 or 4 or 5 drives and do not want to throw scads of memory at it, bfts is the way to go. If you want 8 or 9 drives, and be able to survive 3 drives going out at one time, ZFS is your only choice.

Danny Stieben

Elder-Geek seems to know what he’s talking about. He’ll know a bit more about ZFS than I currently do.

Doc Mock

I am required to do many benchmarks for work. Most of the bench marks include file system tests. Zfs is a big memory user. Even using it in a back end file storage device for NFS or FC results in poor performance. In order to get equivalent performance between the filesystems admins need to add mulitple SSD cache devices. On a local machine the responsiveness issues are masked by caching performed by the COW filesystem. Btrfs is about 35% faster in most filesystem benchmarks.

Reply

Joe Felisky

Danny,

Both OpenSUSE 12.1 and SUSE Linux Enterprise Server 11 SP2 include btrfs for 6+ months. SUSE has added some very nice tools for working with btrfs, that can be found here: http://snapper.io/

There is more to Linux than Fedora and Ubuntu …

Enjoy.

Danny Stieben

Ubuntu and Fedora have included them as well, but those tools do look nice.

It will be big news though when a distribution will offer btrfs as its default file system first. Currently it looks like it’ll be Fedora.

Reply

Bucky

What I like best about btrfs is the btrfs snapshot. Yes, you can do snapshots in LVM, but unlike LVM, you DON’T have to specify the amount of space by which the btrfs snapshot can diverge from the master before it goes up in a greasy ball of flame.

So you can have a much larger pool of snapshots (tell your boss: “Live backups”).

Danny Stieben

I’m happy about the snapshot features as well. Should work a lot better than Windows’ System Restore. ;)

Reply

SuperJdynamite

If you’re going to mirror or stripe you should probably be looking to RAID for a solution as opposed to doing it in software.

Chris Cowley

Not anymore you shouldn’t! RAID is old hat – a 2TB disk will take several days to re-build. Add to that it is mathematically very certain to fail with out telling you. BTRFS does the replication at a file level, so is much more likely to successfuly re-build in a timely fashion. http://www.zdnet.com/blog/storage/why-raid-5-stops-working-in-2009/162 explains why.

Danny Stieben

Thanks for the link, Chris!

Reply

thilina1024

This is the first time I heard about Btrfs. Thanks for the article.

Reply

Anandu B Ajith

I Love Linux

Reply

Richard Borkovec

btrfs looks like it could be pronounced “butter face,” haha, but besides the odd abbreviation, it looks very promising. Hopefully it matures enough and gets implemented so the home user can feel it’s benefits without any hassle. If you talked to most people about the architecture of their system, they’d be completely puzzled, so it’s really imperative that things like this get implemented with no hassle.

Danny Stieben

Very true. Not only to make it easier but to make it faster to configure as well.

Reply

Justin Fortin

My issue is support of btrfs on Windows, or it’s lack thereof.

Danny Stieben

What would you need to use Windows for? Data sharing between OSes?

Reply

Timothy Liem

I’ll stick with everything the distros I use decided to use, because I regularly reinstall my notebook every release. right now, I’m using Ubuntu 12.04 and Fedora 17 and they both do great in my machine. I think I’ll stick a bit longer with Ubuntu since it’s a LTS release.

Danny Stieben

That’s fine. No need to switch before the distros decide on it because right now btrfs is still technically unstable (although I’m running it…not terribly stable yet).

Reply

Jonathan

I’m just interested in whether the btrfs file system store data more efficiently than ext4. The best thing about Linux in my opinion is that it was one man’s desire to start from scratch using the available knowledge of computers at the time and implement the things in the root that MS had to do with additional features, add-ons, patches and upgrades.

Linux has always tried to keep things clean, small and efficient and going with that theme I would want the “better FS” to be cleaner, smaller, faster and more efficient with added flexibility that moving forward with a design brings with it. Such attributes would allow for more saved data on the same size hard drives.

Danny Stieben

I’m not exactly what you mean by data being stored more efficiently…all file systems will use the available hard drive space. Any more is physically impossible. If you mean through compression, yes, btrfs can do that by itself.

Charlie Gunz

He may be talking about DeDupe. Now THAT’S what I call using a disk efficiently. if I have 17 seasons of South Park stored on a drive, and they all use the same video compression, chances are there will be tons of duplicated data, including parts of the same opening sequence over and over and over. even if those same parts of the video are not exactly the same, lots of that data will be. With DeDupe techniques, that data will be stored once. Much like compression.

Reply

Alex Livingstone

I never really liked EXT4. I’ll be interested to see the changes in BTRFS

Danny Stieben

Really? What didn’t you like about it?

Reply

mitchbw

would like to see better and more easy file recovery, in my experience ext 2 is my far easier to recover then ext4. and even then its no easy task.

Danny Stieben

True; thank goodness I haven’t had to really attempt data recovery yet!

Reply

Dave

I use BTRFS on the desktop, it’s terrible, and I am migrating back to ext4 (bit of a pain with 2TB of data). Huge huge huge IOWAITs all the time, sluggish desktop. Only using a 5400RPM disk for my /home, but it’s ridiculous the amount of times Linux completely blocks everything else for some stupid write, and then there are occasional panics from some btrfs codepath. This is on an 8GB RAM desktop.

Also, it’s unstable, with some bad luck, you can not fix it (no tools available yet).

The premise is of course great, I’d love to have ZFS also for my desktop. Since none of the Linux filesystems have proper end to end checkums or easy snapshots (not the LVM mess) I wouldn’t recommend it on a server either, at least not one with data you care about. Funny how people bitch about it here in the comments, it’s the ONLY serious filesystem for a server where you care about your data!

Also, NTFS is a very good filesystem, you have atomic transactions! All filesystems get fragmented, some faster than others due to their design (think FAT), some have external tools, some avoid it with hugely delayed writes, and some fix it in the background. ext3/4 are fine for desktop but no need for MS bashing, it’s not 1999 anymore.

Reply

Ahmed Khalil

Linux steps is good but still very slow to win the war with windows and mac

Reply

survivalmonkey

Been using btrfs on a production laptop for about a year now. I have 3 subvolumes on 2 drives: / and /vm on drive #1 and /home on Drive #2.

As much as I love snapshots and all the rest of what btrfs brings to the party, I’m in the process of re OSing this machine and using ext4. I’ve never experienced corruption the system has degraded in performance to the point of being frustrating. I’ve had autodefrag set in fstab for random writes but I think that overall, the fs is defragmented to the point of beginning to trip over itself. Because of the placement of my vmware machines, I cannot perform the btrfs online defragmentation and this is something that I had not realized when I chose to experiment.

I love the concept and gave it my best shot, gaining new features with every new kernel but I have to, sadly, throw in the towel.

Your comment