Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mounting Old EBS Volume to the new Instance - Amazon EC2

Tags:

amazon-ec2

1) I had an instance and sudo commands were not working do to some mistakes on this instance so i had to create a new instance.

2) I want to use old EBS volume with new instance and to stop old instance.

3) I created a new instance (New EBS Volume is created automatically with new instance)

4) I created snapshot of old volume and attached with new instance.

5) So two EBS volumes are attached with new instance.

6) When i login using SSH into new instance, i don't see old data anywhere.

7) I want every old data on new instance.


my question is..... how i can use old volume with new instance?

please help me.. i am trying it from last 10 hours continuously :(..

like image 468
Mohd Shahid Avatar asked Feb 19 '12 14:02

Mohd Shahid


People also ask

How do I attach an existing EBS volume to a new EC2 instance?

To attach an EBS volume to an instance using the consoleOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Volumes. Select the volume to attach and choose Actions, Attach volume. You can attach only volumes that are in the Available state.

What happens to your EBS volumes when you start up a new EC2 instance?

What happens to your EBS volumes when you start up a new EC2 instance? c:Nothing. You cannot start up a brand new EC2 instance. You must create an S3 bucket before uploading your data to S3.

How can we attach your instance store volume to another instance?

For each instance store volume to add, choose Add New Volume, from Volume Type select an instance store volume, and from Device select a device name. The number of available instance store volumes depends on the instance type. Complete the wizard and launch the instance.

Is it possible to reuse a EBS volume for multiple instances?

You can attach multiple EBS volumes to a single instance. The volume and instance must be in the same Availability Zone. Depending on the volume and instance types, you can use Multi-Attach to mount a volume to multiple instances at the same time.


1 Answers

What you need to do is mount the old volume on the new instance. Go to the Amazon EC2 control panel, and click "Volumes" (under Elastic Block Store). Look at the attachment information for the old EBS volume. This will be something like <instance id> (<instance name>):/dev/sdg

Make a note of the path given here, so that'd be /dev/sdg in the example above. Then use SSH and connect to your new instance, and type mkdir /mnt/oldvolume and then mount /dev/sdg /mnt/oldvolume (or whatever the path given in the control panel was). Your files should now be available under /mnt/oldvolume. If this does not solve your problem, please post again with the output of your df command after doing all of this.

So, to recap, to use an EBS volume on an instance, you need to attach it to that instance using the control panel (or API tools), and then mount it on the instance itself.

like image 134
Daan Avatar answered Oct 01 '22 19:10

Daan