首页 > 其他分享 >Migrating VMs Between ESXI Servers Using SCP Command

Migrating VMs Between ESXI Servers Using SCP Command

时间:2025-01-07 12:45:02浏览次数:1  
标签:NAME ESXI VM server vmdk SSH Servers SCP

Migrating VMs Between ESXI Servers Using SCP Command

July 25, 2022

FileCloud customers may choose to use a virtual machine (VM) in an ESXI server. At times, ESXI servers may be decommissioned, requiring a migration. When FileCloud is hosted on one ESXI server, it can be moved to another using this method. This is generally a bare metal migration. Yet migrating VMware ESXI servers has always […]

 

FileCloud customers may choose to use a virtual machine (VM) in an ESXI server. At times, ESXI servers may be decommissioned, requiring a migration. When FileCloud is hosted on one ESXI server, it can be moved to another using this method. This is generally a bare metal migration.

Yet migrating VMware ESXI servers has always been difficult, at times even requiring the use of a third-party paid application. In this blog, we discuss a simple method to transfer VMs using the basic SCP command. We also ensure that the transferred VM disks are configured in thin provisioning.

Follow the steps below to migrate the ESXi servers:

Enable SSH Service on Source and Destination ESXI Servers

To enable the SSH service, log in to the web interfaces for your ESXI servers. Then click on Host at the top right. Click Actions -> Services -> Enable Secure Shell (SSH) (if it is not already enabled).

Enable SSH Client Service on Source ESXI Server.

Log in to the SSH of the source ESXI server using the putty tool. You may need to run the below commands:

esxcli network firewall ruleset list --ruleset-id sshClient

Check if the SSH client service is enabled. If disabled, the command will return a result of ‘False’. If a ‘False’ response is returned, run this next command. If ‘False’ is not the returned response, proceed to the next step!

esxcli network firewall ruleset set --ruleset-id sshClient --enabled=true

Copy the VM from Source to Destination

Before running the below commands, make sure the VM that will be migrated is turned off in the source ESXI server.

Connect to your source ESXI server using putty or your favorite SSH client (depending on Windows or Mac OS).

Navigate to your datastore where your guest VM resides. By default, it will show as below.

cd /vmfs/volumes/datastore1/

Next, migrate the data to the proper datastore path in the Destination VM.

Afterward, execute the below command in the source ESXI server:

scp -rv /vmfs/volumes/datastore1/VM_NAME root@xx.xx.xx.xx:/vmfs/volumes/datastore1/

Press ‘Enter.’ You should be prompted for a password – then the migration process will begin. The time to complete the transfer depends on the network speed between the ESXI servers.

Convert Thick Provisioning to Thin Provisioning

Log in to your SSH console of the destination server. Then, navigate to the datastore path where the new VM data will be migrated from the old server.

cd /vmfs/volumes/datastore1/ VM_NAME

Run the below command to clone the VMDK to a thin provisioned disk using vmkfstools

vmkfstools -i VM_NAME.vmdk -d thin VM_NAME -thin.vmdk.

After the cloning is complete, list the files in the directory and verify that two files were created:

VM_NAME.vmdk and VM_NAME -thin.vmdk.

Rename the old flat file to a different name (e.g., mv VM_NAME-flat.vmdk VM_NAME-flat.vmdk.old)

Rename the new flat file to a different name (e.g., mv VM_NAME-thin-flat.vmdk VM_NAME-flat.vmdk)

Register the Migrated VM on the ESXI Host

Log in to the web interface of the destination ESXI server where the VM was migrated from the source server.

Click on Virtual Machines --> Create/Register VM

Select ‘Register an Existing Virtual Machine.' Then select one or more virtual machines, a datastore, or a directory. Select the folder of the VM Guest you moved to the new server. Click: Select --> Next --> Finish

Once you turn on the migrated VM in the destination ESXI server for the first time, you will be prompted to answer if you moved or copied the guest machine. Leave the default “I Copied It” and click “Answer.”

If the migration was completed without any errors, the VMs should start in the new host.

 

Article written by Nandakumar Chitra Suresh and Katie Gerhardt

