Skip to contentSkip to conversation

RAID1 migrate to bigger disks

DISCUSSION Daniel Pocock 4 participants 5 messages Jan 24, 2015 – Jan 25, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

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?

#1 lore raw
Quoted 17 lines · Daniel Pocock

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

Quoted 8 lines

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.

Signature · 4 lines
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
#2 lore raw

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

Quoted 24 lines · Hugo Mills
Quoted 23 lines · Daniel Pocock

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

Quoted 8 lines
Quoted 1 line

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

#3 lore raw

Am Samstag, 24. Januar 2015, 15:46:22 schrieb Daniel Pocock:

Quoted 31 lines · Hugo Mills
Quoted 21 lines · Daniel Pocock
Quoted 20 lines

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

Quoted 8 lines
Quoted 1 line

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.

Quoted 7 lines

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.

Signature · 2 lines
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
#4 lore raw
In reply to Daniel Pocock
Quoted 46 lines

-----Original Message-----
From: [email protected] [mailto:linux-btrfs- [email protected]] On Behalf Of Daniel Pocock
Sent: Sunday, 25 January 2015 1:46 AM
To: Hugo Mills; [email protected]
Subject: Re: RAID1 migrate to bigger disks

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

Quoted 24 lines · Hugo Mills
Quoted 23 lines · Daniel Pocock

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

Quoted 8 lines
Quoted 1 line

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.

Quoted 7 lines

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.