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
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.