All of lore.kernel.org
 help / color / mirror / Atom feed
* RAID1 migrate to bigger disks
@ 2015-01-24 14:32 Daniel Pocock
  2015-01-24 14:36 ` Hugo Mills
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Pocock @ 2015-01-24 14:32 UTC (permalink / raw)
  To: linux-btrfs




I've got a RAID1 on two 1TB partitions, /dev/sda3 and /dev/sdb3

I'm adding two new disks, they will have bigger partitions /dev/sdc3 and
/dev/sdd3

I'd like the BtrFs to migrate from the old partitions to the new ones as
safely and quickly as possible and if it is reasonable to do so, keeping
it online throughout the migration.

Should I do the following:

btrfs device add /dev/sdc3 /dev/sdd3 /mnt/btrfs0
btrfs device delete /dev/sda3 /dev/sdb3 /mnt/btrfs0

or should I do it this way:

btrfs device add /dev/sdc3 /mnt/btrfs0
btrfs device delete /dev/sda3 /mnt/btrfs0
btrfs device add /dev/sdd3 /mnt/btrfs0
btrfs device delete /dev/sdb3 /mnt/btrfs0

or is there some other way to go about it?


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

* Re: RAID1 migrate to bigger disks
  2015-01-24 14:32 RAID1 migrate to bigger disks Daniel Pocock
@ 2015-01-24 14:36 ` Hugo Mills
  2015-01-24 14:46   ` Daniel Pocock
  0 siblings, 1 reply; 5+ messages in thread
From: Hugo Mills @ 2015-01-24 14:36 UTC (permalink / raw)
  To: Daniel Pocock; +Cc: linux-btrfs

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

On Sat, Jan 24, 2015 at 03:32:44PM +0100, Daniel Pocock wrote:
> 
> 
> 
> I've got a RAID1 on two 1TB partitions, /dev/sda3 and /dev/sdb3
> 
> I'm adding two new disks, they will have bigger partitions /dev/sdc3 and
> /dev/sdd3
> 
> I'd like the BtrFs to migrate from the old partitions to the new ones as
> safely and quickly as possible and if it is reasonable to do so, keeping
> it online throughout the migration.
> 
> Should I do the following:
> 
> btrfs device add /dev/sdc3 /dev/sdd3 /mnt/btrfs0
> btrfs device delete /dev/sda3 /dev/sdb3 /mnt/btrfs0
> 
> or should I do it this way:
> 
> btrfs device add /dev/sdc3 /mnt/btrfs0
> btrfs device delete /dev/sda3 /mnt/btrfs0
> btrfs device add /dev/sdd3 /mnt/btrfs0
> btrfs device delete /dev/sdb3 /mnt/btrfs0
> 
> or is there some other way to go about it?

btrfs replace start /dev/sda3 /dev/sdc3 /mountpoint
btrfs fi resize 3:max /mountpoint
btrfs replace start /dev/sdb3 /dev/sdd3 /mountpoint
btrfs fi resize 4:max /mountpoint

   The 3 and 4 in the resize commands should be the devid of the
newly-added device.

   Hugo.

-- 
Hugo Mills             | I'll take your bet, but make it ten thousand francs.
hugo@... carfax.org.uk | I'm only a _poor_ corrupt official.
http://carfax.org.uk/  |
PGP: 65E74AC0          |                              Capt. Renaud, Casablanca

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

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

* Re: RAID1 migrate to bigger disks
  2015-01-24 14:36 ` Hugo Mills
