5
votes

I created an EBS volume, attached and mounted it on an EC2 instance. Created few sample text files in the mounted directory and took a snapshot from the AWS console.

Problem is, when I create a new EBS volume using this snapshot and mount this new volume, I am not seeing the stored content (in snapshot).

What can be the issue? Is my data not going into the snapshot? Or is the newly created volume having any issue?

Thanks in advance.

3
Hope this help a bit understanding what might be wrong. I tried an existing Amazon snapshot to create EBS volume. Step: 1. From aws console I created a new volume using amazon snapshot "snap-63cf3a0a -- DBpedia (Linux)" 2. Attached it with a fedora 8 machine "ami-48aa4921:ec2-public-images/fedora-8-i386-base-v1.10.manifest.xml" 3. logged in to this machine and mounted the device, using following commands: # yes | mkfs -t ext3 /dev/sdf # mkdir /mnt/ebs-store # mount /dev/sdf /mnt/ebs-store But still I am not seeing any data in /mnt/ebs-store directory.Sunil

3 Answers

5
votes

Found the issue. Not a system admin, else I should have know this thing. Following command is flushing the data from the EBS volume.

yes | mkfs -t ext3 /dev/sdf

On an EBS volume, started using snapshot, don't run above command. Hope it this thread will help someone in future.

2
votes

This should normally work. The only explication could be a mistake during the execution of the commands, e.g. that you created a file-system on the newly created volume instead simply mounting it (happened once to me).

0
votes

The above answers are WRONG and will lead to data corruption. The steps above result in "inconsistent snapshots" which means the snapshots will contain a corrupted copy of the file system.

Linux and Windows caches file system data and metadata in memory. You have to flush the file system from memory, freeze all processes that write to disk, take the snapshot and then unfreeze. Review the document link below.

Note the best solution is to snapshot the volume during the reboot phase of an instance. This is the offically supported AWS recommendation.

Creating consistent EBS snapshots