Criado uma instância do RHEL com um volume EBS raiz de 200 GB. Atualmente, ele usa apenas 10% do volume disponível. Como diminuir o tamanho do volume do EBS na AWS?
Eu segui as etapas mencionadas abaixo para diminuir o tamanho do volume da raiz.
1.Stopped the instance
2.Dettached the root volume from the instance
3.Attached the root volume to an another instance which is running
4.Created a new volume with the required size. (Lets say 50GB)
5.Attached the new volume to the running instance
6.Copied all the data from the old volume to the new volume
7.Detached the new volume and attached to the stopped instance.
8.Created the AMI for the old instance.
9.Relaunched the instance from the AMI The instance is showing starting and after some time it is automatically shutting down.
PFB os comandos executados
sudo mkdir /new /old create new directories
sudo mkfs.ext4 /dev/xvdf create new filesystem on new volume
sudo mount -t ext4 /dev/xvdf /new mount it to this directory
sudo e2label /dev/xvdf uec-rootfs needs an e2label for linux to recognize it, use sudo e2label /dev/sda1 on an active instant to see what it should be
sudo mount -t ext4 /dev/xvdg /old mount old vol to directory for copying
sudo cp -p /old /new didn’t really do anything.. Skipped a bunch
sudo rsync -ax /old /new took a while
sudo mv /new/old/* /new/
sudo umount /new unmount vols
sudo umount /old
Por favor, ajude a resolver o problema.