Skip to contentSkip to conversation

Automatic balance after mkfs?

DISCUSSION Holger Hoffstätte 5 participants 5 messages Jun 16, 2015 – Jun 26, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Forking from the other thread..

Quoted 3 lines · Hugo Mills

Yes. It's an artefact of the way that mkfs works. If you run a
balance on those chunks, they'll go away. (btrfs balance start -dusage=0 -musage=0 /mountpoint)

Since I had to explain this very same thing to a new btrfs-using friend just yesterday I wondered if it might not make sense for mkfs to issue a general balance after creating the fs? It should be simple enough (just issue the balance ioctl?) and not have any negative side effects.

Just doing such a post-mkfs cleanup automatically would certainly reduce the number of times we have to explain the this. :)

Any reasons why we couldn't/shouldn't do this?

-h

#1 lore raw
Quoted 14 lines · Holger Hoffstätte

Forking from the other thread..

Quoted 3 lines · Hugo Mills

Yes. It's an artefact of the way that mkfs works. If you run a
balance on those chunks, they'll go away. (btrfs balance start -dusage=0 -musage=0 /mountpoint)

Since I had to explain this very same thing to a new btrfs-using friend just yesterday I wondered if it might not make sense for mkfs to issue a general balance after creating the fs? It should be simple enough (just issue the balance ioctl?) and not have any negative side effects.

Quoted 5 lines

Just doing such a post-mkfs cleanup automatically would certainly reduce the number of times we have to explain the this. :)

Any reasons why we couldn't/shouldn't do this?

Following the same line of thinking, is there any reason we couldn't just rewrite mkfs to get rid of this legacy behavior?

#4 lore raw
In reply to Holger Hoffstätte
Quoted 5 lines · Holger Hoffstätte

Forking from the other thread..

On Tue, 16 Jun 2015 12:25:45 +0000, Hugo Mills wrote:

Quoted 8 lines
Quoted 3 lines

Yes. It's an artefact of the way that mkfs works. If you run a
balance on those chunks, they'll go away. (btrfs balance start -dusage=0 -musage=0 /mountpoint)

Since I had to explain this very same thing to a new btrfs-using friend just yesterday I wondered if it might not make sense for mkfs to issue a general balance after creating the fs? It should be simple enough (just issue the balance ioctl?) and not have any negative side effects.

Mount, balance, unmount... You can't balance on an unmounted FS.
You'd also have to write something to the FS (see below).

Quoted 4 lines

Just doing such a post-mkfs cleanup automatically would certainly reduce the number of times we have to explain the this. :)

Any reasons why we couldn't/shouldn't do this?

On an empty filesystem, it used to throw away the RAID
configuration, which was identified from the existing chunks on the FS. With no chunks remaining, the RAID configuration reverted to single all round (IIRC). I don't know if that's been fixed since those days, but it's something to be wary of, at the very least.

I've added the question as an entry to the FAQ, anyway.

Hugo.

Signature · 4 lines
Hugo Mills             | vi vi vi: the Editor of the Beast.
hugo@... carfax.org.uk |
http://carfax.org.uk/  |
PGP: E2AB1DE4          |
#2 lore raw
In reply to Austin S Hemmelgarn

Austin S Hemmelgarn wrote on 2015/06/16 09:21 -0400:

Quoted 15 lines · Holger Hoffstätte
Quoted 14 lines

Forking from the other thread..

Quoted 3 lines · Hugo Mills

Yes. It's an artefact of the way that mkfs works. If you run a
balance on those chunks, they'll go away. (btrfs balance start -dusage=0 -musage=0 /mountpoint)

Since I had to explain this very same thing to a new btrfs-using friend just yesterday I wondered if it might not make sense for mkfs to issue a general balance after creating the fs? It should be simple enough (just issue the balance ioctl?) and not have any negative side effects.

Quoted 9 lines
Quoted 5 lines

Just doing such a post-mkfs cleanup automatically would certainly reduce the number of times we have to explain the this. :)

Any reasons why we couldn't/shouldn't do this?

Following the same line of thinking, is there any reason we couldn't just rewrite mkfs to get rid of this legacy behavior?

Compared to the more complex auto balance, rewrite mkfs is a much better idea.

The original mkfs seems easy for developers, but bad for users.

I like the idea and I'll try to implment it if I have spare time.

Thanks.
Qu

#3 lore raw
Quoted 9 lines · Qu Wenruo
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Yes. It's an artefact of the way that mkfs works. If you run a
balance on those chunks, they'll go away. (btrfs balance start -dusage=0 -musage=0 /mountpoint)

Since I had to explain this very same thing to a new btrfs-using friend just yesterday I wondered if it might not make sense for mkfs to issue a general balance after creating the fs? It should be simple enough (just issue the balance ioctl?) and not have any negative side effects.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Just doing such a post-mkfs cleanup automatically would certainly reduce the number of times we have to explain the this. :)

Any reasons why we couldn't/shouldn't do this?

Following the same line of thinking, is there any reason we couldn't just rewrite mkfs to get rid of this legacy behavior?

The 'single' blockgroups on multidevice filesystem are considered a bug in mkfs, an annoying and long running one.

Quoted 2 lines

Compared to the more complex auto balance, rewrite mkfs is a much better idea.

Balance is a workaround besides that it requires mouting.

Quoted 1 line

The original mkfs seems easy for developers, but bad for users.

I'd argue that mkfs is primarily for users.