From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: fsck: to repair or not to repair
Date: Fri, 13 May 2016 06:36:45 +0000 (UTC) [thread overview]
Message-ID: <pan$14f07$a448b38$b8e37f4a$116d54ce@cox.net> (raw)
In-Reply-To: CAPmG0jYDw8Sid2jORVtfwNLpeZPAqtH429EQsraz9GzNdK1aUQ@mail.gmail.com
Henk Slager posted on Thu, 12 May 2016 19:02:56 +0200 as excerpted:
> Maybe you first want to test it on an overlay
> of the device or copy the whole fs with dd.
WARNING!
Because btrfs can be multi-device, it needs some way to track which
devices belong to each filesystem, and it uses filesystem UUID for this
purpose.
If you clone a filesystem (for instance using dd or lvm snapshotting,
doesn't matter how) and then trigger a btrfs device scan, say by plugging
in some other device with btrfs on it so udev triggers a scan, and the
kernel sees multiple devices with the same filesystem UUID as a result,
and one of those happens to be mounted, you can corrupt both copies as
the kernel btrfs won't be able to tell them apart and may write updates
to the wrong one.
Prevention:
Don't let btrfs see both copies at the same time. If you need to clone
the filesystem, ideally make sure it's unmounted at the time, and detach
either the original device or the clone immediately upon finishing the
clone operation (before doing anything that might trigger a btrfs device
scan, including device plugging that would trigger udev to trigger such a
scan). Then simply keep them separate, only attaching one at a time and
DEFINITELY never mounting the filesystem with both the clone and the
original devices attached, so the kernel can't get confused and write to
the wrong one because the other one is never there at the same time to
provide the opportunity.
--
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:[~2016-05-13 6:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 21:10 fsck: to repair or not to repair Nikolaus Rath
2016-05-12 17:02 ` Henk Slager
2016-05-12 17:35 ` Nikolaus Rath
2016-05-12 17:55 ` Ashish Samant
2016-05-13 6:36 ` Duncan [this message]
2016-05-13 15:28 ` Nikolaus Rath
2016-05-13 21:35 ` Chris Murphy
2016-05-16 11:17 ` Austin S. Hemmelgarn
2016-05-16 11:34 ` Andrei Borzenkov
2016-05-16 11:48 ` Austin S. Hemmelgarn
2016-06-10 3:40 ` Nikolaus Rath
2016-06-10 11:05 ` Austin S. Hemmelgarn
2016-06-10 15:54 ` Nikolaus Rath
2016-06-10 16:50 ` Adam Borowski
2016-06-10 16:55 ` Nikolaus Rath
2016-06-10 17:12 ` Austin S. Hemmelgarn
2016-06-10 17:22 ` Adam Borowski
2016-06-10 17:39 ` Austin S. Hemmelgarn
2016-06-10 17:40 ` Henk Slager
2016-06-10 15:55 ` Nikolaus Rath
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$14f07$a448b38$b8e37f4a$116d54ce@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).