From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: how long should "btrfs device delete missing ..." take?
Date: Thu, 11 Sep 2014 19:31:56 +0000 (UTC) [thread overview]
Message-ID: <pan$2d5ba$86c3ebd8$b81abab$13e892ea@cox.net> (raw)
In-Reply-To: 84a98bc5f667c04ca74ff77b56f537d9@admin.virtall.com
Tomasz Chmielewski posted on Thu, 11 Sep 2014 17:22:15 +0200 as excerpted:
> After a disk died and was replaced, "btrfs device delete missing" is
> taking more than 10 days on an otherwise idle server:
>
> # btrfs fi show /home
> Label: none uuid: 84d087aa-3a32-46da-844f-a233237cf04f
> Total devices 3 FS bytes used 362.44GiB
> devid 2 size 1.71TiB used 365.03GiB path /dev/sdb4
> devid 3 size 1.71TiB used 58.00GiB path /dev/sda4
> *** Some devices missing
>
> Btrfs v3.16
>
> So far, it has copied 58 GB out of 365 GB - and it took 10 days. At this
> speed, the whole operation will take 2-3 months (assuming that the only
> healthy disk doesn't die in the meantime).
> Is this expected time for btrfs RAID-1?
Device delete definitely takes time. For the sub-GiB usage shown above,
10 days for 50 GiB out of 350+ does seem excessive, but there are extreme
cases where it isn't entirely out of line. See below.
> There are no errors in dmesg/smart, performance of both disks is fine:
> # btrfs sub list /home | wc -l
> 260
> I've tried running this on the latest 3.16.x kernel earlier, but since
> the progress was so slow, rebooted after about a week to see if the
> latest RC will be any faster.
The good thing is that once a block group is copied over, it should be
fine and won't need re-copied if the process is stopped over a reboot
and restarted on a new kernel, etc.
The bad thing is that if I'm interpreting your report correctly, that
likely means 7+10=17 days for that 58 gig. =:^(
Questions:
* Presumably most of those 260 subvolumes are snapshots, correct?
What was your snapshotting schedule and did you have old snapshot
cleanup-deletion scheduled as well?
* Do you run with autodefrag or was the system otherwise regularly
defragged?
* Do you have large (GiB plus) database or virtual machine image files
on that filesystem? If so, had you properly set the NOCOW file
attribute (chattr +C) on them and were they on dedicated subvolumes?
200+ snapshots is somewhat high and could be part of the issue, tho
it's nothing like the extremes (thousands) we've seen posted in the
past. Were it me, I'd have tried deleting as many as possible before
the device delete missing, in ordered to simplify the process and
eliminate as much "extra" data as possible.
The real issue is going to be fragmentation, on spinning-rust drives.
Run filefrag on some of your gig-plus files that get written to
frequently (vm-images and database files are the classic cases) and
see how many extents are reported. (Tho note that filefrag doesn't
understand btrfs compression and won't be accurate in that case, and
also that due to the btrfs data chunk size of 1 GiB, that's the
maximum extent size, so multi-gig files will typically be two extents
more than the number of gigs, filling up the current chunk,
N whole-gig chunks, the file tail.) The nocow file attribute (which
must be set while the file is zero-sized to be effective, see
discussion elsewhere) can help with that, but snapshotting an
actively being rewritten nocow file more or less defeats the
purpose of nocow, since the snapshot locks in place the existing
data and the first rewrite to a block must then be cowed anyway.
But putting those files on dedicated subvolumes and then not
snapshotting those subvolumes is a workaround.
I wouldn't try defragging now, but it might be worthwhile to stop the
device delete (rebooting to do so since I don't think there's a cancel)
and delete as many snapshots as possible. That should help matters.
Additionally, if you have recent backups of highly fragmented files
such as the VM-images and DBs I mentioned, you might consider simply
deleting them, thus eliminating that fragment processing from the
device delete. I don't know that making a backup now would go much
faster than the device delete, however, so I don't know whether to
recommend that or not.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
next prev parent reply other threads:[~2014-09-11 19:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 15:22 how long should "btrfs device delete missing ..." take? Tomasz Chmielewski
2014-09-11 19:31 ` Duncan [this message]
2014-09-11 21:25 ` Chris Murphy
2014-09-11 23:51 ` Duncan
2014-09-12 2:10 ` Chris Murphy
2014-09-12 5:19 ` Russell Coker
2014-09-12 5:33 ` Duncan
2014-09-12 6:27 ` Chris Murphy
2014-09-12 5:41 ` Duncan
2014-09-12 5:59 ` Duncan
2014-09-11 23:06 ` 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='pan$2d5ba$86c3ebd8$b81abab$13e892ea@cox.net' \
--to=1i5t5.duncan@cox.net \
--cc=linux-btrfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).