@ 2015-01-24 14:46   ` Daniel Pocock
  2015-01-24 15:47     ` Martin Steigerwald
  2015-01-25  5:07     ` Paul Jones
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Pocock @ 2015-01-24 14:46 UTC (permalink / raw)
  To: Hugo Mills, linux-btrfs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



On 24/01/15 15:36, Hugo Mills wrote:
> On Sat, Jan 24, 2015 at 03:32:44PM +0100, Daniel Pocock wrote:
>> 
>> 
>> 
>> I've got a RAID1 on two 1TB partitions, /dev/sda3 and /dev/sdb3
>> 
>> I'm adding two new disks, they will have bigger partitions
>> /dev/sdc3 and /dev/sdd3
>> 
>> I'd like the BtrFs to migrate from the old partitions to the new
>> ones as safely and quickly as possible and if it is reasonable to
>> do so, keeping it online throughout the migration.
>> 
>> Should I do the following:
>> 
>> btrfs device add /dev/sdc3 /dev/sdd3 /mnt/btrfs0 btrfs device
>> delete /dev/sda3 /dev/sdb3 /mnt/btrfs0
>> 
>> or should I do it this way:
>> 
>> btrfs device add /dev/sdc3 /mnt/btrfs0 btrfs device delete
>> /dev/sda3 /mnt/btrfs0 btrfs device add /dev/sdd3 /mnt/btrfs0 
>> btrfs device delete /dev/sdb3 /mnt/btrfs0
>> 
>> or is there some other way to go about it?
> 
> btrfs replace start /dev/sda3 /dev/sdc3 /mountpoint btrfs fi resize
> 3:max /mountpoint btrfs replace start /dev/sdb3 /dev/sdd3
> /mountpoint btrfs fi resize 4:max /mountpoint
> 
> The 3 and 4 in the resize commands should be the devid of the 
> newly-added device.

Thanks for the fast reply

In the event of power failure, can I safely shutdown the server during
this operation and resume after starting again?

I get more than 2 hours runtime from the UPS but I suspect that
migrating 1TB will take at least 12 hours.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBCAAGBQJUw7A+AAoJEOm1uwJp1aqDIuoQAKLkc0DgDj1bE6b6RPh6cnb9
lm+rjJD6aCo84dKZ3kVjaYCuUrFK5uXdj1D3ZrELD//jyjr6HbMK7CSJzuzfxmol
rMRM0NaVb4RJ4WPuzbnUjT8pmNytisfP9oG1mV9JmJ+y6sZ2ApvOQwPyHpHWglSL
D+H4clpOa3jXCeNoVxjm1eipLSWnnpSO4NVdXTIgBiHqUaR+LpKpUlh3QGtknvV/
uHegNuTJ+C4/Stp3hrzKy0/OUlIyzucFEXKPJbI/88XvMuZcL/XTO8FoHRP4r/vq
qjICj4Dtjv+xOOe7WKT1Gw8wCz/66xMfSXIUSU02insfwfh0/fFpAS6XybKk4UsH
i7LwswqduJMgFiVHv9bMvwyx3UdmhVJRotjGobVP3XPbI3GMSCEztXHdSGLOFE9D
/IksBehi0XNw/YWOaLcoyA2XTXahBTcsTtktkZStrn5kKXvOPuE7LDyjkHq/o9W8
IYvti9Dvx2IicdJxRM7+5F6bKON2O7foDuSUJFd6/WAkrLVwdudurTqGDmk+uIdS
kZVUVpehmdjYltUyb4wY/ATAvKnQTm/U18L04pSQIbdtdQZD7bAVl7PotLctgdHn
xf7TokhjJZZmOk4C29m+uAQHy0gobDDXlPi3jtpO4Zj+CR9pXM1/+oa40xhWh4Eh
WtDofKi5z7BLVYFNqIix
=BR1V
-----END PGP SIGNATURE-----

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

* Re: RAID1 migrate to bigger disks
  2015-01-24 14:46   ` Daniel Pocock
@ 2015-01-24 15:47     ` Martin Steigerwald
  2015-01-25  5:07     ` Paul Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Martin Steigerwald @ 2015-01-24 15:47 UTC (permalink / raw)
  To: Daniel Pocock; +Cc: Hugo Mills, linux-btrfs

Am Samstag, 24. Januar 2015, 15:46:22 schrieb Daniel Pocock:
> On 24/01/15 15:36, Hugo Mills wrote:
> > On Sat, Jan 24, 2015 at 03:32:44PM +0100, Daniel Pocock wrote:
> >> I've got a RAID1 on two 1TB partitions, /dev/sda3 and /dev/sdb3
> >> 
> >> I'm adding two new disks, they will have bigger partitions
> >> /dev/sdc3 and /dev/sdd3
> >> 
> >> I'd like the BtrFs to migrate from the old partitions to the new
> >> ones as safely and quickly as possible and if it is reasonable to
> >> do so, keeping it online throughout the migration.
> >> 
> >> Should I do the following:
> >> 
> >> btrfs device add /dev/sdc3 /dev/sdd3 /mnt/btrfs0 btrfs device
> >> delete /dev/sda3 /dev/sdb3 /mnt/btrfs0
> >> 
> >> or should I do it this way:
> >> 
> >> btrfs device add /dev/sdc3 /mnt/btrfs0 btrfs device delete
> >> /dev/sda3 /mnt/btrfs0 btrfs device add /dev/sdd3 /mnt/btrfs0
> >> btrfs device delete /dev/sdb3 /mnt/btrfs0
> >> 
> >> or is there some other way to go about it?
> > 
> > btrfs replace start /dev/sda3 /dev/sdc3 /mountpoint btrfs fi resize
> > 3:max /mountpoint btrfs replace start /dev/sdb3 /dev/sdd3
> > /mountpoint btrfs fi resize 4:max /mountpoint
> > 
> > The 3 and 4 in the resize commands should be the devid of the
> > newly-added device.
> 
> Thanks for the fast reply
> 
> In the event of power failure, can I safely shutdown the server during
> this operation and resume after starting again?
> 
> I get more than 2 hours runtime from the UPS but I suspect that
> migrating 1TB will take at least 12 hours.

