You are not logged in.

#1 2013-12-21 22:21:17

piedro
Member
Registered: 2013-04-11
Posts: 218

[Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Hello!


Everywhere I read that there are performance issues with databases and virtual machine files on Btrfs.
I understand that I have to disable copy on wirite for these directories and recreate the files within (cause only new files are affected).

My question is: If the autodefragmentation is a problem for database files how then to turn off the defragmentation for only these directories?
Or is this an unnecessary measure if they have the nodatacow flag set already?

Any thoughts?

thx for reading,
piedro

Last edited by piedro (2013-12-22 16:58:38)

Offline

#2 2013-12-21 22:27:09

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-12-21 22:33:40

piedro
Member
Registered: 2013-04-11
Posts: 218

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Thx! I know this about COW but I am wondering whether I have to disable autodefragmentation in addtion to setting nodatacow...

p.

Offline

#4 2013-12-21 23:02:18

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Sorry, didn't read your post carefully.  I no have idea hmm


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2013-12-22 02:22:11

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Isn't autodefrag still optional? This btrfs wiki article implies it and this line

printk(KERN_INFO "btrfs: enabling auto defrag\n");

from fs/btrfs/super.c seems to back this up.

In case all of the above is true, simple don't mount with the autodefrag option.

It doesn't seem as if you could turn this off and on for single files/directories though, so only per filesytem (or subvolume?).


i'm sorry for my poor english wirting skills…

Offline

#6 2013-12-22 10:55:22

piedro
Member
Registered: 2013-04-11
Posts: 218

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Thx. Yes autodefrag is optional. Though I found autodefrag really to speed up things for me a lot. (Maybe to the level it was at installation.
So I'd rather leave it on.

The second part of your comment is exactly what I am trying to accomplish. I want to disable autodefrag selectively for chosen directories or subvolumes (I can always turn a directory into a subvolume so that's the same for this matter ...).

p.

Offline

#7 2013-12-22 11:38:46

teekay
Member
Registered: 2011-10-26
Posts: 271

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Unfortunately there is no support for per-subvolume mount options yet. And unlike COW, autodefrag can only be turned on at the FS level. But for small databases and large VM images turning off COW should make the fragmentation issue ignorable and autodefrag should behave acceptable (it does here on my home server). On a large corporate DB server or VM storage server you wouldn't be using BTRFS anyway.

Last edited by teekay (2013-12-22 11:40:16)

Offline

#8 2013-12-22 11:48:55

piedro
Member
Registered: 2013-04-11
Posts: 218

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Hello teekay!

Thank you very much! I will give it a try. That was my hope, that there's someone out there who already tried ... I'll report back if I run into problems ..
To have subvolume based mount options seems to me would be a very appreciated feature that would add so much tuneability for admins ... let's hope for it!

nice holidays,
p.

Offline

#9 2013-12-22 11:50:51

piedro
Member
Registered: 2013-04-11
Posts: 218

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

btw: how to mark this as "solved"? ;p

Offline

#10 2013-12-22 15:52:15

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] How to turn off Btrfs autodefragmentation for DBs and VMs?

Edit your first post which will also give you access to the title.

Offline

Board footer

Powered by FluxBB