Search code examples
linuxamazon-web-servicesmount

AWS EBS volume created using snapshot not showing the previous data


I created an EC2 instance and attached EBS volume and mounted to it.then I created a folder in external disk, and mounted 2 folders into that. added those in /etc/fstab. And Ran some docker Images in the mounted volume. Then I created the snapshot of that EBS volume and created a new volume using the snapshot and attached to another instance. and mounted that as same way how I mounted the first volume. But After mounting the volume I did df, it shows the mounted volumes. But I am not able to see any docker Images which was running inside the first volume. Can anyone help me how can I see the data?


Solution

  • Based on the commands you are passing as userdata to your source instance, it looks like you are creating an ext4 filesystem on the disk before first use. You are then using the same commands when utilising the snapshot on the second instance.

    Exclude the following on your new instance when mounting the snapshot

    sudo mkfs.ext4 /dev/xvdb
    mkdir -p /ext/etc/docker mkdir -p /ext/var/lib/docker