标签:NAME,ESXI,VM,server,vmdk,SSH,Servers,SCP
From: https://www.cnblogs.com/mouseleo/p/18657409

相关文章

  • 如何备份和还原 ESXi 主机配置
    原文地址https://knowledge.broadcom.com/external/article?legacyId=2042141 产品VMwarevSphereESXi问题/介绍本文提供备份和恢复ESXi主机配置的步骤。环境VMwarevSphereESXi8.xVMwarevSphereESXi7.xVMwarevSphereESXi6.x解决需......
  • Esxi缩小硬盘大小的办法.240109
    1.​进虚拟机,把要缩减硬盘的那个系统,磁盘管理,收缩卷收缩了。然后关机。本例:调整800G到350G。2.Esxi打开ssh,进去。cd/vmfs/volumes/<datastorename>/<VMfolder_name>datastorename,完全靠猜,ls-lrt看下大小,捡大点的cd进去看看是哪个。本例:/vmfs/volumes/643e1d69-1d07799......
  • 欧拉OpenEuler下SSH或SCP免密连接配置方法.241230
    以下操作均在本地服务器上进行:一、生成公钥和私钥ssh-keygen-trsa二、将公钥复制到远程服务器ssh-copy-idusername@remote_server三、配置免密登录sshusername@remote_server四、虽然免密登录提高了工作效率和安全性,但也有一些注意事项需要牢记。首先,务必保护好你......
  • SCP(Secure Copy Protocol)
    SCP是基于SSH协议的一种文件传输工具,它通过在远程和本地系统之间建立安全的连接,实现文件的复制和移动。从本地传输文件到远程主机:scp[本地文件路径][远程用户名]@[远程主机地址]:[远程文件路径]从远程主机传输文件到本地:scp[远程用户名]@[远程主机地址]:[远程文件路......
  • VMware ESXi 8.0U3c macOS Unlocker & OEM BIOS Huawei (华为) 定制版
    VMwareESXi8.0U3cmacOSUnlocker&OEMBIOSHuawei(华为)定制版ESXi8.0U3c标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)、Huawei(华为)、xFusion(超聚变)OEM定制版请访问原文......
  • VMware ESXi 8.0U3c macOS Unlocker & OEM BIOS 集成驱动版,新增 12 款 I219 网卡驱动
    VMwareESXi8.0U3cmacOSUnlocker&OEMBIOS集成网卡驱动和NVMe驱动(集成驱动版)发布ESXi8.0U3c集成驱动版,在个人电脑上运行企业级工作负载请访问原文链接:https://sysin.org/blog/vmware-esxi-8-u3-sysin/查看最新版。原创作品,转载请保留出处。发布ESXi8.0......
  • VMware ESXi 8.0U3c macOS Unlocker & OEM BIOS 标准版和厂商定制版,已适配主流品牌服
    VMwareESXi8.0U3cmacOSUnlocker&OEMBIOS标准版和厂商定制版ESXi8.0U3c标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)定制版、Huawei(华为)OEM定制版请访问原文链接:https://sysin.or......
  • 不使用docker push ,使用docker save 打包成tar文件,scp到服务器上,应对离线环境
    如果你不想使用dockerpush,而是希望将本地Docker镜像打包成tar文件,并通过scp将其传输到目标服务器上,你可以按照以下步骤操作:1.在本地打包Docker镜像为tar文件首先,在本地构建并打包你的Docker镜像。假设你的镜像名称为fastapi-app。构建Docker镜像:如果......
  • VMware ESXi 8.0U3c macOS Unlocker & OEM BIOS xFusion (超聚变) 定制版
    VMwareESXi8.0U3cmacOSUnlocker&OEMBIOSxFusion(超聚变)定制版ESXi8.0U3c标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)、Huawei(华为)、xFusion(超聚变)OEM定制版请访问原文链接......
  • 欧拉OpenEuler下SSH或SCP免密连接配置方法
    以下操作均在本地服务器上进行:一、生成公钥和私钥ssh-keygen-trsa二、将公钥复制到远程服务器ssh-copy-idusername@remote_server三、配置免密登录sshusername@remote_server四、虽然免密登录提高了工作效率和安全性,但也有一些注意事项需要牢记。首先,务必保护好你......