Nik
Nik

Reputation: 83

I would like to change Microsoft Azure Virtual Machine size without losing my data

I am using two Microsoft Azure Virtual Machines (marked as classic), both running on Linux. One is used for test purposes and internal demos, the other is production and running few of clients' instances.

What I would like to do is change the size of Virtual Machine. I understand this is quite common process and can easily be done from the Azure Management Portal and that this is not affecting data. However, when I have changed the size of our testing machine, exactly this has happened and we have lost all data.

Azure Support answer received was: "We recommend you delete the VM by keeping the attached disks and create a new VM with the required size." Not sure why this would be better?

Upvotes: 5

Views: 3460

Answers (2)

Ghassan Zein
Ghassan Zein

Reputation: 4189

You have more than one way to do that and keep in mind what David said, data on OS disks, attached disks and blobs is the only durable one.

To prevent losing data and since you're using Classic VMs, you can do the following:

1- Go to your VM on portal and capture an image out of it.

2- Go to your new image and create a new VM out of it, while specifying the new specs that you need.

3- When done, connect to your new VM while keeping the old one without termination.

4- Check if all your data is there, if yes, then you can remove the old one. (In case you need the old IP, you can still assign it to the new one).

Cheers.

Upvotes: 0

David Makogon
David Makogon

Reputation: 71130

Any data stored on the ephemeral (internal-to-chassis) scratch disk is at risk, as it's a non-durable disk (and will in all likelihood be destroyed/recreated upon resizing a VM).

The only way to have durable data is to use Azure Storage (blobs, vhd as attached disk, Azure File storage) or external database. Azure Storage is durable (minimum 3 copies), and is not stored with your VM.

One more thing: The VM's OS Disk is a VHD in Azure Storage (so the OS disk is durable, just like attached vhd's).

Upvotes: 3

Related Questions