Skip to content

os/bluestore: asok command to expand block device and Bluestore while OSD is running - #66344

Merged
ifed01 merged 22 commits into
ceph:mainfrom
JoshuaGabriel:68797-bdev-expand-admin
Jun 30, 2026
Merged

ifed01 merged 22 commits into
ceph:mainfrom
JoshuaGabriel:68797-bdev-expand-admin

Conversation

@JoshuaGabriel

Copy link
Copy Markdown
Contributor

implements support for expanding BlueStore block devices while the OSD is running. The implementation expands allocators and freelist managers in-place rather than recreating them.

ceph tell osd.X bluestore bluefs-bdev-expand

https://tracker.ceph.com/issues/68797


I didn't touch any of the tree allocators because I'm assuming I can just update device_size.
There is also a lot of redundant code that I copied from bluestore::expand_devices that I'm working to cleanup.

the way I was testing this locally,

truncate -s 150G dev/osd0/block
truncate -s 50G dev/osd0/block.db

./bin/ceph tell osd.0 bluestore bluefs-bdev-expand
0 : device size 0x3e800000(1000 MiB) : using 0x1900000(25 MiB)
1 : device size 0x40000000(1 GiB) : using 0xe00000(14 MiB)
2 : device size 0x1900000000(100 GiB) : using 0xd9000(868 KiB) : bluefs used 0x0(0 B) : non-bluefs used 0xd9000(868 KiB)
Expanding DB/WAL...
0 : nothing to do, skipped
1 : Expanding to 0xc80000000(50 GiB)
1 : size updated to 0xc80000000(50 GiB)
2 : Expanding to 0x2580000000(150 GiB)
2 : size updated to 0x2580000000(150 GiB)


then checking outputs of 
./bin/ceph tell osd.0 bluestore bluefs device info
{
    "dev": {
        "device": "BDEV_WAL",
        "total": 1048576000,
        "free": 1022361600,
        "bluefs_used": 26214400
    },
    "dev": {
        "device": "BDEV_DB",
        "total": 53687091200,
        "free": 53672411136,
        "bluefs_used": 14680064
    },
    "dev": {
        "device": "BDEV_SLOW",
        "total": 161061273600,
        "free": 161060212736,
        "bluefs_used": 0,
        "bluefs max available": 161059897344
    }
}

./bin/ceph tell osd.0 bluestore bluefs-bdev-expand

separately I would run this

./bin/unittest_fastbmap_allocator --gtest_filter="TestAllocatorLevel02.test_expand*"

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@JoshuaGabriel JoshuaGabriel mentioned this pull request Nov 20, 2025
4 of 14 tasks
@JoshuaGabriel
JoshuaGabriel marked this pull request as ready for review November 20, 2025 21:54
@JoshuaGabriel
JoshuaGabriel requested a review from a team as a code owner November 20, 2025 21:54
@anthonyeleven

Copy link
Copy Markdown
Contributor

Nice!

@JoshuaGabriel
JoshuaGabriel force-pushed the 68797-bdev-expand-admin branch from 87efc20 to f75f5ff Compare November 21, 2025 21:26
@JoshuaGabriel JoshuaGabriel changed the title asok command to expand block device and Bluestore while OSD is running os/bluesure: asok command to expand block device and Bluestore while OSD is running Nov 21, 2025
@JoshuaGabriel JoshuaGabriel changed the title os/bluesure: asok command to expand block device and Bluestore while OSD is running os/bluestore: asok command to expand block device and Bluestore while OSD is running Nov 21, 2025
@JoshuaGabriel
JoshuaGabriel force-pushed the 68797-bdev-expand-admin branch from f75f5ff to 422b331 Compare November 21, 2025 23:03
@ifed01

ifed01 commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

qa/standalone/osd/osd-bluefs-volume-ops.sh has some tests for offline device expansion, mind adding a few tests for online one?

Comment thread src/blk/kernel/KernelDevice.cc Resolved
Comment thread src/os/bluestore/BlueStore.cc Resolved
Comment thread src/os/bluestore/BlueStore.cc Resolved
Comment thread src/os/bluestore/BlueFS.cc Resolved
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

@ifed01 this should be good to review again

@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Comment thread src/os/bluestore/BitmapAllocator.cc Resolved
Comment thread src/os/bluestore/BlueStore.cc Resolved
Comment thread src/os/bluestore/BlueStore.cc Resolved
Comment thread src/os/bluestore/BlueFS.cc Resolved
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

Just a rebase, does not include changes from the comments

@JoshuaGabriel
JoshuaGabriel force-pushed the 68797-bdev-expand-admin branch from f21af6c to 4b3603a Compare March 3, 2026 19:47
@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

@ifed01 this should be good for a re-review

Comment thread src/os/bluestore/BlueStore.cc Resolved
Comment thread src/os/bluestore/BlueFS.cc Resolved
Comment thread src/os/bluestore/BlueStore.cc Outdated
// from the out-of-space state at DB/shared volume(s)
// Opening in R/W mode might cause extra space allocation
// which is effectively a show stopper for volume expansion.
r = _open_db_and_around(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry if we discussed that before and I forget the outcome but this looks like a regression.
See the comment above _open_db_and_around() call - the original offline implementation did open DB in read-only mode first to avoid potential allocations from RocksDB which could happen when opening in R/W mode. Those unsatisfied allocations might assert if not enough space is available and this becomes a dead loop - OSD lacks free space and offline expansion is unable to proceed due to that.
To work around that once extra space had been added to allocator (via some trick with before_expansion_bdev_size var) the original expansion proceeded with reopening DB in R/W mode and finalizing all the changes.
No that's lost which is wrong IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we discussed it before but this is a regression, that explanation makes sense to me.

changed it back here: cabf5f1

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@JoshuaGabriel
JoshuaGabriel force-pushed the 68797-bdev-expand-admin branch from 2ce2288 to cabf5f1 Compare March 16, 2026 19:36
adds support for expanding the device capacity while fs is online

Signed-off-by: Joshua Blanch <[email protected]>
expands bluestore and bluefs while OSD is running.
Instead of recreating allocators, expands allocator and FM
in-place.

ceph tell osd.X bluestore bluefs-bdev-expand

Signed-off-by: Joshua Blanch <[email protected]>
Refactors device expansion to use a expand_devices()
that handles both online (admin socket) and offline (ceph-bluestore-tool)
use cases.

Signed-off-by: Joshua Blanch <[email protected]>
verify online device expansion via admin socket works correctly

Signed-off-by: Joshua Blanch <[email protected]>
guard bluefs->expand_device for online-only
fixes offline expansion by reopening db from r/o to r/w
fixes int64_t/uint64_t type mismatch for old_size

Signed-off-by: Joshua Blanch <[email protected]>
expanding allocator before opening for offline path
fixes to comments and null check

Signed-off-by: Joshua Blanch <[email protected]>
@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

jenkins test api

@JoshuaGabriel

Copy link
Copy Markdown
Contributor Author

jenkins test windows

1 similar comment
@aclamk

aclamk commented May 19, 2026

Copy link
Copy Markdown
Contributor

jenkins test windows

@Jayaprakash-ibm

Copy link
Copy Markdown
Contributor

@ifed01
ifed01 merged commit a65fd3b into ceph:main Jun 30, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/28443428682

batrick pushed a commit that referenced this pull request Aug 6, 2026
Reproduces: https://tracker.ceph.com/issues/75852
Signed-off-by: Igor Fedotov <[email protected]>
(cherry picked from commit f88927d)

 Conflicts:
	qa/standalone/osd/osd-bluefs-volume-ops.sh
  Trivial caused by no backport for
#66344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants