Migrate data

During the migration process, you can choose whether you want to migrate data or not. By default, your data configuration file (my-migration.data.yaml) is empty, and so no data is migrated. When you migrate data, you can include paths to extract your data to persistent storage. Follow the steps on this page to modify your data configuration file, and specify how you want to migrate data.

Supported workloads:

  • Linux
  • Tomcat
  • WebSphere traditional
  • JBoss
  • Apache Container

Customize your data migration configuration

To enable data migration in your migration process, you'll need to provide information about your target data volume or data claim in your data configuration file (my-migration.data.yaml). Use the format indicated below:

volumes:
- deploymentPvcName: my-pvc1
  existingPvc:
    name: my-pvc1
  folders:
  - /bin
  - /opt
- deploymentPvcName: my-pvc2
  newPvc:
   spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 10G
  folders:
  - /bin
  - /opt

Where:

  • deploymentPvcName: The persistent volume claim (PVC) name to be used by Migrate to Containers in your deployed workload to access this volume.

  • existingPvc:

    • name: Name of an existingpersistent volume claim (PVC). Define if you want to migrate data volumes to an existing PVC. Must be nil otherwise.
  • newPvc: Define if you want to migrate your data volumes to a new PVC. You can define your PVC using the standard PVC spec syntax.

    For more information about Kubernetes PVC spec, see the Kubernetes documentation.

  • folders: the folder you want to migrate from vm to PVC. These folders are copied to the pvc in the same path.

You can edit your data configuration file for several data migration use cases, including:

Use an existing PersistentVolumeClaim (PVC)

If you've already allocated the storage for your migrated data, and have a PersistentVolumeClaim (PVC) to store your data, you can migrate your data using an existing PVC.

Define an existing PVC in your data configuration file (my-migration.data.yaml) by passing your existing volume in the existingPvc field. In this case, your data configuration file would look like this:

volumes:
- deploymentPvcName: my-pvc
  existingPvc:
    name: my-pvc
    subpath: /subpath
  folders:
  - /bin
  - /opt

In the previous sample, the existingPvc entry can contain an optional subPath to migrate data to the subpath of the PVC, as shown.

Create new data volumes on your migrated VMs

If you have not allocated storage ahead of time, and you want your storage to be created during the migration process, you can pass an empty existingPvc field and specify the storage you would like to be created in the newPvc field:

volumes:
- deploymentPvcName: my-pvc
  newPvc:
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 10G
  folders:
  - /bin
  - /opt

There are two options here, for basic and advanced users:

Migrate multiple PVCs with multiple filepaths

You can specify the set of directories under the folders list field of each entry in the volume list for each PVC listed in your data configuration file (my-migration.data.yaml):

volumes:
- deploymentPvcName: my-pvc1
  existingPvc:
    name: my-pvc1
  folders:
  - /bin
  - /opt
- deploymentPvcName: my-pvc2
  newPvc:
   spec:
    accessModes:
    - ReadWriteOnce
    resources:
     requests:
       storage: 10G
  folders:
  - /bin
  - /opt

The paths you list under folders in the configuration file are copied to the same paths in the target PVCs.

Upload your data migration configuration

After you have edited the data configuration file, to upload the updated file, run the following command:

migctl migration update my-migration --data-config my-migration.data.yaml

What's next