From: Jan Kouba <kouba.honza@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: Copying a disk containing a btrfs filesystem
Date: Fri, 11 Apr 2014 00:25:41 +0200 [thread overview]
Message-ID: <1646501.RvAOndPxnd@honzk> (raw)
In-Reply-To: <1809379.6bJCFjA2Oa@fuchsia>
Dne Čt 10. dubna 2014 20:36:32, Michael Schuerig napsal(a):
> On Thursday 10 April 2014 19:17:13 Jan Kouba wrote:
> > Dne Čt 10. dubna 2014 15:21:01, Michael Schuerig napsal(a):
> > > SMART indicates that my notebook disk may soon be failing (an
> > > unreadable/uncorrectable sector), therefore I intend to exchange it.
> > > The disk contains a single btrfs filesystem with several nested(!)
> > > subvolumes, each with several read-only snapshots in a .snapshots
> > > subdirectory.
> > >
> > > As far as I can tell, btrfs currently does not offer a sensible way
> > > to duplicate the entire contents of the old disk onto a new one.
> >
> > Yes it does
> >
> > You can make the old disk a seeding device and use it to seed the new
>
> > one like this:
> Intriguing. I didn't find much on the topic, but these pages seem
> pertinent
>
> http://en.wikipedia.org/wiki/Btrfs#Seed_devices
> https://btrfs.wiki.kernel.org/index.php/Seed-device
> http://unix.stackexchange.com/a/97819/64935
>
> > btrfstune -S 1 <old_device>
>
> Does the "1" mean "true" or is this indeed an integer-value arg? I've
> only seen the "1" in examples, are there other possible values?
Yes, "1" means "true", "0" false. If you run it twice with the same argument,
it says something like "Seeding flag already set/unset.".
>
> > mount <old_device> /mnt
> > # this will be mounted read-only
> >
> > btrfs dev add <new_device> /mnt
> >
> > mount -o remount,rw /mnt
> >
> > btrfs dev delete <old_device>
>
> Is the last one the step where data is copied from the seed device to
> the second device? No balance required before deleting the device?
Yes, everything is copied, no balance needed.
Well actually if you don't need to preserve the filesystem on the old device,
you can just add the new device into the filesystem and remove the old one like
this:
mount <old_device> /mnt
btrfs dev add <new_device> /mnt
btrfs dev delete <old_device> /mnt
The last command will copy everything from <old_device> to the <new_device>
and somehow wipe the <old_device> so it can't be mounted anymore.
This method will also preserve the UUID of the filesystem so there is no need
to change any config files.
Jan Kouba
next prev parent reply other threads:[~2014-04-10 22:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 13:21 Copying a disk containing a btrfs filesystem Michael Schuerig
2014-04-10 13:58 ` Duncan
2014-04-10 14:53 ` Michael Schuerig
2014-04-10 14:00 ` George Eleftheriou
2014-04-10 15:15 ` Duncan
2014-04-10 15:51 ` Michael Schuerig
2014-04-10 16:01 ` George Eleftheriou
2014-04-10 16:24 ` Michael Schuerig
2014-04-11 0:35 ` Duncan
2014-04-10 18:15 ` Martin Steigerwald
2014-04-10 17:17 ` Jan Kouba
2014-04-10 18:36 ` Michael Schuerig
2014-04-10 22:25 ` Jan Kouba [this message]
2014-04-11 10:39 ` Brendan Hide
2014-04-16 11:12 ` Michael Schuerig
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=1646501.RvAOndPxnd@honzk \
--to=kouba.honza@gmail.com \
--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).