azureubuntuazure-virtual-machineazure-disk

Transferring Data from Data Disk (Classic) to New Data Disc


I need to copy specific directories from an Azure data disc (classic) attached to a classic VM to a new data disk attached to a new Linux (Ubuntu) VM. What is the simplest way to move this data (~200GB) from one to the other? The drives are located in different regions. Once the data is copied, the classic resources will be shut down.

Currently, I've attempted to move the data using WINSCP, but of course, that solution is very slow, I've done some research on copying data using AZcopy, but I'm unsure if this is really the simplest solution or if I'm over complicating it by using tools like that.


Solution

  • Transferring Data from Data Disk (Classic) to New Data Disc

    To transfer files from one Ubuntu VM to another VM, there are multiple ways, but the best approaches are listed below

    Method 1: Using SCP

    Note: The SCP method should work only if both VMs are able to communicate with each other.

    To copy the datadisk files to another VM data Disk.

    1. Install Nettools on both the Vms using below command
        sudo apt install net-tools
    
    1. Once installed, run the command below to copy all files from VM1's data disk to VM2's data disk.
     scp -r /data/*  Venkat@10.0.0.7:/data
    
     -r: for copy  entire directory
     /data/* : Path of the VM1
     Venkat@10.0.0.7: VM2 username and IP
     /data: Path of VM2
     ```
    

    Result: enter image description here

    Files are copied to VM2 data disk successfully.

    enter image description here

    Method 2 : AzCopy

    1. Install AzCopy on both VM1 and VM2. Follow this link to install AzCopy 2.Create a Storage accountwith container. 3 . Log in to AzCopy on VM1 to copy the files to the storage account using the command below.
     azcopy copy "/data/*" "https://vmstoragetestdemo.blob.core.windows.net/vmstorage<Storage account-SAS-Token>" --recursive=true
    

    "/data/*" : path of VM1 Datadisk

    Data copied to Storage account from VM1 datadisk

    enter image description here

    1. Log in to VM2 using the azcopy login command
    2. Run the command below to copy the files to the VM2 data disk.
     azcopy copy "https://vmstoragetestdemo.blob.core.windows.net/vmstorage<SAS_TokeN>" "/data" --recursive=true
    
    /data : VM2 Data disk path
    

    Files are copied to VM2 datadisk successfully.

    enter image description here

    Reference: scp command to copy the files