Steps for upgrading an independent cloud disk from Alibaba Cloud

Source: Internet
Author: User
Tags fpm

The system disk space attached to the ECS purchased by Alibaba Cloud is only 20 GB, and the remaining space is gradually reduced. Therefore, an independent cloud disk is purchased (which can be attached between ECS instances in the same zone) it is used to store website data. This article provides a migration note.
Before migration: Stores website programs and data, logs, and MySQL data under/data.
Migration requirements: Migrate all files under/data to an independent cloud disk.

The migration process is as follows:

(1) disable MySQL, Nginx, PHP-FPM services


[Root @ topseek ~] # Service mysqld stop
Shutting down MySQL. [OK]
[Root @ topseek ~] # Service nginx stop
Stopping nginx: [OK]
[Root @ topseek ~] # Service php-fpm stop
Gracefully shutting down php-fpm. done
(2) to minimize the number of configuration files, change "/data" to another name to mount the new independent cloud disk to "/data".

[Root @ topseek ~] # Cd/
[Root @ topseek/] # mv data data2
[Root @ topseek/] # ls
Bin data2 etc lib lost + found mnt proc sbin srv tmp var
Boot dev home lib64 media opt root selinux sys usr
[Root @ topseek/] # mkdir data
[Root @ topseek/] # ls
Bin data dev home lib64 media opt root selinux sys usr
Boot data2 etc lib lost + found mnt proc sbin srv tmp var

(3) partition the new disk


[Root @ topseek] # fdisk-l
 
Disk/dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00078f9c
 
Device Boot Start End Blocks Id System
/Dev/xvda1*1 2611 20970496 83 Linux
 
Disk/dev/xvdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00000000
 
[Root @ topseek ~] # Fdisk/dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x274bb260.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)
 
WARNING: DOS-compatible mode is deprecated. It's stronugly recommended
Switch off the mode (command 'C') and change display units
Sectors (command 'u ').
 
Command (m for help): n
Command action
E extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1-3263, default 1 ):
Using default value 1
Last cylinder, + cylinders or + size {K, M, G} (1-3263, default 3263 ):
Using default value 3263
 
Command (m for help): wq
The partition table has been altered!
 
Calling ioctl () to re-read partition table.
Syncing disks.
[Root @ topseek ~] # Fdisk-l
 
Disk/dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x00078f9c
 
Device Boot Start End Blocks Id System
/Dev/xvda1*1 2611 20970496 83 Linux
 
Disk/dev/xvdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x274bb260
 
Device Boot Start End Blocks Id System
/Dev/xvdb1 1 3263 26210016 83 Linux

(4) format the partition and mount it to "/data"


[Root @ topseek ~] # Mkfs. ext4/dev/xvdb1
Mke2fs 1.41.12 (17-May-2010)
Filesystem label =
OS type: Linux
Block size = 4096 (log = 2)
Fragment size = 4096 (log = 2)
Stride = 0 blocks, Stripe width = 0 blocks
1638400 inodes, 6552504 blocks
327625 blocks (5.00%) reserved for the super user
First data block = 0
Maximum filesystem blocks = 4294967296
200 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,
4096000
 
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs-c or-I to override.
 
[Root @ topseek/] # vim/etc/fstab
#
#/Etc/fstab
# Created by anaconda on Thu Aug 14 21:16:42 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info
#
UUID = 94e4e384-0ace-437f-bc96-057dd64f42ee/ext4 ULTS ults, barrier = 0 1
Tmpfs/dev/shm tmpfs defaults 0 0
Devpts/dev/pts devpts gid = 5, mode = 620 0 0
Sysfs/sys sysfs defaults 0 0
Proc/proc defaults 0 0
None/proc/xen xenfs defaults 0 0
/Dev/xvdb1/data ext4 defaults 0 0
/Boot/swapfile none swap sw 0 0
 
[Root @ topseek data2] # mount/dev/xvdb1/data
[Root @ topseek data2] # df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/xvda1 20G 14G 4.8G 75%/
Tmpfs 498 M 0 498 M 0%/dev/shm
/Dev/xvdb1 25G 44 M 24G 1%/data

(5) copy data to the new disk


[Root @ topseek data2] # cd/data2
[Root @ topseek data2] # cp-a./*/data
[Root @ topseek data2] # df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/xvda1 20G 14G 4.8G 75%/
Tmpfs 498 M 0 498 M 0%/dev/shm
/Dev/xvdb1 25G 6.4G 17G 28%/data
[Root @ topseek/] # \ rm-rf/data2
[Root @ topseek/] # df-lh
Filesystem Size Used Avail Use % Mounted on
/Dev/xvda1 20G 7.5G 12G 41%/
Tmpfs 498 M 0 498 M 0%/dev/shm
/Dev/xvdb1 25G 6.4G 17G 28%/data

(6) restart the service and complete the migration.


[Root @ topseek data] # service mysqld start
Starting MySQL... [OK]
[Root @ topseek data] # service php-fpm start
Starting php-fpm done
[Root @ topseek data] # service tengine start
Starting nginx: [OK]

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.