linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to merge two partitions?
@ 2013-08-01 10:53 Andrew Stubbs
  2013-08-01 11:08 ` Hugo Mills
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Stubbs @ 2013-08-01 10:53 UTC (permalink / raw)
  To: linux-btrfs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to merge two partitions?
  2013-08-01 10:53 How to merge two partitions? Andrew Stubbs
@ 2013-08-01 11:08 ` Hugo Mills
  2013-08-01 12:14   ` Andrew Stubbs
  0 siblings, 1 reply; 3+ messages in thread
From: Hugo Mills @ 2013-08-01 11:08 UTC (permalink / raw)
  To: Andrew Stubbs; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 2199 bytes --]

On Thu, Aug 01, 2013 at 11:53:34AM +0100, Andrew Stubbs wrote:
> 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.)

   That's going to be the easiest option by far.

> 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!)

   You would expect data in a different filesystem format to be
integrated into an existing set of data structures? That would be...
magic. :)

> 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.

   That's the other option I'd go for.

> 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?

   No, using gparted to move it backwards into the free space is your
best option here.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
    --- I don't know. I can't tell the future, I just work there. ---    

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to merge two partitions?
  2013-08-01 11:08 ` Hugo Mills
@ 2013-08-01 12:14   ` Andrew Stubbs
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Stubbs @ 2013-08-01 12:14 UTC (permalink / raw)
  To: Hugo Mills, linux-btrfs

On 01/08/13 12:08, Hugo Mills wrote:
>> 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!)
>
>     You would expect data in a different filesystem format to be
> integrated into an existing set of data structures? That would be...
> magic. :)

No, this was merging two btrfs filesystem of the same format. I hoped 
that, somehow, it would just add it into the tree, perhaps as another 
subvolume. Maybe even it might not show up in the overall volume, but 
could still be mounted from the partition volume. It's all about trees, 
right?!

Anyway, what's confused me is that one of the tutorials I found says 
that you should run mkfs on the new device before adding it, but 
experimentation shows that's just not necessary. The bogus instructions 
led me to believe that the contents of the new device was significant, 
somehow.

It would be nice if "man btrfs" had a big warning that the added device 
will get wiped, effectively.

>> Is there a cunning btrfs trick to do this? Can a btrfs filesystem be
>> extended "backwards", if you see what I mean?
>
>     No, using gparted to move it backwards into the free space is your
> best option here.

OK, thanks.

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-01 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 10:53 How to merge two partitions? Andrew Stubbs
2013-08-01 11:08 ` Hugo Mills
2013-08-01 12:14   ` Andrew Stubbs

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).