What is a good way to delete my Linode so I don't get charged, but still save my Linode's configuration and data?

Linode Staff

What is a good way to delete my Linode so I don't get charged, but still save my Linode's configuration and data?

2 Replies

This is a great question! And the answer is to download a copy of your disk(s) image by using SSH.

As a quick overview of the steps, you will:

  1. Boot into rescue mode and configure your Linode to accept SSH connections.
  2. In one command, connect to your Linode from your local computer and download the image.

Important Preparation Notes!

  • For preparation, you will want to do a regular reboot of your Linode so that you know it will boot properly. Sometimes a Linode that is not properly configured, or if it has not been rebooted for sometime, may not boot the way you would expect. This could be due to file system corruption or, it may boot but the services are not configured to start properly and then your services do not run. :(

  • While these issues are a rare occurrence, they happen often enough that you should investigate this now, before you download a copy of the image. Otherwise, you will have an image that is just waiting to give you trouble. You can view our guide on surviving a reboot.

Linode Documents - Reboot Survival Guide

  • Determine the size of data and shrink your disk. There are two things that you want here. You will want to make sure that you can download the entire image onto your local computer. You will also want to shrink your disk (therefore your image) so you do not download empty space. Find out how much space you have on your computer first. Then open the Lish console to your Linode, or use SSH to login, and then run, df -h. This will let you know how much disk space you are using and will look something like:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda        8.0G  4.0G  4.0G  50% /
devtmpfs        2.0G     0  2.0G   0% /dev
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           2.0G  189M  1.8G  10% /run
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sdc        503G   17G  462G   4% /mnt/DevStorage
tmpfs           392M     0  392M   0% /run/user/1000

Make a note of /dev/sda or /dev/root and then resize your Linode to be just a bit over this number. By the way, this setting accepts the size in MB so you can use the formula of 1,000 MB = 1 GB. Since I am using 4 GB, will want to resize my Linode down to 4,100 MB; otherwise, I would download an extra 4 GB that is just empty space.

Once you have confirmed that your Linode can be rebooted successfully and you have minimized the size, please power it off and then boot your Linode into rescue mode. (see below)

1. Boot into rescue mode:

What is rescue mode you ask? You can think of rescue mode as a way to access your Linode's files without the Linode running. This is important because it is very difficult (mostly impossible) to make a copy of a running system. How does it work? Well, the running system is a recovery system called Finnix and your Linode instance is attached to the running Finnix system so that you can gain access your Linode's files.

Great! Now how do I boot into rescue mode and connect to my Linode. You are asking all the right questions!

  • Login to the Linode manager, select the Linode to be downloaded, then select "Rescue" in the tabs. It is between "Resize" and "Rebuild".

  • You should see four drop-down boxes and a button that says "Reboot into Rescue Mode" This is where you will select the disks that you want to mount and save. Typically, you will only have one disk and that should go into /dev/sda. You can think of /dev/sda as "Device located at Storage Drive a". Also typically, you will also have your "Swap Image" in /dev/sdb. You can leave it there but we will not be downloading that as it is not needed. If you happen to have more than one disk, that will be available in this menu too.

  • You will also notice in /dev/sdh the label, "Finnix Media". Leave this setting alone as this is the Finnix Rescue system we talked about earlier that we will booting into and run. Click "Reboot into Rescue Mode" and your Linode will power down and then reboot into rescue mode. Neat!

  • Next, you will use the Lish console to access the Finnix system and start the SSH service. Just next to the green circle that shows your Linode as running, there is a link that says "Launch Console". Click that link and it will take you to the command line of your Finnix system. You will already be logged in so just run passwd to create a password that you will use in Step 2. You will need to enter the password twice and no characters will show up on your screen as you type. Don't be alarmed if you do not see anything happening. If for some reason, you mess up, simply enter passwd again to start the process over.

  • Then you will want to run service ssh start. This command will start the ssh service; easy enough!

For even more details about booting into rescue mode and starting SSH, and a few other cool things, please follow the link below.

Linode Documentation - Boot into Rescue Mode

2. Connect from your Local computer and download the image:

This next step is where all the magic happens! We download the image!

  • From the terminal in your local computer, navigate into the folder you would like to save your image. If you don't, that is okay because the command below will download the image to which ever directory you are currently working in. You can use the good ol' pwd command (print working directory) to find out.

  • You will want to replace "{$LINODE-IP}" with your Linode's IP address. You can select a different disk to download by changing the "sda" portion of the input file, "if=". Regarding the output file, "of=", you can change this location to suit your needs and even change the name of the file you save from "linode.img" to whatever you like. Why not use the same name as your Linode like, "lnxlvr-db.img"?

  • When you hit enter to run the command, you may get an error about a "man-in-the-middle" attack. Do not worry as this happened because we booted the Finnix system with our IP address instead of our regular system with our IP address. As a security precaution, SSH was looking for a certain "signature" and that signature has changed. No worries, it was you who did it, so it is all good. Simply run this command, ssh-keygen -R {$LINODE-IP}, to get rid of the error. Then you can rerun ssh [email protected]{$LINODE-IP} "dd if=/dev/sda " | dd of=./mylinode.img

    • Example of the benign nasty-gram:
$ ssh [email protected] "dd if=/dev/sda " | dd of=./deleteme.img
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
  • If the above error does not happen, you will be meet with a screen asking if you want to continue to connect. Type the full word, "yes", to continue to connect with your Rescue Mode Linode.

  • What should happen next is that you will be prompted for the password you just created (again, no characters will show up as you type) and then, as long as you do not get any errors, you are good to go! You will not see a progress bar but the download is working. You can check on it by opening another terminal emulator window, and run a ls command from inside the folder that is receiving the download. You should be able to see the filename you assigned to your Linode. Be patient as it may take a few hours depending on the size of your Linode and the speed of your internet connection.

    • The command and resulting output will look similar to this:
$ ssh [email protected] "dd if=/dev/sda " | dd of=./mylinode.img
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:D***************************************giE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
[email protected]'s password:
6324224+0 records in
6324224+0 records out
3238002688 bytes (3.2 GB) copied, 7003.94 s, 462 kB/s
6324224+0 records in
6324224+0 records out
3238002688 bytes transferred in 7110.593545 secs (455377 bytes/sec)

If you would like to see the official documentation for downloading a disk over ssh, please visit this link below:

Linode Documentation - Download a Disk over SSH


And there you have it! It is strongly recommended that you make at least two other copies of this disk image. You do not want to have a failure of your computer that leads to failure of your image with means you will have to start over from scratch. You can upload a copy of the image to Linode's Object Storage Service and/or you can copy the image to a USB stick or use Box.com, Google Docs, etc.

Lastly, before you delete the Linode you just created an image from, you should test your image by uploading it to a new Linode to see if it will boot properly. (Optional and strongly recommended) Please follow the Link below for detailed instructions on how to accomplish this.

Linode Documentation - Upload a Disk Image Over SSH

Lastly, if you get stuck, open up a ticket in support! We are here for you!

I can't even access the Linode server in rescue mode. Hmmm.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct