NOTE: If you are going to use this guide with production instances is highly recommended to create an image before proceed.
The procedure has been tested using Amazon Linux instances, but should work with any other Linux flavors: Ubuntu, SUSE, Redhat, etc.
Imagine you have one T1 micro PVM instance with next characteristics:
First, login to the instance and ensure is updated. If not, I recommend you to update the instance to the latest stable version using apt-get/yum commands:
Wait until instance is updated and reboot, if needed. Verify everything is correct. I´m also going to create a file named info.txt just to know this is the root volume associated to my T1 PVM instance:
Now, launch a new T2 instance. Don't forget to:
- Select a compatible T2 AMI closer to your current T1 AMI with same architecture (32 or 64bits)
- Select same size for root volume
- Select same instance type (if original T1 instance is t1.micro, select t2.micro)
- Launch T2 instance in the same availability zone (AZ) of your current T1 instance
Example:
Stop both instances. Now, go to AWS EC2 web console, Volumes section and:
- Set an easy-to-remember name for each volume
- Review attachment information of T2 HVM root volume (at least) and take note of device name. In my example: /dev/xvda. We'll need this information later.
- Detach both root volumes
After these steps, both volumes should be available in AWS console:
Now, we need to launch a new instance. We'll use this instance to perform required changes, so work instance seems a good name. Don't forget to launch this new instance in the same availability zone of T1 and T2 instances:
Attach T1 PVM and T2 HVM volumes as secondary volumes in work instance:
As you can see, T1 PVM volumes has been attached in /dev/sdf device and T2 HVM volume in /dev/sdg device. This information is important because will help us to identify volumes inside work instance.
Now, login to the work instance and run dmesg command to know how volumes are identified by the kernel:
According to dmesg information, /dev/sdf (PVM volume) is associated to /dev/xvdf and /dev/sdg (HVM volume) to /dev/xvdg1. Create two mountpoint directories, one for each device, and mount them. Required commands:
- sudo mkdir /pvm
- sudo mkdir /hvm
- sudo mount /dev/xvdf /pvm
- sudo mount /dev/xvdg1 /hvm
In the next step we're going to backup current HVM kernel. To ensure maximum compatibility, preserve current HVM kernel is recommended. You can skip this step if you're 100% sure PVM kernel will work with the new T2 HVM instance. You will need to backup /boot directory inside /hvm and modules associated to the running kernel. To know what is the active kernel, review /hvm/boot/grub/menu.lst file. Will give you the information to know what modules are required to backup:
For our example, next commands will be required:
- sudo cp -prf /hvm/boot /tmp/
- cat /hvm/boot/grub/menu.lst . Active kernel is tagged 3.10.42-52.145.amzn1.x86_64. So, command to backup modules will be:
- sudo cp -prf /hvm/lib/modules/3.10.42-52.145.amzn1.x86_64 /tmp/
Next steps will be: remove all files from HVM volume, copy files from PVM volume to HVM and restore HVM kernel. The commands:
- sudo rm -rf /hvm/*
- sudo cp -prf /pvm/* /hvm/
- sudo rm -rf /hvm/boot
- sudo cp -prf /tmp/boot /hvm/
- sudo cp -prf /tmp/3.10.42-52.145.amzn1.x86_64/ /hvm/lib/modules/
Important: review root label in kernel configuration, fstab file and root filesystem. In order to work, they need to be the same. In previous screenshot, volume labeled as / will be use as root device by kernel configuration and fstab file. Requesting information about HVM volume label, I get the same value. Finally, HVM volume filesystem is ext4. So, nothing additional is required in my example. If you find differences in your environment, you'll need to modify /hvm/boot/grub/menu.lst, /hvm/etc/fstab and/or HVM volume label to solve it. Otherwise, instance start-up will fail.
If all is correct, umount both volumes:
- sudo umount /pvm
- sudo umount /hvm
Go to AWS EC2 web console, Volumes section, and detach both secondary volumes (T1 PVM and T2 HVM volumes) from work instance.
Now, attach HVM volume as T2 instance root volume. In AWS EC2 web console, Volumes section (Important: don't forget to put as device name the value you copied previously. In my example: /dev/xvda):
Optional: If T1 instance has an Elastic IP assigned, I suggest you to associate this IP to the new T2 instance. To do it, just disassociate Elastic IP from T1 instance and associate to the new T2 instance in Elastic IPs section. Example:
All done. Now you can start and login to the new T2 instance using the old Elastic IP. As you can see in the next screenshot, files contained are the same T1 PVM root volume, but using the new T2 instance type:
If after procedure you experience issues during T2 instance start-up, in AWS EC2 web console select the instance, right click and select Get System Log. If there is any issue associated to the kernel, filesystem or volume label; useful information for troubleshooting will be displayed here.
When all work as expected, you can remove old T1 and work instance. Be sure you won't need them before remove because as soon as you delete them won't be able to access again.
34 comentarios:
Thanks a lot! I was be able to accomplish the migration from t1.micro (PV) to t2.micro (HVM) following this post... great job
Very nice post, I was also able to accomplish the task. Thanks!
Shouldn't this be:
sudo cp -prf /tmp/3.10.42-52.145.amzn1.x86_64 /hvm/lib/modules/
Note the lack of trailing slash on the 1st positional argument.
Thanks! The clearest tutorial I have read. It helps me a lot when i upgrade my ubuntu-t1.micro instance to t2.micro.
Thank you Javier! Very clear instructions for migrating from t1, to t2 EC2 micro instances.
Thanks for the clear, step-by-step instructions! I was successful in migrating from a t1.micro instance to a t2.micro. Unfortunately, I can't seem to reassign the Elastic IP (and DNS record) from the t1.micro instance, which appears to be in EC2-Classic, while the t2.micro is in EC2-VPC. Equally clever recommendations for work-arounds appreciated!
Funciona genial!!
Even with google translate! saved me hours. thank you
Is it suitable even to migrate a m1.small PV to t2.medium HVM? Thanks
Stefano: yes, it is.
Thx man, worked like a charm! What a timesaver, really appreciate it!
Thank you for the article. :) One extra thing I had to do was setup the aws cli and migrate my Elastic IP to be on the VPC network. http://docs.aws.amazon.com/cli/latest/reference/ec2/move-address-to-vpc.html
Very useful. Despite my own stupidity I did an ubuntu migration very smoothly.
Thanks.
Thanks so much for this! I'd been lazy on porting my servers, primarily because I had no Idea how to do it. Very well done!
I agree with your points but i can't understand what's logic behind by including with the number? Why most of the marketers will suggest that one? Is there any important factor within that please convey me.....
Digital Marketing Training in Chennai
Hadoop Training in Chennai
I migrated my Ubuntu 14.04 from t1 to t2 using your guide. Gracias!
Thanks for updating your information for more updates AWS Online Training
Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you.
Keep update more information..
xiaomi service centre chennai
redmi service center
mi service center
redmi service center near me
redmi mobile service centre in chennai
redmi note service center in chennai
I think this is the best article today about the future technology. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future lenovo service center in velachery
lenovo service center in porur
lenovo service center in vadapalani
Your blog’s post is just completely quality and informative. Many new facts and information which I have not heard about before. Keep sharing more blog posts.
redmi service center
mi service center
redmi service center near me
redmi mobile service centre in chennai
This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
lg mobile service center in porur
lg mobile service center in vadapalani
This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points.
oppo service center chennai
Hi! Thank you for the share this information. This is very useful information for online blog review readers. Keep it up such a nice posting like this.
best mobile service center in chennai
mobile service center in velacherry
Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definitely interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
lg mobile service center near me
lg mobile service center in velachery
PHP Training in Bhopal
Graphic designing training in bhopal
Python Training in Bhopal
Android Training in Bhopal
Machine Learning Training in Bhopal
Digital Marketing Training in Bhopal
https://99designs.com/blog/trends/top-10-web-design-trends-for-2014/
Nice post...Thanks for sharing useful information...
Python training in Chennai
Python training in OMR
Python training in Velachery
Python certification training in Chennai
Python training fees in Chennai
Python training with placement in Chennai
Python training in Chennai with Placement
Python course in Chennai
Python Certification course in Chennai
Python online training in Chennai
Python training in Chennai Quora
Best Python Training in Chennai
Best Python training in OMR
Best Python training in Velachery
Best Python course in Chennai
nice blog
get best placement at VSIPL
digital marketing services
Web development Services
seo network point
We believe in practice what you preach and thus the Amazon Web Services Training at APTRON Gurgaon involves "Hands-on-experience" therefore each person is motivated to practically conduct each topic which is discussed in the sessions provided at APTRON Gurgaon.
For More Info: AWS Course in Gurgaon
Thanks for sharing useful information.. we have learned so much information from your blog..... keep sharing
AWS training in Chennai
AWS Online Training in Chennai
AWS training in Bangalore
AWS training in Hyderabad
AWS training in Coimbatore
AWS training
Digibrom is the Best Digital Marketing
Training & Services In Bhopal
Digibrom is the Best Digital Marketing Training & Services in Bhopal, providing complete digital growth for your business. We are one of the leading Digital Marketing company in Bhopal, and we are experts in digital marketing & web design. The market penetration along with the use of digital technology is our power. We serve businesses according to the need and requirements of the customers and deliver quality work in time because Digibrom is the best digital marketing training institute in Bhopal and service provider. We create likable content that increases the time spent by the customer on the internet.Digital Marketing is one of the greatest opportunities for a great career. Including lots of opportunities within the field and attractive salaries, it’s the best time to connect a digital marketing Training. These days Digibrom is the Best Digital Marketing Training In Bhopal. it has become a demand for professions to have a solid online presence and for that, people need to get help from digital marketing companies to improve their online appearance. Digibrom is the best digital marketing Training & Services company in Bhopal.
Digital marketing Training in bhopal
Digital marketing course bhopal
I see some amazingly important and kept up to length of your strength searching for in your on the site
data science course
Publicar un comentario