3

After resizing the disk, root partition did not take more space that is available.

When running

fdisk -l

on remote VM result is :

The backup GPT table is not on the end of the device. This problem will be corrected by write.
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: XXXXXX-XXXXX-XXX-XXX-XXXX

Device       Start      End  Sectors  Size Type
/dev/sda1  8704000 67108830 58404831 27.9G Microsoft basic data
/dev/sda2    20480    53247    32768   16M ChromeOS kernel
/dev/sda3  4509696  8703999  4194304    2G ChromeOS root fs
/dev/sda4    53248    86015    32768   16M ChromeOS kernel
/dev/sda5   315392  4509695  4194304    2G ChromeOS root fs
/dev/sda6    16448    16448        1  512B ChromeOS kernel
/dev/sda7    16449    16449        1  512B ChromeOS root fs
/dev/sda8    86016   118783    32768   16M Microsoft basic data
/dev/sda9    16450    16450        1  512B ChromeOS reserved
/dev/sda10   16451    16451        1  512B ChromeOS reserved
/dev/sda11      64    16447    16384    8M BIOS boot
/dev/sda12  249856   315391    65536   32M EFI System

I saw lot of answers saying that I should use growpart command, but this command is not available and it seems that in containerOS you cannot install anything. I tried anyway yum, apt, apt-get, rpm without success.

I digged in Google Documentation, but did not find anything related with ContainerOS

The only workaround I found is to restart the VM, but is there any alternative that does not involve a restart ?

Woody
  • 809
  • 8
  • 21
  • how exactly did you resize the image? I can't seem to find a place to resize the default images provided by google – Paddie Apr 24 '20 at 07:03

2 Answers2

15

After resizing the disk, root partition did not take more space that is available.

I believe you are doing an online resizing of the disk, right? If so, you can reboot your Container-Optimized OS (COS) machine after the resize. After reboot, the filesystem will be automatically resized to fix your disk. What's happening behind the scene, is that everytime COS boot up, resize-stateful-partition.service will handle this logic for you.

If you cannot easily reboot the COS VM, you could try run sudo /usr/share/cloud/resize-stateful, which should also work.

Xuewei Zhang
  • 496
  • 3
  • 10
  • 1
    using the resize-stateful script works without rebooting! thanks! – mgcm Jan 08 '20 at 15:58
  • `sudo /usr/share/cloud/resize-stateful` should be in the docs here https://cloud.google.com/compute/docs/disks/add-persistent-disk#checking_if_your_operating_system_supports_automatic_resizing – howMuchCheeseIsTooMuchCheese Jun 17 '20 at 11:50
  • This likely works on a chromebook but none of the disks will be mounted as stateful so this likely won't have an effect on a cloud VM. You can load the source of the file there and see what it's doing and try to replicate. – Charlie Sep 16 '20 at 00:42
0

Container-Optimized OS is an operating system image for your Compute Engine VMs that is optimized for running Docker containers. Container-Optimized OS is maintained by Google and is based on the open source Chromium OS project. This explains why you cannot use growpart or install it.

You could try this Chrome OS resizer posted HERE but I don’t recommend you to modify Google managed systems as it could cause other issues in the future

Ernesto U
  • 786
  • 3
  • 14