How can I use Block Storage Volumes as Installation Media For Custom ISOs?
I want to be able to use a custom operating system and install it the way I would install it on a local machine (with an installer so I can make changes along the way). How would I go about doing this?
✓ Best Answer
I tried this recently. The guide below will make use of the Block Storage Service as a target for creating a bootable installation device. From there, we will boot into the installer, and install it onto our existing Linode, overwriting the default installation and creating a custom install.
Bill of Materials:
One (sacrificial) Linode. I tested this with a default Debian 12 nanode, but user preference is fine, we just need to be able to see a block storage device once attached, and be able to use lsblk, curl, and dd.
One Block Storage device. I used a 20GB image, which was overkill for any 'default' linux distribution. We're going to delete this block storage device once we're done, so aim for larger than you think you'll need.
Disclaimer: The Linode Support team will not be able to help you with this process if things get weird. I successfully tested this with Debian 12. Post your own experiences with this below so other Linode Community members can benefit!
Okay, let's rock and roll!
Create a linode, install
curlif it's not already available.
Attach it to the Linode you'll be using for this. Make sure to reboot afterwards so the Linode can see the new device.
Use the 'lsblk' command to check the label that the Linode's operating system has allocated to the block storage device (in my case, it was /dev/sdc, but it could be different for you).
This guide assumes you're using an image that's accessible from the internet, if you prefer to roll your own custom image and upload it without exposing it to the internet, you can use SSH to upload it to the Linode instead of the next step.
Use curl and DD to pull the public image and DD it straight onto the block storage device, like so:
root@localhost:~# curl -L https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.2.0-amd64-netinst.iso | dd of=/dev/sdc
Shut down the Linode, leave the Block Storage Device attached.
Now we need to make sure that the Linode's Configuration Profile is set up to boot off of our Block Storage "installation media".
- VM Mode: Paravirtualization -> Full Virtualization
- Select a Kernel: GRUB2 -> Direct Disk
- Set the /dev/sda to your block storage device, make sure that your Linode's default disk also has an assignment (/dev/sdb or sdc) otherwise you won't be able to install onto it!
- Filesystem/Boot Helpers -> disable all of them
- If your Linode was running while you were making these changes to it's Configuration Profile, give it a reboot. If it was off, boot it up!
In Lish, depending on your iso, you may have to manually select an option for graphical installation (note: if your ISO automatically boots into a desktop environment for it’s installer (like Anaconda/Calamares/and others), you’re going to want to switch over to the glish tab. Give it a minute or two, and you should see a graphical installer!
- Go through and install your operating system onto the storage device that corresponds with the Linode's original disk.
Note: Since Lassie can’t help out here, shutting the Linode down may take a little longer than usual. Go grab a coffee, come back in about 5 minutes, and it should finish turning the machine off after you install your custom iso onto the Linode.
- After all that is said and done, we can change the Configuration Profile back to having the Linode's default disk as /dev/sda (point it at the Linode’s original disk) and detach the block storage device.
Optional: Delete the Block Storage device, or attach it to a different Linode and start the fun all over again!