Thursday, October 26, 2017

Downloading or Backing up an Image or Drive from AWS

So we have an  EC2 instance on AWS.  But we need to terminate it as the project has to give way to something urgent and therefore not on foreseeable future will it be used. So instead of accruing cost, (as an image cost something if its in AWS although it is not being used), we decided to download the image or drive directly on our drive and store it.

This is what we did.

  1. Create a snapshot of the existing image you want to download in AWS. 
  2. From that snapshot, create an image.
  3. Once the image is available, add that image as part of the EC2 Instance you wish to download.
  4. Create another image. Make sure this is bigger than the image that you want to backup. Basically this will hold the image backup
  5. Mount it as part of the EC2 Instance.

For this, this is what I have :


  • /dev/sda1 is the source or what I will backup
  • /dev/sdf is a copy of /dev/sda1
  • /dev/sdg will contain the backup.

To get the available mountpoints that can be mounted :

execute :

As you can see..  /dev/sdf  (which is xvdf) is mounted as :

For /dev/sdg, the mountpoint is xvdg.

Since this is a new image, do the following commands :

Then mount  (make sure that the folder /mnt/image is available)\:

Afterwards, create an image :

Once created, go to /mnt/image and do a tar/gz. This is to compress it.

After which, you can now do an SCP to the machine and download the file.