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