Fateslayer
1 min readFeb 20, 2021

--

I used this process described in the decrease the size of ebs volume in your ec2 instance with my Amazon Linux 2 instance and XFS volume. It worked almost correctly except for a couple of steps. Here are the steps at which I got errors and their solutions:

1. Installing GRUB

Command

sudo grub-install --root-directory=/mnt/new-volume/ --force /dev/xvdf

Error

command not found

Solution

sudo grub2-install --root-directory=/mnt/new-volume/ --force /dev/xvdf

Summary

Install grub2 instead of just grub. Ignore the warning.

2. Check the system label from old-volume

Command

sudo e2label /dev/xvda1

Error

e2label: Bad magic number in super-block while trying to open /dev/xvda1

Couldn’t find a valid filesystem superblock.

Solution

sudo lsblk -o name,mountpoint,label,size,uuid

Summary

e2label doesn't work on volumes but on the partitions. Since /xvda1 is an XFS volume in my case, I had to check the label using lsblk. You will have to use the label shown in the output instead of changing it to “cloudimg-rootfs” as mentioned in the post for the next command.

3. Attach a new-volume to /dev/sda1

Error

Unable to start the instance.

Solution

Detach old-volume and new-volume then attach new-volume to /dev/xvda instead of /dev/sda1. Then try starting the instance again.

I hope this helps.

--

--