Skip to content

[PATCH v3] btrfs-progs: add slack space for mkfs --shrink #981

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

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

loemraw
Copy link

@loemraw loemraw commented Apr 23, 2025

This patch adds a flag --shrink-slack-size SIZE to the mkfs.btrfs allowing users to specify slack when shrinking the filesystem. Previously if you wanted to use --shrink and include extra space in the filesystem you would need to use btrfs resize, however, this requires mounting the filesystem which requires CAP_SYS_ADMIN.

The new syntax is:
mkfs.btrfs --shrink --shrink-slack-size SIZE

Where slack size is an argument specifying the desired free space to add to a shrunk fs. If not provided, the default slack size is 0.

V3:

  • warn if block device size < fs size V2:
  • change --shrink[=SLACK SIZE] to --shrink-slack-size SIZE
  • check for slack size alignment
  • fix formatting
  • remove new_size > device size warning message

This patch adds a flag `--shrink-slack-size SIZE` to the mkfs.btrfs
allowing users to specify slack when shrinking the filesystem.
Previously if you wanted to use --shrink and include extra space in the
filesystem you would need to use btrfs resize, however, this requires
mounting the filesystem which requires CAP_SYS_ADMIN.

The new syntax is:
`mkfs.btrfs --shrink --shrink-slack-size SIZE`

Where slack size is an argument specifying the desired
free space to add to a shrunk fs. If not provided, the default
slack size is 0.

V3:
- warn if block device size < fs size
V2:
- change --shrink[=SLACK SIZE] to --shrink-slack-size SIZE
- check for slack size alignment
- fix formatting
- remove new_size > device size warning message
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.

1 participant