Oracle Cloud block storage size question

Is it possible to configure a larger size storage or configure additional block volumes?
What methods can be done? We use the VM.Standard2.x.

This would generally not be done in packer. Packer creates the custom image. So you can create it on VM.Standard2.x and when you provision the instance, you choose the size of the boot volume and you can provision any additional blank block volumes. Not sure I follow what challenge you were encountering. If you provide some more detail I can help especially with Oracle Cloud Infrastructure.

Thank you for replying.

We do plan to use Terraform for provisioning and we will have additional configurations, but it would be nice to have Oracle-oci builder (packer) to allow to increase the os disk space because the default boot volume size is only 46.6 GB.
Is there any method to have an increase in os boot disk size?

Ah i see. Basically when you are creating the custom image, you need more than 46GB to install your software. I have not seen a way to configure the builder to provision an instance with a custom boot volume. Sorry I don’t have an answer for that.

A couple ways we have gone about this.
You could download the software onto the boot and move it after provisioning and install, with a post_provisioner.
Or you could use something like Chef to bring the software onto the instance and install. You can place a chef provisioner in your terraform instance configuration to select a recipe or role.

thanks. We use ansible. I wonder if Packer will update os disk resize feature in the future?

@rramge did a good job with an issue I had before and finding the problem in the packer code. He might be able to find where it is setting (or not setting the block volume size as is happening here).

Hi,

since @twmcelroy was shouting so loud for me, I had a quick look at this thread. Hello everyone.

In OCI, the boot volume size is goverend by the source image you use. If you use an Oracle-provided image, they are all smaller than 50 GB for historical reasons (until a recent OCI update, boot columes could not exceed 50 GB in size. Now they can, but Oracle didn’t change the default size because then it would affect everyone and woul make using those images more expensive due to the block volume costs).

Increasing a boot volume size while a server is running is not possible, you can’t unmount it for resizing. So this is not something Packer could handle easily.

The recommended practice is using your own OS image instead of the Oracle-provided one. This way, you can set the boot volume size to 100 GB, if you wish. Oracle provides How-To documentation for Linux and (if I remember correctly) Windows. This image can then be used by packer for deploying the VM. Virtualbox 6.x can export VMs directly as images to OCI.

Hope that helps,

Ralf

But when packer provisions the instance, I’m assuming it uses the API and just doesn’t set the boot volume size, thus you get the default 48GB for Linux. I was wondering if you saw where it makes the call to create the instance. It would just have to be passing one variable to provision an instance with a larger boot volume. It looks like this is an OCI limitation as I searched on AWS and Azure builders. It looks like AWS EBS builder allows you to designate the size of the attached EBS volume upon creation. Also Azure has an OS disk size and additional disk size.

https://www.packer.io/docs/builders/oracle-oci.html - based on the oracle-oci reference, it has no options for it. Oracle-classic does have the option but we don’t use classic instances.

Azure and aws has those options, https://www.packer.io/docs/builders/azure/arm/#os_disk_size_gb.

but we have to use oracle and it’s images.

I would submit it as an enhancement for the OCI builder. We have had success with them updating features before with the OCI builder.

Like I said before, in OCI the boot volume size is governed by the parent image, since it contains the partitioning table. Even if you increase the boot volume size from 48 to 100 GB, the resulting OS will still only use 48 GB.

Thus, you need to use a different parent image. And like I wrote, either you create it yourself in Virtualbox, or you use an existing VM as a template and create a custom image from it.

  • Create a VM
  • Stop the VM
  • Expand the existing boot volume in place with offline resizing
  • Detach the boot volume
  • Attach the boot volume to a second instance as a block volume
  • Run parted to edit the partitioning table
  • Run xfs_growfs to grow the file system
  • Detach the volume from the second instance
  • Attach the volume to the original instance as a boot volume
  • Restart the instance and check everything is okay
  • Stop the instance
  • Create a custom image from the boot volume
  • Use this image as a source for Packer

That’s the best practice supported by Oracle. Actually, it would be possible to script it in Packer using oci-cli, I think.

Ralf

There are two other possible approaches for doing it online.

Manual:

  • Use SSH to connect to the instance
  • Resize the partition using growpart and gdisk
  • Grow the file system using xfs_growfs

Automatic (only with Oracle Linux): Use a cloud-init script.


#!/bin/sh
sudo yum -y install cloud-utils-growpart
sudo yum -y install gdisk
sudo yum install -< install libicu
[add your commands from the manual example above here]
sudo reboot

Ralf

Good point. Totally forgot about having to resize the boot partition. Thanks for the help Ralf!