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?
1
votes
Could you please explain how you formatted and mounted the EBS the first and then what you did the second time.
- NHol
sudo mkfs.ext4 /dev/xvdb mkdir -p /ext echo "/dev/xvdb /ext ext4 defaults 0 0" >> /etc/fstab mount -a mkdir -p /ext/etc/docker mkdir -p /ext/var/lib/docker echo "/dev/xvdb /ext/etc/docker ext4 binds 0 0" >> /etc/fstab echo "/dev/xvdb /ext/var/lib/docker ext4 binds 0 0" >> /etc/fstab mount --bind /etc/docker /ext/etc/docker mount --bind /var/lib/docker /ext/etc/docker chown -R 1000 /ext/var/lib/docker chown -R 1000 /ext/etc/docker.
- NGN
This is the first set of commands I given as userdata while launching the EC2 instance. its storing all docker images in /dev/xvdb when I did df. same set of commands only I used while creating another instance with the EBS snapshot. when I did df command there it is showing the usage and file size of /dev/xvdb is 0
- NGN
I stopped the instance for creating the EBS snapshot and then added an EBS volume while creating the instance using the created EBS-snapshot
- NGN
1 Answers
1
votes
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