Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* Rebalancing Question
@ 2020-07-11 14:42 Stirling Westrup
  2020-07-11 15:19 ` Hugo Mills
  2020-07-11 15:58 ` Andrei Borzenkov
  0 siblings, 2 replies; 4+ messages in thread
From: Stirling Westrup @ 2020-07-11 14:42 UTC (permalink / raw)
  To: linux-btrfs

I have a BTRFS built with two devices md0 and md1 on a server. I wish
to move as much data as will fit from md0 to md1, but I cannot figure
out a balance command that will do that.

My use case is a file server with a fixed number of hard drive slots
and two raids. md0 is a raid using most of the slots with small
drives, and md1 is a raid using the remaining slots with large drives.
I'm trying to shrink md0, so I can remove some small drives and put in
new large drives to add to md1.

I have read the notes on the balance command several times but I can't
figure out how to get it to do what I want, if it's even possible.

-- 
Stirling Westrup (he/him)
Programmer, Entrepreneur.
http://www.linkedin.com/in/swestrup
(+1) 514-626-0928

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

* Re: Rebalancing Question
  2020-07-11 14:42 Rebalancing Question Stirling Westrup
@ 2020-07-11 15:19 ` Hugo Mills
  2020-07-11 15:58 ` Andrei Borzenkov
  1 sibling, 0 replies; 4+ messages in thread
From: Hugo Mills @ 2020-07-11 15:19 UTC (permalink / raw)
  To: Stirling Westrup; +Cc: linux-btrfs

On Sat, Jul 11, 2020 at 10:42:30AM -0400, Stirling Westrup wrote:
> I have a BTRFS built with two devices md0 and md1 on a server. I wish
> to move as much data as will fit from md0 to md1, but I cannot figure
> out a balance command that will do that.
> 
> My use case is a file server with a fixed number of hard drive slots
> and two raids. md0 is a raid using most of the slots with small
> drives, and md1 is a raid using the remaining slots with large drives.
> I'm trying to shrink md0, so I can remove some small drives and put in
> new large drives to add to md1.
> 
> I have read the notes on the balance command several times but I can't
> figure out how to get it to do what I want, if it's even possible.

   Balance isn't the right tool for this. You can reduce the size that
the FS takes up on md0, using "btrfs fi resize 0:10G /mount/btrfs",
where the 0 is the device ID of md0 (see btrfs fi show), and the 10G
is the target size for the device. You can then use the mdadm tools to
reduce the size of md0 (but no smaller than 10G, in this example).

   I would definitely recommend reducing the FS by more than the
device, just to cope with any rounding errors in tooling.

   If you're removing md0 entirely from the FS, and have space to do
so, then btrfs dev delete is what you need -- but it sounds like
that's not the case here.

   Hugo.

-- 
Hugo Mills             | Great films about cricket: Monster's No-Ball
hugo@... carfax.org.uk |
http://carfax.org.uk/  |
PGP: E2AB1DE4          |

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

* Re: Rebalancing Question
  2020-07-11 14:42 Rebalancing Question Stirling Westrup
  2020-07-11 15:19 ` Hugo Mills
@ 2020-07-11 15:58 ` Andrei Borzenkov
  2020-07-14  4:47   ` Stirling Westrup
  1 sibling, 1 reply; 4+ messages in thread
From: Andrei Borzenkov @ 2020-07-11 15:58 UTC (permalink / raw)
  To: swestrup, linux-btrfs

11.07.2020 17:42, Stirling Westrup пишет:
> I have a BTRFS built with two devices md0 and md1 on a server. I wish
> to move as much data as will fit from md0 to md1, but I cannot figure
> out a balance command that will do that.
> 
> My use case is a file server with a fixed number of hard drive slots
> and two raids. md0 is a raid using most of the slots with small
> drives, and md1 is a raid using the remaining slots with large drives.
> I'm trying to shrink md0, so I can remove some small drives and put in
> new large drives to add to md1.
> 
> I have read the notes on the balance command several times but I can't
> figure out how to get it to do what I want, if it's even possible.
> 

You should be able to shrink md0 which will relocate data beyond new
size to another device(s). See example in btrfs-filesystem:


       $ btrfs filesystem resize -1G /path

       $ btrfs filesystem resize 1:-1G /path

       Shrink size of the filesystem’s device id 1 by 1GiB. The first
syntax expects a
       device with id 1 to exist, otherwise fails. The second is
equivalent and more
       explicit. For a single-device filesystem it’s typically not
necessary to specify the
       devid though.


This assumes you are using single or dup profiles, as other profiles
require at least two devices anyway and you may not be able to shrink
md0 too far.

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

* Re: Rebalancing Question
  2020-07-11 15:58 ` Andrei Borzenkov
@ 2020-07-14  4:47   ` Stirling Westrup
  0 siblings, 0 replies; 4+ messages in thread
From: Stirling Westrup @ 2020-07-14  4:47 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: linux-btrfs

Thank you! That looks like it would work.

On Sat, Jul 11, 2020 at 11:58 AM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>
> 11.07.2020 17:42, Stirling Westrup пишет:
> > I have a BTRFS built with two devices md0 and md1 on a server. I wish
> > to move as much data as will fit from md0 to md1, but I cannot figure
> > out a balance command that will do that.
> >
> > My use case is a file server with a fixed number of hard drive slots
> > and two raids. md0 is a raid using most of the slots with small
> > drives, and md1 is a raid using the remaining slots with large drives.
> > I'm trying to shrink md0, so I can remove some small drives and put in
> > new large drives to add to md1.
> >
> > I have read the notes on the balance command several times but I can't
> > figure out how to get it to do what I want, if it's even possible.
> >
>
> You should be able to shrink md0 which will relocate data beyond new
> size to another device(s). See example in btrfs-filesystem:
>
>
>        $ btrfs filesystem resize -1G /path
>
>        $ btrfs filesystem resize 1:-1G /path
>
>        Shrink size of the filesystem’s device id 1 by 1GiB. The first
> syntax expects a
>        device with id 1 to exist, otherwise fails. The second is
> equivalent and more
>        explicit. For a single-device filesystem it’s typically not
> necessary to specify the
>        devid though.
>
>
> This assumes you are using single or dup profiles, as other profiles
> require at least two devices anyway and you may not be able to shrink
> md0 too far.



-- 
Stirling Westrup (he/him)
Programmer, Entrepreneur.
http://www.linkedin.com/in/swestrup
(+1) 514-626-0928

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

end of thread, other threads:[~2020-07-14  4:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-11 14:42 Rebalancing Question Stirling Westrup
2020-07-11 15:19 ` Hugo Mills
2020-07-11 15:58 ` Andrei Borzenkov
2020-07-14  4:47   ` Stirling Westrup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox