Search code examples
azurevirtual-machinegeth

Add a disk to a Linux VM


I want to start geth on a new VM. I already have geth running in archival mode in another VM. I have synced up to 6 million blocks on the existing VM. Is there a way I can take the data disk from the existing VM and attach it to the new VM. So that when I start geth on the new VM it will take the latest block synced from the disk and start after 6 millionth block.

I have tried shutting of my VM and taking a snapshot of the data disk and then attaching it to the new VM. But after mounting the disk on the new VM, it seems like the chaindata has been erased. Am I missing something while attaching the disk ? I have followed the following documentation to attach the disk: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/add-disk

Also I am using Azure platform for my VM and the VMs have Linux Operating systems. Thanks!


Solution

  • For your issue, I test the data disk copy and it works well with nothing disappear. The steps below.

    1. Dettach the data disk which you want to copy.
    2. Create a snapshot from the data disk.
    3. Create a data disk copy from the snapshot.
    4. Attach the copy data disk to the new VM.

    Try it again following the steps above.