All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert White <rwhite@pobox.com>
To: "sys.syphus" <syssyphus@gmail.com>, linux-btrfs@vger.kernel.org
Subject: Re: Balance & scrub & defrag
Date: Wed, 10 Dec 2014 17:17:28 -0800	[thread overview]
Message-ID: <5488F0A8.7070503@pobox.com> (raw)
In-Reply-To: <CAAe=sHWSR=G0+hJCbLCQfgBB_b9VQxu2Q8JETMuRgz79fcBUbg@mail.gmail.com>

On 12/10/2014 02:15 PM, sys.syphus wrote:
> I am working on a script that i can run daily that will do maintenance
> on my btrfs mountpoints. is there any reason not to concurrently do
> all of the above? possibly including discards as well.
>
>
> also, is there anything existing currently that will do maintenance on
> btrfs so i don't have to reinvent the wheel?
>
> #!/bin/bash
> btrfs filesystem defragment -r -v /media/btrfs/  &
> btrfs scrub start /media/btrfs/ &
> btrfs balance start /media/btrfs/ &
>
>
> watch -d -n 30 "btrfs balance status /media/btrfs/; btrfs scrub status
> /media/btrfs/"


I'd recommend doing "none of the above" on a daily basis. One of the 
goals of the filesystem design is to remove the need for any of these 
operations on any regular basis. You are just going to bog down your 
system and increase you heat and wear profiles for no good reason.

Those tools should be used if you notice something fishy like recent 
decreases in efficiency or errors in your log files.

A _monthly_ scrub is maybe worth scheduling if you have a lot of churn 
in your disk contents.

Defragging should be done after significant content additions/changes 
(like replacing a lot of files via package management) and limited to 
the directories most likely changed.

Balancing is almost never necessary and can be anti-helpful if a 
experiences random updates in batches (because the nicely packed file 
may end up far, far away from the active data extent where its COW 
events are taking place.

Resist the urge to tinker with production systems. The exposure 
(rewriting stable data is just the chance to destabilize your data, 
balancing your drive can take two files that always change together and 
put them far away from one another, etc) is not worth the nearly 
non-existent chance of benefit. Once the system is "good" just leave it 
that way until you notice something "not good" coming on the horizon.

If you feel you _must_ do these tasks then doing them all at once, where 
possible, will just make both tasks take longer. If you are transcribing 
a file over on one side of the disk to defrag it, and you are 
transcribing an extent on the other side of the disk to balance it, you 
are just bouncing your disk heads back-and-forth and wasing wall-clock time.

So yea, it's not windows, it doesn't need the defrag hammer.

Trying to over-manage the system will prevent it from seeking its 
dynamic (and so predictable) equilibrium.

  reply	other threads:[~2014-12-11  1:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 22:15 Balance & scrub & defrag sys.syphus
2014-12-11  1:17 ` Robert White [this message]
2014-12-12  1:00   ` Russell Coker
2014-12-12  1:31     ` Robert White
2014-12-12  9:17       ` Erkki Seppala
2014-12-12 13:32         ` Robert White
2014-12-13  5:15         ` Zygo Blaxell
2014-12-11  8:33 ` Duncan
2014-12-12  4:32 ` Zygo Blaxell
  -- strict thread matches above, loose matches on Subject: below --
2014-12-12  9:49 Tomasz Chmielewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5488F0A8.7070503@pobox.com \
    --to=rwhite@pobox.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=syssyphus@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.