0

I have an issue trying to shrink a 5TB EBS volume that runs ubuntu on AWS to a 200GB EBS volume. I created the snapshot and use it to create a new volume. Create a new volume of the size I want to use. Attach the two volumes to the old instance.

Then create a file format and mount both drives on different mount points. I then use rsync to copy the data to the new sized volume from the snapshot volume and then unmount the small drive. Stop the instance and then detach all volumes and attach only the newly sized one to /dev/sda1 and when I try to reboot the instance, it keeps getting stuck on initializing for over 10mins.

Wondering if anyone knows how else I can do this as its urgent The instance is a t3a.small and presently is at 5TB and I need to shrink down to 200GB

1
  • As currently written, it is difficult to understand where your problem really is. Could you clarify between what you intend to to and what has already been done. This will help to identify and, hopefully solve your question. Jun 16, 2022 at 6:58

1 Answer 1

0

I had faced a similar problem after doing the exact steps as yours, my instance used to start but I could not SSH it.

The way it worked out for me was as follow:

Machine named abc with 1TB volume needs to be decreased to 200GB

1- Take a backup of abc by creating a snapshot of instance [NO USE JUST BACKUP INCASE]

2- Now create a new VM xyz with the suggested new volume size 200GB in the same AZ with same OS image

3- Now stop instance xyz.

4- Go to volumes tab in AWS console.

5- Detach the 200GB volume from xyz instance.

6- Attach this volume to abc instance

7- SSH the abc machine

8- Check volume is attached

      lsblk

9- Mount the volume’s root directory:

      mkdir /mnt/new-volume
      
      mount /dev/xvdf1 /mnt/new-volume

10- Now copy the / of abc to the newly mounted drive

      rsync -axv / /mnt/new-volume/

11- Unmount drive

      umount /mnt/new-volume

12- Detach 200GB volume from abc instance and attach to xyz.

13- Start the xyz instance

14- SSH into xyz instance and verify all services.

P.S Posting this for your help also if anyone can point out any possible issue with this way.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .