Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filesystem resize documentation improvements #775

Closed
wants to merge 2 commits into from

Conversation

calestyo
Copy link
Contributor

@calestyo calestyo commented Apr 8, 2024

Please review.

Further TODO:

  • I think it would be valuable to tell people in which steps they can reasonable shrink/enlarge a fs. In some try, where I made the underlying partition on purpose one sector (512B) larger and then tried resize max, btrfs didn't claim that 512B.
    I’d blindly guess it's one sectorsize as given by btrfs inspect-internal dump-super, what btrfs needs at least?
    If someone confirms I could make another commit that adds that information.
  • For sysadmins which are bad at mental arithmetic, it would be nice if they'd knew, whether btrfs warns/errors if the underlying device is smaller than the size that it wants to use of it? Does it do so, e.g. at mount time, fskc or even while mounted?
    If so I could add that as well.

Being able to expand (“can”) the partition beforehand is not enough – it must
actually be done.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
A user who wants to shrink a btrfs filesystem within some other logical device
(like a partition) will likely want to adapt the size of the underlying device,
too.

This commit adds documentation that describes how the length of the portion that
btrfs uses of some device can be found out.

Thanks go out to Roman Mamedov <rm@romanrm.net> for hinting
`btrfs filesystem show` as alternative command.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
@kdave
Copy link
Owner

kdave commented Apr 18, 2024

There are probably several things that could affect the shrink/grow increments. The minimum is one sectorsize, we had bugs where convert created a filesystem with non-sectorsize aligned size and then allocator complained. There's a round down step to make sure even such converted filesystems work. The same applies for resize.
Another alignment is the stripe size that is hardcoded to 64K. The zoned mode uses that as the absolute minimum that would be a valid value for zone size or alignment.

The documentation update looks ok, so PR added to devel, but I guess it can be still improved. The rounding can be detected and at least mentioned when the btrfs command is started, otherwise this is internal to the kernel iplementation and is not logged.

If you have further need for clarification please open a new issue as comments to PRs could get lost. Thanks.

@kdave kdave closed this Apr 18, 2024
@kdave kdave added this to the v6.8.1 milestone Apr 18, 2024
kdave pushed a commit that referenced this pull request Apr 18, 2024
Being able to expand (“can”) the partition beforehand is not enough – it must
actually be done.

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
kdave pushed a commit that referenced this pull request Apr 18, 2024
… on a device

A user who wants to shrink a btrfs filesystem within some other logical
device (like a partition) will likely want to adapt the size of the
underlying device, too.

This commit adds documentation that describes how the length of the
portion that btrfs uses of some device can be found out.

Thanks go out to Roman Mamedov <rm@romanrm.net> for hinting `btrfs
filesystem show` as alternative command.

Note: the granularity is one sectorsize and the input values are
silently rounded down to avoid bugs from converted filesystems that
would not adhere to the native btrfs constraints.

[ci skip]

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
kdave pushed a commit that referenced this pull request Apr 19, 2024
Being able to expand (“can”) the partition beforehand is not enough – it must
actually be done.

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
kdave pushed a commit that referenced this pull request Apr 19, 2024
… on a device

A user who wants to shrink a btrfs filesystem within some other logical
device (like a partition) will likely want to adapt the size of the
underlying device, too.

This commit adds documentation that describes how the length of the
portion that btrfs uses of some device can be found out.

Thanks go out to Roman Mamedov <rm@romanrm.net> for hinting `btrfs
filesystem show` as alternative command.

Note: the granularity is one sectorsize and the input values are
silently rounded down to avoid bugs from converted filesystems that
would not adhere to the native btrfs constraints.

[ci skip]

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
kdave pushed a commit that referenced this pull request Apr 30, 2024
Being able to expand (“can”) the partition beforehand is not enough – it must
actually be done.

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
kdave pushed a commit that referenced this pull request Apr 30, 2024
… on a device

A user who wants to shrink a btrfs filesystem within some other logical
device (like a partition) will likely want to adapt the size of the
underlying device, too.

This commit adds documentation that describes how the length of the
portion that btrfs uses of some device can be found out.

Thanks go out to Roman Mamedov <rm@romanrm.net> for hinting `btrfs
filesystem show` as alternative command.

Note: the granularity is one sectorsize and the input values are
silently rounded down to avoid bugs from converted filesystems that
would not adhere to the native btrfs constraints.

[ci skip]

Pull-request: #775
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: David Sterba <dsterba@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants