0

TL;DR: Trying to resize2fs /media/root/dev/sdc within CoreOS Toolbox container fails, message open: Operation not permitted while opening /media/root/dev/sdc. Probably privilege issue, how do I gain the privileges?


I've resized a google cloud compute engine zonal standard persistent disk from 20GB to 50GB. I attached the disk to a running VM Instance to have a look around. The change does not appear on the file system using df -h after mounting the disk, but it does on the device using lsblk.

From what I've understood, the disk has a single file system with no partitions. I based this mainly on the fact that lsblk shows up no partitions for the device, and I understood that single file system disks are the convention on gcp

Now I started attempting to resize the file system by following these docs from Google. However it wasn't as straight forward, because the VMs accessible to me seem to be based on Container-Optimized OS, and therefore do not come with the needed tools nor a package manager. Therefore I have to use CoreOS Toolbox, which if I understood it correctly, runs a Docker container with systemd-nspawn. This gives me access to a package manager and the tools I need.

Toolbox mounts the root of the fs of the host to /media/root, so I'm easily able to access the devices. However, when I tried to use resize2fs /media/root/dev/sdc as per the aforementioned guide, I get the error message mentioned in the TL;DR. I've tried to chmod 666 the device within the VM within and Toolbox, and it works, but doesn't solve the issue with resize2fs. I also tried running toolbox as root, though I assumed this wouldn't do much. It didn't. I've also unmounted the disk before trying any of these.

One solution I thought of would be to run a VM with a more robust OS image, so that I'd have both "direct" access to the device, and direct access to the tools. I'm adamant to solve the issue with the tools at hand though, because that's more viable in production, and I believe it's possible.

0

You can follow the instructions provided in regards to mounting and formatting disks within Core OS by following the documentation provided [1].

[1]https://cloud.google.com/container-optimized-os/docs/concepts/disks-and-filesystem

mounting_and_formatting_disks

| improve this answer | |
  • That doc leads to two more docs which contain the actual guides. One of the two is relevant to me since it relates to persistent disks, and that one I linked to within the question. I did not find the answer to my problem in that doc. Thank you for the reply. – Anton Höglund Apr 1 at 7:50
  • Please provide step by step of what you did so I can reproduce the scenario in my project. I am not sure yet if there have any limitation to execute resize2fs by toolbox [1] for container optimized OS [2]. [1] cloud.google.com/container-optimized-os/docs/how-to/toolbox [2] cloud.google.com/container-optimized-os/docs – Shafiq I Apr 1 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.