ECS uses snapshot to create disk for lossless expansion data disk

Source: Internet
Author: User

1. Log on to the server to pause service, nginx+php+mysql+ Search service
2. Modify MySQL Parameters

#vi/etc/my.cnf "mysqld" DataDir=/alidata/mysqldataserver_id=2"  ROW"

3. First create a snapshot based on the current data disk, backup data, and can use this snapshot directly to create a separate cloud disk to save data back and forth copy time
4. Open the purchase page for the standalone cloud disk (https://ecs-buy.aliyun.com/#/clouddisk), select the region of the same availability zone as the ECS, purchase a separate cloud disk, choose to create a disk with a snapshot directly at the time of purchase, and use the snapshot in the first step.

5. Open the ECS Console disk page, locate the standalone cloud disk you just purchased, and attach the standalone cloud disk to ECS in more options.

6, log on to the server, use the Mount command to mount the standalone cloud disk to the system and see if the files are consistent with the data disk.

#mkdir//dev/vdc1/bak

7, the original disk for the expansion

8, determined that the data in the independent cloud disk is correct, first use Fdisk to delete the original partition table, and then use Fdisk, MKFS.EXT3 and so on to partition the data disk, format operation, so that the disk's free space becomes the size after expansion.

#fdisk/dev/vdb        m    d    -l              /dev/vdb1    is busy, running fuser-m-v/dev /-H            -/dev/vdb        /dev//dev//dev/vdb1/ ALIDATA/EXT3 >>/etc/fstab

9, then through the cp-r command to copy the data in the independent cloud disk all back to the data disk, you can add the--preserve=all parameter, copying the properties of the file.

#cp-R/bak/*  /alidata/--preserve=all

10. See if the copy is complete

#df-H

11, start the service, return to normal

Start MySQL if starting MySQL appears. The server quit without updating PID file ([failed]/server/mysql/data/xxxx.pid).
Modifying the MY.CNF
Add Datadir=/alidata/mysqldata

12. Umount The independent cloud disk in ECS

#umount/DEV/VDC1

13, uninstall the independent cloud disk in the disk console of ECS, uninstall and then select Release (First uninstall, then release), the operation is complete.

ECS uses snapshot to create disk for lossless expansion data disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.