Skip to content

block-meta: add btrfs filesystem resize support - #54

Open
Dh2Cool wants to merge 1 commit into
canonical:mainfrom
Dh2Cool:filsystem-btrfs-resize
Open

block-meta: add btrfs filesystem resize support#54
Dh2Cool wants to merge 1 commit into
canonical:mainfrom
Dh2Cool:filsystem-btrfs-resize

Conversation

@Dh2Cool

@Dh2Cool Dh2Cool commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • Add single-device btrfs support to storage-config v2 resizers (btrfs filesystem resize 1:<size> via a temporary mount).
  • Document btrfs as a supported resize filesystem type.
  • Add integration tests for resize up/down.

Test plan

  • tox -e py3 in Workshop (1552 passed)
  • pytest tests/integration/test_block_meta.py -k btrfs on LXD Ubuntu 24.04 VM

@Dh2Cool
Dh2Cool force-pushed the filsystem-btrfs-resize branch from d76f7e9 to bc9bbc8 Compare July 22, 2026 18:29

@dbungert dbungert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dhruv. The test plan on the PR mentions that smoke test script but that's not something that exists today and it's not in this PR, so we should probably remove mention of it, or, if you think it's useful, include it in this PR and we'll discuss.

Comment thread curtin/commands/block_meta_v2.py Outdated
Comment thread tests/integration/test_block_meta.py Outdated
@dbungert

Copy link
Copy Markdown
Member

Let's add a unit test case as well, please.

Also, let's ensure this case is handled - # Device id 1 is the default for single-device filesystems. - please raise in the case where we're attempting a resize on a multi-device filesystem.

@Dh2Cool

Dh2Cool commented Jul 23, 2026

Copy link
Copy Markdown
Author

Let's add a unit test case as well, please.

Also, let's ensure this case is handled - # Device id 1 is the default for single-device filesystems. - please raise in the case where we're attempting a resize on a multi-device filesystem.

Added a unit test for btrfs in TestPartitionNeedsResize, matching the existing resize cases.

@Dh2Cool
Dh2Cool requested a review from dbungert July 23, 2026 00:29
self.sfdisk_part_info)
self.assertEqual(expected, actual)

def test_partition_resize_btrfs(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is almost identical to the one above - if we parameterize it, we can cover the btrfs case with only a few new lines of code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the parameterized.expand function to combine them (ext4, btrfs), similarly done in other files like integration/test_block_meta.py
hopefully this is ok with convention

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about this one live, this one should be resolved in the next update

with tempfile.TemporaryDirectory(prefix='curtin-btrfs-') as mountpoint:
with util.mount(path, mountpoint):
util.subp(['btrfs', 'filesystem', 'resize',
'1:{}'.format(size), mountpoint])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder - let's ensure this case is handled - # Device id 1 is the default for single-device filesystems. - please raise in the case where we're attempting a resize on a multi-device filesystem.

Does that need handling as well probert side?

@dbungert
dbungert requested a review from ogayot July 24, 2026 20:06
@Dh2Cool
Dh2Cool force-pushed the filsystem-btrfs-resize branch from db7f478 to 81f757a Compare July 24, 2026 21:33
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.

2 participants