-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Partition resizing #19385
storage: Partition resizing #19385
Conversation
111fb36
to
44391ef
Compare
f884f75
to
59d8b5e
Compare
22b6ac4
to
cd48ea2
Compare
cd48ea2
to
8ec73eb
Compare
8ec73eb
to
796f130
Compare
796f130
to
7243126
Compare
block = client.lvols_block[lvol_or_part.path]; | ||
name = lvol_or_part.Name; | ||
orig_size = lvol_or_part.Size; | ||
max_size = pool ? pool.Size * 3 : lvol_or_part.Size + vgroup.FreeSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
|
||
const usage = get_active_usage(client, block && info.grow_needs_unmount ? block.path : null, _("grow")); | ||
|
||
if (usage.Blocking) { | ||
dialog_open({ | ||
Title: cockpit.format(_("$0 is in use"), lvol.Name), | ||
Title: cockpit.format(_("$0 is in use"), name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
info.grow_needs_unmount, | ||
vals.passphrase || recovered_passphrase) | ||
return (lvol_or_part_and_fsys_resize(client, lvol_or_part, | ||
to_fit ? grow_size : vals.size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
|
||
const usage = get_active_usage(client, block && !to_fit && info.shrink_needs_unmount ? block.path : null, | ||
_("shrink")); | ||
|
||
if (usage.Blocking) { | ||
dialog_open({ | ||
Title: cockpit.format(_("$0 is in use"), lvol.Name), | ||
Title: cockpit.format(_("$0 is in use"), name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
to_fit ? shrink_size : vals.size, | ||
to_fit ? false : info.shrink_needs_unmount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test. Details
content_size: fsys.Size | ||
}); | ||
} | ||
|
||
if (vdo && (lvol.Size - vdo.physical_size - crypto_overhead) > vgroup.ExtentSize) { | ||
if (vdo && (size - vdo.physical_size - crypto_overhead) > min_change) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
enter_warning(path, { | ||
warning: "unused-space", | ||
volume_size: lvol.Size - crypto_overhead, | ||
volume_size: size - crypto_overhead, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test. Details
Unrelated issues: BTRFS can't set a label, when mounted, can when unmounted. But I can do it, so this seems to be a udisks/libblockdev bug:
Works fine and changes in cockpit. Libblockdev also uses this but with a mountpoint! So maybe this is a recent change in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks fairly trivial and codewise it should be fine. I do have some concerns with the functionality itself:
For example I grow a ntfs
paritition which is mounted:
Why is it not mounted back, at the end? Or do we never do this for a good reason?
Shrinking/growing does give me this "warning" which looks a bit like shrinking or growing failed
While shrinking I am allowed to shrink to a too small amount and I get this rather large error:
I suppose libblockdev does not really record the minimum filesystem size or can calculate that for us? But hmmm I have 180 MB in use at the moment, so maybe we should set the shrink limit to FS size in use + ~ 500 MB for some FS metdata? IIRC XFS requires a minimum of 128 MB?
With shrinking NTFS I would be a bit worried about my windows OS. Should we show a warning sign anywhere? I am already a bit surprised to see resizing working fine especially shrinking!
I tested shrinking/growing a LUKS encrypted FS, this went fine! Maybe this should also be an automated test?
I tested BTRFS, it can't be shrink/grown. So this sounds like something we can implement in libblockdev? Or is that more a udisks thing? Either way growing BTRFS should be safe. Unsure about shrinking. I myself would consider shrinking a filesystem to always be an unsafe operation and would recommend to first make backups (which you already should).
Let's test something obscure like F2FS, this does not seem to be recognized by Cockpit?! Why would that be? Does udisks only know about filesystems libblockdev knows?
[root@fedora-38-127-0-0-2-2201 ~]# udisksctl info --block-device /dev/sda1
/org/freedesktop/UDisks2/block_devices/sda1:
org.freedesktop.UDisks2.Block:
Configuration: []
CryptoBackingDevice: '/'
Device: /dev/sda1
DeviceNumber: 2049
Drive: '/org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_DISK0'
HintAuto: false
HintIconName:
HintIgnore: false
HintName:
HintPartitionable: true
HintSymbolicIconName:
HintSystem: true
Id: by-id-scsi-0QEMU_QEMU_HARDDISK_DISK0-part1
IdLabel:
IdType:
IdUUID:
IdUsage:
IdVersion:
MDRaid: '/'
MDRaidMember: '/'
PreferredDevice: /dev/sda1
ReadOnly: false
Size: 1833959424
Symlinks: /dev/disk/by-diskseq/4-part1
Anyway, Cockpit allows to grow the partition, not the filesystem so that's fine.
NILFS2 can't be grown or shrink, there is nilfs-resize
but that simply isn't implemented in libblockdev (yet). You can however now not enlarge the partition, is that a problem?
<br /> | ||
<Alert variant="warning" | ||
isInline | ||
title={_("This partition is not completely used by its content.")}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds more like a @garrett question, but maybe it should be more like This partition has free space
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text was already there for logical volumes, so ignore me.
Yes, good point. I will check this.
Good idea!
We test a lot more resizing in check-storage-lvm2, more filesystem types and also LUKS.
Yeah, I think it is mostly libblockdev. UDisk2 reports which filesystem types support what, and Cockpit goes along with it.
Cockpit should work with anything that UDisks2 supports. We could test more obscure ones, sure. |
Oh I did not suggest that hehe, it seems UDisk2 does not report the filesystem type for F2FS, so that was my remark. Maybe checking if btrfs can't be resized would be good? So we would know when it would work. Reading libblockdev, it should actually be supported in the There is a test in udisks for it:
|
One thing I forgot to test is, swap? What does Udisks offer for that? |
For the release-note it would be nice to get a screenshot. |
Demo: https://www.youtube.com/watch?v=rZ2ZExzkIto
Storage: Partitions can be resized
Cockpit can now also resize partitions, including their content such as filesystems or LUKS containers.