You can at least cancel the replacing:

merkaba:~> btrfs replace --help
usage: btrfs replace <command> [<args>]

    btrfs replace start [-Bfr] <srcdev>|<devid> <targetdev> <mount_point>
        Replace device of a btrfs filesystem.
    btrfs replace status [-1] <mount_point>
        Print status and progress information of a running device replace
    btrfs replace cancel <mount_point>
        Cancel a running device replace operation.

I thought you could resume it then later, but I don't see this. The man 
page doesn't see it either.

-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

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

* RE: RAID1 migrate to bigger disks
  2015-01-24 14:46   ` Daniel Pocock
  2015-01-24 15:47     ` Martin Steigerwald
@ 2015-01-25  5:07     ` Paul Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Jones @ 2015-01-25  5:07 UTC (permalink / raw)
  To: Daniel Pocock, Hugo Mills, linux-btrfs@vger.kernel.org

> -----Original Message-----
> From: linux-btrfs-owner@vger.kernel.org [mailto:linux-btrfs-
> owner@vger.kernel.org] On Behalf Of Daniel Pocock
> Sent: Sunday, 25 January 2015 1:46 AM
> To: Hugo Mills; linux-btrfs@vger.kernel.org
> Subject: Re: RAID1 migrate to bigger disks
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> 
> On 24/01/15 15:36, Hugo Mills wrote:
> > On Sat, Jan 24, 2015 at 03:32:44PM +0100, Daniel Pocock wrote:
> >>
> >>
> >>
> >> I've got a RAID1 on two 1TB partitions, /dev/sda3 and /dev/sdb3
> >>
> >> I'm adding two new disks, they will have bigger partitions
> >> /dev/sdc3 and /dev/sdd3
> >>
> >> I'd like the BtrFs to migrate from the old partitions to the new ones
> >> as safely and quickly as possible and if it is reasonable to do so,
> >> keeping it online throughout the migration.
> >>
> >> Should I do the following:
> >>
> >> btrfs device add /dev/sdc3 /dev/sdd3 /mnt/btrfs0 btrfs device delete
> >> /dev/sda3 /dev/sdb3 /mnt/btrfs0
> >>
> >> or should I do it this way:
> >>
> >> btrfs device add /dev/sdc3 /mnt/btrfs0 btrfs device delete
> >> /dev/sda3 /mnt/btrfs0 btrfs device add /dev/sdd3 /mnt/btrfs0 btrfs
> >> device delete /dev/sdb3 /mnt/btrfs0
> >>
> >> or is there some other way to go about it?
> >
> > btrfs replace start /dev/sda3 /dev/sdc3 /mountpoint btrfs fi resize
> > 3:max /mountpoint btrfs replace start /dev/sdb3 /dev/sdd3 /mountpoint
> > btrfs fi resize 4:max /mountpoint
> >
> > The 3 and 4 in the resize commands should be the devid of the
> > newly-added device.
> 
> Thanks for the fast reply
> 
> In the event of power failure, can I safely shutdown the server during this
> operation and resume after starting again?
> 
> I get more than 2 hours runtime from the UPS but I suspect that migrating
> 1TB will take at least 12 hours.

I know that removing a device can be interrupted safely by a reboot - I do it all the time as there is no cancel option for removal. It seems to operate the same way balance does, by moving data around, and when there is nothing left on the disk it is removed and de-associated.

Paul.
 


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

end of thread, other threads:[~2015-01-25  5:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-24 14:32 RAID1 migrate to bigger disks Daniel Pocock
2015-01-24 14:36 ` Hugo Mills
2015-01-24 14:46   ` Daniel Pocock
2015-01-24 15:47     ` Martin Steigerwald
2015-01-25  5:07     ` Paul Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.