linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Stubbs <andrew.stubbs@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: How to merge two partitions?
Date: Thu, 01 Aug 2013 11:53:34 +0100	[thread overview]
Message-ID: <51FA3E2E.30405@gmail.com> (raw)

If I have two partitions, /dev/sda1 and /dev/sda2, one btrfs, and one 
ext4 (but I could convert it first), how can I merge them into one 
filesystem without moving all the data onto an external device and then 
moving it all back again? (I do have a backup, of course, but 
transferring the data takes hours, maybe days.)

I'm left with this layout for historical reasons, and now the smaller 
partition is close to running out of space.

I thought of using "btrfs device add" and just living with the untidy 
underlying devices, but an experiment with loopback filesystems shows 
that any data on the new device is silently obliterated (it might be 
nice if the docs mentioned this!)

I've thought of shrinking the larger partition, creating a third 
partition, and adding that to the smaller filesystem. This would solve 
the free-space issue, but doesn't feel great.

I've thought of using a temporary third partition as an intermediary, 
but I don't have space to move all the data in one go.

I've thought of using a clever partition manager to move the start of 
the second partition, transfer some data, move it some more, transfer 
some more data, but this seems like an equally lengthy process.

I could move the data from the smaller partition into the larger one, 
then delete the first partition, and move the whole larger partition 
forward, extend it, and fix up the fstab. That might be less painful.

Is there a cunning btrfs trick to do this? Can a btrfs filesystem be 
extended "backwards", if you see what I mean?

Any other ideas? Comments?

Thanks in advance

Andrew

             reply	other threads:[~2013-08-01 10:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 10:53 Andrew Stubbs [this message]
2013-08-01 11:08 ` How to merge two partitions? Hugo Mills
2013-08-01 12:14   ` Andrew Stubbs

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=51FA3E2E.30405@gmail.com \
    --to=andrew.stubbs@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).