-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Disk resize command #2034
Disk resize command #2034
Conversation
growpart "/dev/${DEVICE_NAME}" 1 || true | ||
# Only resize when filesystem is in a healthy state | ||
if e2fsck -f -p "/dev/disk/by-label/lima-${DISK_NAME}"; then | ||
resize2fs "/dev/disk/by-label/lima-${DISK_NAME}" || true |
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.
Should probably check for an ext2 (et al) filesystem, perhaps also support xfs ?
xfs_growfs /mount/point -D size
EDIT: Apparently -d grows to the biggest.
I guess e2fsck would have failed. (it is xfs_repair
)
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.
xfs_repair
repairs FS but e2fsck
just only checks it. I think need to use fsck.$FSTYPE
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.
I added xfs_growfs
and tested ext2/3/4
and xfs
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.
I thought you wanted to do a repair, since you did e2fsck -p
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.
I did not plan to repair the file system, but only to check the functionality before increasing the size. Same code can be found at 04-persistent-data-volume.sh
e393a5e
to
9ef38d3
Compare
pkg/store/disk.go
Outdated
// inspectDiskSize attempts to inspect the disk size by itself, | ||
// and falls back to inspectDiskSizeWithQemuImg on an error. | ||
func inspectDiskSize(fName string) (int64, error) { | ||
// inspectDiskSizeAndFormat attempts to inspect the disk size and format by itself, |
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.
// inspectDiskSizeAndFormat attempts to inspect the disk size and format by itself, | |
// inspectDisk attempts to inspect the disk size and format by itself, |
Looks good, but please consider squashing commits |
Signed-off-by: Nikita Vasilchenko <n@mintscale.ru>
259664d
to
65c36a7
Compare
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.
Thanks
CI not working? |
The size of the created disk cannot be changed now. Even if the user resizes the disk using
qemu-img resize
he needs to run some commands in VM to grow the partition and resize the FS.I added command
limactl disk resize
which can resize disk of a stopped vm using qemu-img.Also I added parsing a format of an existing disk and render it in
limactl ls
In cidata was added commands to resize the partition and the FS across all attached disks.
Shrinking of a disk is a danger operation, so i explicitly disallow it