Use 100% of drive with custom image
Hello I'd like to launch linode instances using 100% of the drive space on launch with a custom image. My Image is 6 GB large and it seems that I have to stop the host and then resize the drive manually before using the rest of the host.
This doesn't work particularly well with things like terraform as I would like to launch hosts with that.
I also tried launching an instance with terraform, while specifying the image and the disk size, however I get an error mentioning "You must specify a distribution when deploying a stackscript." I've tried to find how to find out what a "distribution" is but couldn't find any details from the linode documentation.
Can anyone point me in the right direction?
2 Replies
Hello!
I'd like to start with this, as it might shed some light on all of it for you:
I've tried to find how to find out what a "distribution" is but couldn't find any details from the linode documentation.
A distribution is the "type" of Linux that you deploy onto your Linode - the operating system. There are many Linux distributions, and they include Ubuntu, Debian, CentOS and more. When creating a Linode, you'll need to choose one of them for deployment.
Typically, when we refer to something as a "custom image" we mean one that comes with its own distribution / operating system - one that isn't supported by our platform.
Would you be able to give us a little more information about the image you're trying to deploy? Does it include an operating system?
Here's some information from our docs about deploying a custom image:
Install a Custom Distribution on a Linode
Our StackScripts do make you choose a Linux distribution for deployment, and you would choose that under "Select an Image" - and the options it gives you are distributions that are supported by that particular StackScript.
How to Deploy a New Linode Using a StackScript
And Terraform:
Use Terraform to Provision Linode Environments
Finally, we also have a post here that discusses automatically resizing a disk using the Linode API:
How can I automatically resize my disk to the largest size using the Linode API?
I hope this gets you pointed in the right direction. Please feel free to give us more detail about what you're looking to do so we can provide further assistance. I've added some tags to this post to get it more visibility here in the Community.
It looks like you can declare a disk size in the Terraform config file using the "disk" and "size" flags. Below is a link to the documentation from Terraform on these flags.
https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance
Below is an example of a configuration for Terraform. Note that you'll want to replace the size directive with your desired disk size, the image directive with whatever image name you're using, and modify the other settings that are prepended by $
.
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "1.13.4"
}
}
}
provider "linode" {
token = "$my_secret_api_token"
}
resource "linode_instance" "web" {
label = "my_terraform_created_linode"
region = "us-east"
type = "g6-nanode-1"
disk {
label = "boot"
size = 24576
image = "private/1234567"
root_pass = "$my_strong_password"
}
config {
label = "boot_config"
kernel = "linode/grub2"
helpers {
network = "true"
}
devices {
sda {
disk_label = "boot"
}
}
root_device = "/dev/sda"
}
boot_config_label = "boot_config"
}