Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Copia el sistema de archivos de la máquina de origen
La modernización de un componente de aplicación requiere la creación de una copia del sistema de archivos de la máquina de origen.
En esta página, se describen los pasos necesarios para copiar el sistema de archivos de la máquina de origen
junto con algunas especificaciones para reducir el tamaño del sistema de archivos copiado.
Crea una copia local del sistema de archivos de la máquina de origen de Linux
La CLI de Migrate to Containers admite el acceso a máquinas de origen con una conexión SSH directa o el uso de gcloud.
SSH directo
Para copiar mediante el acceso directo mediante SSH, ejecuta el siguiente comando:
OUTPUT_FILESYSTEM_DIR: la ruta de acceso del resultado del directorio en tu máquina local en el que deseas copiar el sistema de archivos de la máquina de origen.
Si la máquina de origen no tiene una IP pública, puedes realizar una de las siguientes acciones:
Si ejecutas la CLI de Migrate to Containers desde una máquina en la misma red interna, usa la marca --internal-ip.
Si ejecutas en una red diferente, usa la marca --tunnel-through-iap.
Una vez que se completa la copia, hay una copia del sistema de archivos de la máquina de origen disponible en el directorio de salida especificado.
Reduce el tamaño del sistema de archivos copiado
Según la máquina de origen, el sistema de archivos copiado puede ser muy grande. Cuanto más grande sea la copia, más tiempo tardará en completarse cada operación y, si no hay suficiente espacio, la operación de copia fallará.
La CLI de Migrate to Containers aplica filtros para reducir el tamaño de la copia, pero con un conocimiento determinado del componente de la aplicación, puedes modificar los filtros para reducir aún más el tamaño de la copia.
Cuando vuelves a ejecutar el comando copy con los filtros modificados, el contenido del directorio de salida se actualiza según los cambios que aplicaste en el archivo de filtro.
Para modificar los filtros predeterminados, sigue estos pasos:
Obtén una lista de los filtros predeterminados:
./m2c copy default-filters > filters.txt
Edita el archivo filters.txt para quitar directorios irrelevantes. El archivo usa el formato de regla de filtro rsync, como se especifica en la página de documentación de rsync.
Usa la marca --filters para especificar el archivo de filtro con el comando copy.
Crea una copia local del sistema de archivos de la máquina de origen de Windows
En las máquinas de origen de Windows, debes copiar las imágenes de disco en formato VHD o VHDX
para el proceso de migración. Sin embargo, la CLI de Migrate to Containers no admite la exportación de imágenes de disco desde la plataforma de origen a la máquina local.
Para exportar un disco de instancia de máquina virtual (VM) de Compute Engine, primero
debes crear una imagen desde el disco y, luego, exportarla a la máquina local.
Para exportar una imagen desde Compute Engine, realiza los siguientes pasos:
Para exportar imágenes de disco de VM de VMware, primero completa los pasos para
exportar una imagen a un archivo VMDK. Luego, convierte el archivo VMDK en
un archivo VHD mediante herramientas de terceros, como qemu-img.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[],[],null,["# Copy the source machine's file system\n=====================================\n\nModernization of an application component requires\ncreating a copy of the source machine's file system.\n\nThis page describes the steps required to copy the source machine's file system\nalong with some specifications for reducing the size of the copied file system.\n\nCreate a local copy of the Linux source machine file system\n-----------------------------------------------------------\n\nThe Migrate to Containers CLI supports access to source machines using either direct\nSSH connection or by using `gcloud`.\n**Note:** The user that you use to access the source machine must be a sudoer to be able to access all files and directories relevant to modernization. If sudo is disabled for all users including root, use the root user and use the flag `--remote-sudo=false`. \n\n### Direct SSH\n\nTo copy using direct SSH access, run the following command: \n\n ./m2c copy ssh [\u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e@]\u003cvar translate=\"no\"\u003eHOSTNAME\u003c/var\u003e \\\n -i \u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY\u003c/var\u003e \\\n -o \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: your username\n- \u003cvar translate=\"no\"\u003eHOSTNAME\u003c/var\u003e: the hostname\n- \u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY\u003c/var\u003e: the path to private key\n- \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e: the path for the output directory on your local machine where you want to copy the source machine's file system\n\n### gcloud\n\nIf the source machine has a public IP, run the following command: \n\n ./m2c copy gcloud \\\n -p \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n -z \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n -o \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone of your VM\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the source VM\n- \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e: the path for the directory output on your local machine where you want to copy the source machine's file system\n\nIf the source machine doesn't have a public IP, you can do one of the following:\n\n- If you are running the Migrate to Containers CLI from a machine in the same internal network, Use the `--internal-ip` flag.\n- If you are running on a different network, use the `--tunnel-through-iap` flag.\n\nFor more information about these flags, see the\n[gcloud documentation](/sdk/gcloud/reference/compute/ssh#:%7E:text=can%20be%20specified%3A-,%2D%2Dinternal%2Dip,-Connect%20to%20instances).\n\nAfter the copy is complete, a copy of the source machine's file system is\navailable in the specified output directory.\n\n### Reduce the size of the copied file system\n\nDepending on the source machine, the copied file system might be very large. The\nlarger the copy, the longer it takes for each operation to complete and, if\nthere's not enough space, the copy operation fails.\n\nThe Migrate to Containers CLI applies filters to reduce the size of the copy,\nbut with the given knowledge of the application component, you can modify the\nfilters to further reduce the size of the copy.\n\nWhen you run the `copy` command again with the modified filters, the contents of\nthe output directory are updated according to the changes you applied in the\nfilter file.\n\nTo modify the default filters, follow these steps:\n\n1. Get a list of the default filters:\n\n ./m2c copy default-filters \u003e filters.txt\n\n2. Edit the file `filters.txt` to remove irrelevant directories. The file uses\n the `rsync` filter rule format, as specified in the [`rsync` documentation page](https://linux.die.net/man/1/rsync#Filter%20Rules).\n\n3. Use the `--filters` flag to specify the filter file with the `copy` command.\n\n ### Direct SSH\n\n ./m2c copy ssh [\u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e@]\u003cvar translate=\"no\"\u003eHOSTNAME\u003c/var\u003e \\\n -i \u003cvar translate=\"no\"\u003ePATH_TO_PRIVATE_KEY\u003c/var\u003e \\\n -o \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e \\\n --filters filters.txt\n\n ### gcloud\n\n ./m2c copy gcloud \\\n -p \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n -z \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n -o \u003cvar translate=\"no\"\u003eOUTPUT_FILESYSTEM_DIR\u003c/var\u003e \\\n --filters filters.txt\n\nCreate a local copy of the Windows source machine file system\n-------------------------------------------------------------\n\nFor Windows source machines, you need to copy the disk images in VHD or VHDX\nformat for the migration process. However, Migrate to Containers CLI does not support\nexporting disk images from your source platform to your local machine.\n\n- To export a Compute Engine virtual machine (VM) instance disk, first\n [create an image from the disk](/compute/docs/instances/windows/creating-windows-os-image)\n and then export the image to the local machine.\n\n- To export an image from Compute Engine, perform the following steps:\n\n 1. Export the image to Cloud Storage using the [`gcloud compute images export` command](/sdk/gcloud/reference/compute/images/export):\n\n ```\n gcloud compute images export \\\n --export-format vhdx \\\n --destination-uri DESTINATION_URI \\\n --image IMAGE_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDESTINATION_URI\u003c/var\u003e: the Cloud Storage URI destination for the exported image file.\n - \u003cvar translate=\"no\"\u003eIMAGE_NAME\u003c/var\u003e: the name of the disk image to export.\n 2. Download the image on your local machine:\n\n ```\n gcloud storage cp DESTINATION_URI LOCAL_PATH\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eDESTINATION_URI\u003c/var\u003e: the Cloud Storage URI destination of the exported image file\n - \u003cvar translate=\"no\"\u003eLOCAL_PATH\u003c/var\u003e: the path to the local folder where you want to download the image\n\n For more information, see [Export a custom image to Cloud Storage](/compute/docs/images/export-image).\n- For more information on exporting Amazon EC2 images, see\n [Exporting an instance as a VM using VM Import/Export](https://docs.aws.amazon.com/vm-import/latest/userguide/vmexport.html).\n\n | **Note:** When you create the JSON file for exporting an image, omit the `ContainerFormat` field, and set `DiskImageFormat` to `\"VHD\"`.\n- For more information on exporting Azure Cloud Compute images, see\n [Download a Windows VHD from Azure](https://learn.microsoft.com/en-us/azure/virtual-machines/windows/download-vhd?tabs=azure-portal).\n\n- To export VMware VM disk images, first complete the steps to\n [export an image to a VMDK file](https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere-lifecycle-manager.doc/GUID-A3E9D4BA-CAAC-4F2C-B97F-C0904ECE5E14.html). Then, convert the VMDK file to\n a VHD file using third-party tools such as [qemu-img](https://cloudbase.it/qemu-img-windows/).\n\nWhat's next\n-----------\n\n- Learn how to [create a migration plan](/migrate/containers/docs/m2c-cli/create-a-migration-plan)."]]