How do I resize my disk after upgrading my Linode

Linode Staff

My Linode has been upgraded and I need to resize the disk to include the additional available space. How do I resize my disk and is there any chance of losing the data when I resize.

8 Replies

Resizing your disk can easily be done from the Linode Manager:

  1. Navigate to the Linode Manager
  2. Select the Linode you wish to resize
  3. Click Shut down to turn your Linode off
  4. Click the Edit link next to the disk you wish to resize
  5. In the 'New Size' field, enter a different size for the disk in megabytes
  6. Click Save Changes. The Linode’s dashboard appears
  7. Click Boot to turn on the Linode

For additional information on resizing your disks, feel free to reference our guide here

Resizing your disk should not result in any data loss, so you shouldn't need to worry about that.

In the new Linode Manager (cloud.linode.com), this can be done by:

  1. Select the Linode to be resized
  2. Shut down the Linode
  3. Navigate to the Settings tab, and open the Advanced Settings panel.
  4. Find your Disk in the list of this Linode's disks and choose the Resize option.
  5. Enter the new size and select "Submit".
  6. Reboot your Linode once the resize is complete.

With recent changes to Cloud Manager, this process has changed a little bit:

  1. Select the Linode to be resized
  2. Shut down the Linode
  3. Navigate to the Settings tab, and open the Advanced Settings panel.
  4. Find your Disk in the list of this Linode's disks and choose the Resize option.
  5. Enter the new size and select "Submit".
  6. Reboot your Linode once the resize is complete.

It seems things have changed slightly once again. I found this page by search but seems the new Linode Manager has moved disk management to its own tab (and no longer is there an Advanced tab in Settings).

So… Steps 1-2 as above

  1. Navigate to the Disks/Config tab
  2. Find your disk at the bottom
  3. Click on the … to the right, select Resize from the drop-down
  4. On the pop-out panel adjust the size and the hit "Resize" button
  5. Reboot once complete

This seems only to apply to extra volumes. On my main disk, I have to shutdown first, then resize and restart.

What I haven't worked out is whether Linux will pick the change up automagically, or if there is a command that needs executing?

On the current version of Cloud Manager (v1.92.0), the process is as follows:

Compute Instance Disk (Guide)

  1. Log in to Cloud Manager at https://cloud.linode.com/.
  2. Select the compute instance you want to resize from the list of instances.
  3. Power down the compute instance
  4. Scroll down to the "Storage" section and click on the "Resize" button next to the disk you want to resize.
  5. In the "Resize Disk" side window that appears, modify the "Size" value, then click "Resize".
  6. Wait for the disk to be resized, which may take several minutes depending on the size of the disk.
  7. Once the disk has been resized, simply power on the compute instance. No further action is required and you can verify the changes by running df -h.

Block Storage Volumes (Guide)

  1. Log in to Cloud Manager at https://cloud.linode.com/.
  2. In the left-hand side menu, click on "Volumes" and locate the Block Storage volume you wish to resize. If the Volume is attached to a Compute Instance, power off that instance.
  3. Click the more options ellipsis "…", then select "Resize".
  4. In the "Resize Volume" side window that appears, modify the "Size" value, then click "Resize Volume".
  5. Once clicked, the "Resizing Instructions" panel appears with the instructions and commands needed to resize the Volume’s filesystem. Either save these commands or leave this panel open.
  6. Wait for the volume to be resized, which may take several minutes depending on the size of the disk. The notification bell in the top right of the page will notify you when the resizing is complete.
  7. After the Volume is resized, power back on your Compute Instance.
  8. Once your Compute Instance has fully booted up, you need to run the previously mentioned commands to resize the file system within your Volume.
    8a. Login to your Compute Instance using SSH or Lish.
    8b. Unmount the Volume, making sure to use the unique path for your own Volume:
umount /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1

8c. Assuming you have an ext2, ext3, or ext4 partition, run a file system check:

e2fsck -f /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1

8d. Then resize it to fill the new Volume size:

resize2fs /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1

8e. Mount your Volume back onto the filesystem:

mount /dev/disk/by-id/scsi-0Linode_Volume_BlockStorage1 /mnt/BlockStorage1

We use this… might help you

#!/bin/bash

# shellcheck disable=SC2086,SC2034,SC2029

set -o pipefail
set -o errexit

NAMESPACE=$1
DEPLOYMENT=$2
PVC=$3

wait_for_pvc_to_not_be_used() {
  local namespace=$1
  local pvc=${2}

  while ! kubectl -n ${namespace} describe pvc ${pvc}|grep 'Used By:.*<none>' > /dev/null 2>&1; do
    echo -n '.'
    sleep 1
  done

  echo
}

scale_deployment() {
  local namespace=$1
  local deployment=$2
  local count=$3

  kubectl scale deploy -n ${namespace} --replicas=${count} ${deployment}
  kubectl wait deployment -n ${namespace} ${deployment} --for condition=Available=True --timeout=3600s
}

resize_filesystem() {
  local namespace=$1
  local deployment=$2
  local pvc=$3
  local pv
  local pod
  local node
  local ip_address

  pv=$(kubectl get pvc -n ${namespace} ${pvc} -o yaml|yq .spec.volumeName)
  pod=$(kubectl get pods -l app.kubernetes.io/name=${deployment} -o jsonpath="{.items[0].metadata.name}" -n ${namespace})
  node=$(kubectl get pod -o=custom-columns=NODE:.spec.nodeName -n ${namespace} ${pod}|tail -1)
  ip_address=$(kubectl get nodes -o yaml ${node}|yq '.status.addresses[]|select(.type == "ExternalIP").address')

  ssh root@${ip_address} "resize2fs \$(mount|grep ${pv}|awk '{print \$1}')"
}

echo "INFO: Scaling ${DEPLOYMENT} to 0 replica"
scale_deployment ${NAMESPACE} ${DEPLOYMENT} 0

echo "INFO: Waiting for volume to be detached"
wait_for_pvc_to_not_be_used ${NAMESPACE} ${DEPLOYMENT}

echo "INFO: Scaling ${DEPLOYMENT} to 1 replica"
scale_deployment ${NAMESPACE} ${DEPLOYMENT} 1

echo "INFO: Resizing filesystem"
resize_filesystem ${NAMESPACE} ${DEPLOYMENT} ${PVC}

Is a shame online resize is not supported

Reply

Please enter an answer
Tips:

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