Creating and Deploying Golden Images for Non-Standard Linodes in the Akamai Connected Cloud

Brent Eiler
7 min readDec 14, 2023

--

In my last few posts, I have covered a couple ways you can create non-standard Linodes in the Akamai Connected Cloud — both from KVM images and from ISO. But, what if you want to make your own? Maybe you have standard software that every RHEL VM must have. Or maybe you have certain configurations like LVM. Or maybe you just do not feel like installing from ISO 50 times. Or potentially you want to avoid billing for VMs that are not often used and do not need to be up on-demand within seconds, but do hold state and are used semi-regularly. Regardless of the why, the process for doing this is quite simple and uses the same basic tooling you should already be familiar with if you have created a non-standard Linode. Unfortunately, the answer is not using the Clone option, as you may have done with standard Linodes. Fortunately, it really isn’t much more involved than that. To demonstrate this procedure, I will clone the TrueNAS VM built in my last post. And then deploy it to a different Cloud region. There are many reasons why I chose this specific VM for this post, but I will cover those in a subsequent tutorial.

Part 1 — Create the Golden Image

To start, if you have not already, read Shared Storage in the Akamai Connected Cloud. When you have your TrueNAS VM built, you are almost ready to go. Go back in to your TrueNAS console and delete the Dataset so your image is clean. To do this, delete the Share, by clicking “Shares” on the menu to the left, and then the trash can icon on the share. Then click “Storage” from the left hand menu, and the “Export/Disconnect” button. Check all the boxes and enter the Pool Name. Click “Export/Disconnect” and the Pool is gone.
Now from the Akamai Connected Cloud console, click “Linodes” from the menu on the left and then click on your TRUENAS_1 VM. Power off your NAS using the “Power Off” button. Click the … and select “Rescue.”

In the next step, you will again make use of the TEMP disk, from the previous exercise. Select TEMP under “/dev/sda” and TRUENAS_1_SYSTEM under “/dev/sdb.” Then click “Reboot Into Rescue Mode.” And then click the “Launch LISH console” button from the TRUENAS_1 overview page.

When the console reaches a prompt, do an lsblk and verify you see your 5 GB disk at /dev/sda and 75 GB disk at /dev/sdb. If you do not, look to see if they are listed under another /dev/sdX and adjust the steps below to account for that. If you use another Linode plan in your initial install, just find the disk size of your TRUENAS_1_SYSTEM disk. It should have 4 partitions like /dev/sdb below.

lsblk

If your /dev/sda has partitions under it (ie /dev/sda1, /dev/sda2, etc…) you will need to fdisk this and delete the partitions. **WARNING — This is only for the 5 GB Disk. Do not do this on the larger disk.** You can do this by issuing fdisk /dev/sda and once inside type d for delete, then hit Enter. Do this 1 time for each /dev/sdX. After deleting all partitions, type w to write the table and exit.

fdisk

Next, and regardless of whether you needed to fdisk /dev/sda, make sure you have a filesystem in place by using mkfs.ext4 /dev/sda and accept any prompts. Then mount the disk at /mnt by issuing mount /dev/sda /mnt

The next part is the sneaky magic — shoving a 75 GB disk into a 5 GB disk. To do so, you will stream the blocks from /dev/sdb, compressing them in transit to a zip file on /mnt. Use this command:
dd if=/dev/sdb bs=4M status=progress | zip –q > /mnt/nas_image.zip
The process of making the golden image can take 10+ minutes due to the inline compression. So go get a coffee now, at a local coffee shop. You have time.

Once it completes, the resulting file should be about 3.5 GB — much smaller than the 75 GB disk. Now upload it to your favorite Internet facing file storage. Linode Object Storage is great for this! You now have a golden image for TrueNAS.

Part 2- Deploy Your Golden Image

Now, deploying a golden image is a similar process to deploying a KVM image or building from an ISO. The TLDR; is this:

  1. Create a shell VM with 2 disks, 5 GB and 75+ GB and a config that boots the larger disk, along with any network interfaces you need.
  2. Boot to Rescue Mode, obtain the image and image the disk.
  3. Reboot.

Part 2.1 — Prepare the VM Environment

To prepare the VM environment, create a Linode via the blue “Create” button. Select “Linode

As per the last exercise, click the “x” under “Images”. Since you already have a NAS in one region, select a new region to deploy your golden image. If you are staying on the cheaper side and just using this for learning, use the Linode 4GB Shared Plan like in the previous exercise. However, you must use at least this plan size to accommodate the 75 GB disk.

Give your Linode a label — maybe TRUENAS_2. And assign your HTTP_ONLY firewall to the Linode. Then click “Create Linode.

While your new Linode provisions, create your disks by clicking “Storage” and then “Add A Disk.

Use the following settings:
Create Empty Disk”
Label” = TEMP
Filesystem” = ext4
Size” = 5120
Then click “Create

When that disk is created, click “Add A Disk” again.
Use the following settings:
Create Empty Disk”
Label” = TRUENAS_2_SYSTEM
Filesystem” = raw
Size” = 76800
Then click “Create

Now create the boot configuration for the VM. Click “Configurations” and then “Add Configuration.

Use the following settings:
Label” = TRUENAS_SYSTEM
VM Mode” = Paravirtualization
Under Boot Settings:
Kernel” = Direct Disk
Under Block Device Assignment:
“/dev/sda” = TRUENAS_2_SYSTEM
**This is the only disk you will need to mount in the standard boot configuration.
Under Network Interfaces:
leave “eth0” at “Public Internet
You can select “VLAN” under “eth1” and create a VLAN so that VMs can access your file shares on a private RFC1918 address space. Do this by typing a VLAN name into the box and clicking “Create ‘vlan-name’
Finally, click the blue “Add Configuration” button.

Part 2.2 — Get the Image

The next step is to boot into Rescue Mode with both /dev/sda as TEMP and /dev/sdb as TRUENAS_2_SYSTEM. Click the … and select “Rescue.”
Use the following settings:
/dev/sda” = TEMP
/dev/sdb” = TRUENAS_2_SYSTEM
Click “Reboot Into Rescue Mode.

Click “Launch LISH Console” and wait for the prompt. Again, run lsblk to ensure your disks are attached and the correct size.

Mount the 5 GB device on /mnt. It should already have an ext4 filesystem from the creation settings. cd /mnt and then run a curl command to the location of your golden image file, like this: curl -o nas_image.zip https://my.bucket-object.storageplatform.com/nas_image.zip or wherever you have the file stored. If the file completes within a second, check your permissions and make sure you can actually access the file. Then delete it from /mnt using the rm command. Once it completes successfully — within a minute or two, issue the last command:

unzip -p nas_image.zip | dd of=/dev/sdb bs=4M status=progress

Replace nas_image.zip with the filename of your golden image if you have used something else.

This will take about 7 minutes to stream the decompression of the file into dd and blast the larger disk with those blocks. When it completes, close the LISH console and click the “Reboot” button on your TRUENAS_2 Linode overview page. Confirm the reboot. When the Linode reaches the “Running” status, click on the Public IP Address to copy it to your clipboard.

Open your favorite web browser, paste the IP into the address bar and hit Enter. You should now be prompted with a TrueNAS login page in your new Linode region. And if you use your username ‘admin’ and super secret password from the initial TrueNAS install, it will grant you access.

You now have a golden image of a TrueNAS deployment that you can deploy to any region. Stay tuned for my next tutorial on using your these 2 TrueNAS deployments for replicated golden image storage and streamlined image deployment over NFS.

--

--