Enable disk resize |
||
Issue descriptionToday, we give the container up to 90% of free disk space, which for some users can be very little. We should allow resizing the disk to take advantage of users freeing up space or to shrink as needed.
,
Nov 19
We can start with raw disks, maybe qcow later.
,
Nov 19
We'll need a few pieces for this: - a new crosvm vm_control message to ftruncate() the disk image to the new size and notify the guest to re-read the size via a virtio config interrupt - some mechanism to run 'btrfs filesystem resize' inside the guest Growing the disk should be pretty easy - we can send the 'resize disk' vm_control first and wait for it to finish, then 'btrfs filesystem resize max' to use the newly-available space. We put the BTRFS filesystem directly on the raw block device, so there is no partition to resize, which simplifies things. Shrinking is a little more complicated, since we need to shrink the FS first (making sure it is actually successful), and then figure out exactly how much free space we can remove from the end of the disk. Since the disk is thinly provisioned, it might be simpler to only support growing (not shrinking) initially, since that should always be safe.
,
Jan 6
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/6d47e1b0056d5175a4ae67bf4469ed5c83081c84 commit 6d47e1b0056d5175a4ae67bf4469ed5c83081c84 Author: Daniel Verkamp <dverkamp@chromium.org> Date: Sun Jan 06 04:08:26 2019 sys_util: add set_len() trait Generalize file_sync into file_traits so that we can add another wrapper, this time for the set_len() method implemented directly on File. This will also be implemented on QcowFile. BUG=chromium:858815 TEST=build_test Change-Id: I43fbd1968a844c8cac359973a63babcc26942204 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394148 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> [modify] https://crrev.com/6d47e1b0056d5175a4ae67bf4469ed5c83081c84/sys_util/src/lib.rs [add] https://crrev.com/6d47e1b0056d5175a4ae67bf4469ed5c83081c84/sys_util/src/file_traits.rs [delete] https://crrev.com/d1eceeca7bfd12d4d1236346d7cdcc89b5e949e2/sys_util/src/file_sync.rs
,
Jan 6
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/e57d906dbb2cfcccd491418b0a0c674a4197cf0c commit e57d906dbb2cfcccd491418b0a0c674a4197cf0c Author: Daniel Verkamp <dverkamp@chromium.org> Date: Sun Jan 06 04:08:26 2019 qcow: add no-op set_len() for QcowFile We won't support resizing a QcowFile for now, since it would require resizing refcount and L1 tables. BUG=chromium:858815 TEST=build_test Change-Id: Ia108e07be8b06b6fbe81838831a8ecbffdfb341c Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394149 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> [modify] https://crrev.com/e57d906dbb2cfcccd491418b0a0c674a4197cf0c/qcow/src/qcow.rs
,
Jan 6
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/2f0318fc81f0aba9e45897915a0a606edf89271f commit 2f0318fc81f0aba9e45897915a0a606edf89271f Author: Daniel Verkamp <dverkamp@chromium.org> Date: Sun Jan 06 04:08:27 2019 devices: block: build config space on demand This will allow the config space to change when a disk resize takes place. BUG=chromium:858815 TEST=Boot Termina on kevin Change-Id: I115a7923097c3fd1f31535e9c48c87caa32f99d7 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394150 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> [modify] https://crrev.com/2f0318fc81f0aba9e45897915a0a606edf89271f/devices/src/virtio/block.rs
,
Jan 6
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/70eb15dbb7cca5672c6e37e0f1853bf5b47c5a78 commit 70eb15dbb7cca5672c6e37e0f1853bf5b47c5a78 Author: Daniel Verkamp <dverkamp@chromium.org> Date: Sun Jan 06 04:08:27 2019 devices: block: protect disk_size with a mutex This will allow the disk size to be changed from the worker thread during resize operations. BUG=chromium:858815 TEST=build_test Change-Id: I0b2e1a057831856b44f19c2ba30b4dd1ffdeafc3 Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394151 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> [modify] https://crrev.com/70eb15dbb7cca5672c6e37e0f1853bf5b47c5a78/devices/src/virtio/block.rs
,
Jan 16
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/92f73d73d04bdc973fe89e2c1682a1c3cc03fe49 commit 92f73d73d04bdc973fe89e2c1682a1c3cc03fe49 Author: Daniel Verkamp <dverkamp@chromium.org> Date: Wed Jan 16 09:46:54 2019 devices: block: add resize VmControl request This allows manual resizing of block devices at runtime via the command line ('crosvm disk resize <index> <size>'). The virtio config interrupt is asserted when the disk size changes so that the guest driver can update the block device to the updated size. Currently, there is no automatic policy for resizing disks - that will be implemented in another change. Additionally, this resize operation just changes the size of the block device; the filesystem will need to be resized by the guest (e.g. via the 'btrfs filesystem resize' command) as a separate step either before (shrinking) or after (expanding) the disk resize operation. BUG=chromium:858815 TEST=Start crosvm with a control socket (-s) and resize the disk with 'crosvm disk resize' from another shell. Change-Id: I01633a7af04bfbaffbd27b9227274406d2a2b9cb Signed-off-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1394152 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> [modify] https://crrev.com/92f73d73d04bdc973fe89e2c1682a1c3cc03fe49/src/linux.rs [modify] https://crrev.com/92f73d73d04bdc973fe89e2c1682a1c3cc03fe49/vm_control/src/lib.rs [modify] https://crrev.com/92f73d73d04bdc973fe89e2c1682a1c3cc03fe49/src/main.rs [modify] https://crrev.com/92f73d73d04bdc973fe89e2c1682a1c3cc03fe49/devices/src/virtio/block.rs |
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Nov 19