By using AWS re:Post, you agree to the AWS re:Post Terms of Use

Efficient Data Migration and Volume Removal between EBS Volumes on EC2 Instance

1

How can I efficiently migrate essential data from one EBS volume to another within the same EC2 instance? Specifically, let's examine two volumes: Volume1 and Volume2. Volume1, utilizing gp2, has a capacity of 100GB, but it only contains approximately 20GB of actual data. Conversely, Volume2, using gp3, is currently empty and has a size of 30GB. Volume2 was created after Volume1, and I now need to transfer the 20GB of data from Volume1 to Volume2 while simultaneously removing Volume1. Volume1 is currently mounted at '/' (root), and Volume2 is mounted at '/mnt/myNewVolume'.

asked 10 months ago384 views
1 Answer
2
Accepted Answer

Hello.

How about synchronizing with rsync command?

rsync -a / /mnt/myNewVolume

Is the purpose of your work to reduce the root EBS size?

In that case, the steps in the blog below may be helpful.
https://medium.com/@m.yunan.helmy/decrease-the-size-of-ebs-volume-in-your-ec2-instance-ea326e951bce

profile picture
EXPERT
answered 10 months ago
profile picture
EXPERT
reviewed 6 months ago
  • Initially, I generated an EBS volume2 and created "myNewVolume." directory and mounted that point the volume2. Subsequently, I employed the rsync command to duplicate the contents of the / directory onto "myNewVolume." However, encountering difficulties, I am currently unable to switch volume2 as new root volume. Once this transition is accomplished, my intention is to eliminate the initial volume for the purpose of cost efficiency.

  • I adhered to the procedures outlined in the blog, but during the "preparing volume" step, I encountered the following message:

    "tune2fs 1.44.1 (24-Mar-2018)

    This operation necessitates a filesystem that has been recently checked.

    Kindly execute e2fsck -f on the filesystem."

    I do not know what I am missing.

    Also, I encountered that when trying to install grub on a new volume.

    "grub-install: warning: File system `ext2' doesn't support embedding."

  • What if you try the steps in the blog below? https://dev.to/mithlajkn/reduce-ebs-size-of-your-ec2-29p9

    If you encounter an error like this "This operation requires a freshly checked filesystem."
    run sudo e2fsck -f /dev/nvme1n1 to check the filesystem.

    Check the system label of the old volume using the command: sudo e2label /dev/nvme0n1p1
    Replace the label of the new volume with the old volume's label: sudo e2label /dev/nvme1n1 cloudimg-rootfs

  • e2fsck -f /dev/xvdf that command helped me.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions