Skip to content
Snippets Groups Projects
Commit 7a18455c authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

Update README.md

parent ece6f836
No related branches found
No related tags found
No related merge requests found
Copying /var/lib/mysql to a New Volume and Volume Migration # 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.
Prerequisites 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.
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.
Copying /var/lib/mysql to a New Volume ## Prerequisites
Log in to the OpenStack command-line interface (CLI) or a terminal with OpenStack CLI access. - 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: ## Copying `/var/lib/mysql` to a New Volume
openstack volume create --size <new_volume_size> <new_volume_name>
Attach the new volume to the instance that contains the /var/lib/mysql directory 1. Log in to the OpenStack command-line interface (CLI) or a terminal with OpenStack CLI access.
openstack server add volume <instance_id> <new_volume_id>
Log in to the instance and mount the new volume: 2. Create a new volume using the OpenStack CLI:
ssh <instance_ip_address> openstack volume create --size <new_volume_size> <new_volume_name>
sudo mkdir /mnt/new_volume
sudo mount /dev/vdb /mnt/new_volume
Copy the contents of /var/lib/mysql to the new volume: 3. Attach the new volume to the instance that contains the `/var/lib/mysql` directory:
sudo cp -a /var/lib/mysql/* /mnt/new_volume 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: ## Migrating a Volume from One Node to Another
openstack server remove volume <instance_id> <original_volume_id>
Create a new instance on the target node: 1. Detach the original volume from the instance:
openstack server create --flavor <instance_flavor> --image <instance_image> --availability-zone <target_availability_zone> --volume <original_volume_id> <new_instance_name> openstack server remove volume <instance_id> <original_volume_id>
Wait for the new instance to be in the ACTIVE state: 2. Create a new instance on the target node:
openstack server show <new_instance_id> -f value -c status 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: 3. Wait for the new instance to be in the ACTIVE state:
ssh <new_instance_ip_address> openstack server show <new_instance_id> -f value -c status
Mount the volume on the new instance: 4. Log in to the new instance:
sudo mkdir /mnt/original_volume ssh <new_instance_ip_address>
sudo mount /dev/vdb /mnt/original_volume
5. Mount the volume on the new instance:
sudo mkdir /mnt/original_volume
sudo mount /dev/vdb /mnt/original_volume
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment