diff --git a/README.md b/README.md index 543a01bf8b03b42b3b4e2311ec9e0aecd21d5023..da3090c78d24dca9bc20301e73a3bc0542090623 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,43 @@ -Copying /var/lib/mysql to a New Volume and Volume Migration -This documentation provides step-by-step instructions for copying the /var/lib/mysql directory to a new volume and migrating the volume from one OpenStack node to another using OpenStack commands. +# Copying `/var/lib/mysql` to a New Volume and Volume Migration -Prerequisites -Access to an OpenStack environment with the necessary permissions to create volumes and manage instances. -A running OpenStack node with an instance containing the /var/lib/mysql directory. +This documentation provides step-by-step instructions for copying the `/var/lib/mysql` directory to a new volume and migrating the volume from one OpenStack node to another using OpenStack commands. -Copying /var/lib/mysql to a New Volume -Log in to the OpenStack command-line interface (CLI) or a terminal with OpenStack CLI access. +## Prerequisites +- Access to an OpenStack environment with the necessary permissions to create volumes and manage instances. +- A running OpenStack node with an instance containing the `/var/lib/mysql` directory. -Create a new volume using the OpenStack CLI: -openstack volume create --size <new_volume_size> <new_volume_name> +## Copying `/var/lib/mysql` to a New Volume -Attach the new volume to the instance that contains the /var/lib/mysql directory -openstack server add volume <instance_id> <new_volume_id> +1. Log in to the OpenStack command-line interface (CLI) or a terminal with OpenStack CLI access. -Log in to the instance and mount the new volume: -ssh <instance_ip_address> -sudo mkdir /mnt/new_volume -sudo mount /dev/vdb /mnt/new_volume +2. Create a new volume using the OpenStack CLI: + openstack volume create --size <new_volume_size> <new_volume_name> -Copy the contents of /var/lib/mysql to the new volume: -sudo cp -a /var/lib/mysql/* /mnt/new_volume +3. Attach the new volume to the instance that contains the `/var/lib/mysql` directory: + openstack server add volume <instance_id> <new_volume_id> +4. Log in to the instance and mount the new volume: + ssh <instance_ip_address> + sudo mkdir /mnt/new_volume + sudo mount /dev/vdb /mnt/new_volume -Migrating a Volume from One Node to Another +5. Copy the contents of `/var/lib/mysql` to the new volume: + sudo cp -a /var/lib/mysql/* /mnt/new_volume -Detach the original volume from the instance: -openstack server remove volume <instance_id> <original_volume_id> +## Migrating a Volume from One Node to Another -Create a new instance on the target node: -openstack server create --flavor <instance_flavor> --image <instance_image> --availability-zone <target_availability_zone> --volume <original_volume_id> <new_instance_name> +1. Detach the original volume from the instance: + openstack server remove volume <instance_id> <original_volume_id> -Wait for the new instance to be in the ACTIVE state: -openstack server show <new_instance_id> -f value -c status +2. Create a new instance on the target node: + openstack server create --flavor <instance_flavor> --image <instance_image> --availability-zone <target_availability_zone> --volume <original_volume_id> <new_instance_name> -Log in to the new instance: -ssh <new_instance_ip_address> +3. Wait for the new instance to be in the ACTIVE state: + openstack server show <new_instance_id> -f value -c status -Mount the volume on the new instance: -sudo mkdir /mnt/original_volume -sudo mount /dev/vdb /mnt/original_volume +4. Log in to the new instance: + ssh <new_instance_ip_address> + +5. Mount the volume on the new instance: + sudo mkdir /mnt/original_volume + sudo mount /dev/vdb /mnt/original_volume