How can I rescue my Linode by expanding its file system's size to match its containing partition?
My Linode is unable to boot because it does not have enough disk space. I increased my Linode's disk allocation through Cloud Manager, but this did not increase the size of the partition itself. How can I expand the partition if I cannot boot my Linode?
You can use Linode's rescue environment to manage your Linode from a Linux environment without needing to boot the OS on the Linode itself.
When setting up your rescue environment, you will need to ensure that your disk(s) are available to the rescue environment by selecting the disk(s) from the drop-down list that appears on your Linode's Rescue screen in Cloud Manager.
This rescue environment runs a special Linux distribution called Finnix, which contains a wide range of command-line utilities for resolving common issues. Since the rescue environment does not automatically start an SSH server, you will need to use Lish to access the rescue environment. However, you can start an SSH server from Lish, then access the rescue environment over SSH once the SSH server is up and running.
Once you are in the rescue environment, you can use the
resize2fs command to expand the partition to its maximum possible size:
Be sure to replace
/dev/sdx0 with the actual name of your block device or partition.
You may get a warning about needing to run
e2fsck -f /dev/sdx0. This command verifies that the file system on the disk is not corrupted. If you do get this warning, simply run the command as provided then run the
resize2fs command listed above.
Once you run
resize2fs, you should receive a confirmation message indicating that the partition is now resized. Once you receive this message, you can reboot your Linode from Cloud Manager.
Wait a moment for your Linode to power up. If the rescue procedure succeeded, you should be able to log into your Linode and show the enlarged partition and its disk usage with the
df -h command.