New issue
Advanced search Search tips

Issue 858815 link

Starred by 27 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Enable disk resize

Project Member Reported by tbuck...@chromium.org, Jun 28 2018

Issue description

Today, 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.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9c8138f7b054c41bcb62d7e68805b739c873dd77

commit 9c8138f7b054c41bcb62d7e68805b739c873dd77
Author: Fergus Dall <sidereal@google.com>
Date: Mon Nov 19 01:03:40 2018

Add UMA for maximum disk image size

Currently we just set the maximum size the disk image can have to 90%
of the free space available when crostini is initially
installed. There has been talk of finding ways to allow this cap to be
increased after installation or overcommitting free disk space to avoid
leaving the user with an excessively small disk image.

This CL adds a metric recording how large the caps we impose are in
practice, which should give us more information about how significant
this issue is.

Bug: 858815
Change-Id: I2e2d01387a6969114308e21f32b147484c2ed8b1
Reviewed-on: https://chromium-review.googlesource.com/c/1337211
Commit-Queue: Fergus Dall <sidereal@google.com>
Reviewed-by: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609160}
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/chrome/browser/chromeos/crostini/crostini_manager.cc
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/chrome/browser/chromeos/crostini/crostini_manager.h
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/chrome/browser/chromeos/crostini/crostini_manager_unittest.cc
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/chrome/browser/ui/views/crostini/crostini_installer_view.cc
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/chrome/browser/ui/views/crostini/crostini_installer_view.h
[modify] https://crrev.com/9c8138f7b054c41bcb62d7e68805b739c873dd77/tools/metrics/histograms/histograms.xml

Labels: M-73
Owner: dverkamp@chromium.org
We can start with raw disks, maybe qcow later.
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.
Project Member

Comment 4 by bugdroid1@chromium.org, 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

Project Member

Comment 5 by bugdroid1@chromium.org, 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

Project Member

Comment 6 by bugdroid1@chromium.org, 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

Project Member

Comment 7 by bugdroid1@chromium.org, 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

Project Member

Comment 8 by bugdroid1@chromium.org, 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