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

storage: Always resize filesystems and LUKS to the maximum possible #19514

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions pkg/storaged/resize.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ function lvol_or_part_and_fsys_resize(client, lvol_or_part, size, offline, passp

function fsys_resize() {
if (fsys) {
// When growing a filesystem, always grow it to fill its
// block device. This is always the right thing to do in
// Cockpit.
//
const resize_size = (size > orig_size) ? 0 : size - crypto_overhead;

// HACK - https://bugzilla.redhat.com/show_bug.cgi?id=1934567
//
// block_fsys.MountedAt might be out of synch with reality
Expand All @@ -87,9 +93,9 @@ function lvol_or_part_and_fsys_resize(client, lvol_or_part, size, offline, passp
// When doing an offline resize, we need to first repair the filesystem.
if (!is_mounted) {
return (fsys.Repair({ })
.then(function () { return fsys.Resize(size - crypto_overhead, { }) }));
.then(() => fsys.Resize(resize_size, { })));
} else {
return fsys.Resize(size - crypto_overhead, { });
return fsys.Resize(resize_size, { });
}
}));
} else if (vdo) {
Expand Down Expand Up @@ -119,11 +125,17 @@ function lvol_or_part_and_fsys_resize(client, lvol_or_part, size, offline, passp
}

function crypto_resize() {
// When growing a LUKS device, always grow it to fill its
// block device. This is always the right thing to do in
// Cockpit.
//
const resize_size = (size > orig_size) ? 0 : size - crypto_overhead;

if (crypto) {
const opts = { };
if (passphrase)
opts.passphrase = { t: "s", v: passphrase };
return crypto.Resize(size - crypto_overhead, opts);
return crypto.Resize(resize_size, opts);
} else {
return Promise.resolve();
}
Expand Down