开发者社区> 问答> 正文

ECS AZ迁移手册-- CentOS6.5


[font="]1.[size=; font-size: 7pt,7pt][font='Times New Roman']     [font="]登陆阿里云控制台 [font="]https://ecs.console.aliyun.com [font="],找到待迁移的ECS实例,点击进入这个ECS的管理页面
[font="]

[font="]

[size=font-size: 10pt,10pt] 1.[size=; font-size: 7pt,7pt][font='Times New Roman']   [size=font-size: 10pt,10pt] 在业务访问少的时候,在线手动做第一次系统盘和数据盘快照。[size=font-size: 9pt,9pt]
[size=font-size: 10pt,10pt] 如果之前没有对数据盘和系统盘做过快照(包括自动快照),建议做这个步骤,这个步骤会在线做一次全量数据的系统盘和数据盘快照,为后面离线做增量数据的快照减少停服时间。当前打快照对业务的性能已经进行了优化。
[size=font-size: 10pt,10pt] 1.[size=; font-size: 7pt,7pt][font='Times New Roman']      [size=font-size: 10pt,10pt] 停下ECS里面的业务系统, 在umount数据盘,注释fstab里面的挂载记录,再停止ECS服务器,同时对系统盘和数据盘做快照  
[font="]停ECS服务器,对数据盘和系统盘打快照主要是考虑业务系统可能同时对多个磁盘同时写数据,为保持业务数据在多个磁盘一致性,停ECS。[size=font-size: 9pt,9pt]

[font="]Linux [font="]在创建快照前 [font="]把Linux下的数据盘都unmount [font="],然后在打快照和创建自定义镜像,否则有可能造成以该自定义镜像创建的云服务器不能启动和使用。 [font="]Unmount [font="]数据盘的步骤如下:
[size=font-size:9.0pt,9.0pt] l[size=; font-size: 7pt,7pt][font='Times New Roman'] [size=font-size:10.5pt,10.5pt] [font="]查看数据盘
[size=font-size:9.0pt,9.0pt] [font="]通过df这个命令可以查看磁盘的使用情况以及文件系统被挂载的位置,示例:df –lh
fdisk能获得机器中所有的硬盘的分区情况,示例:fdisk -l
[size=font-size:9.0pt,9.0pt] [font="]
[size=font-size:9.0pt,9.0pt] l[size=; font-size: 7pt,7pt][font='Times New Roman'] [size=font-size:10.5pt,10.5pt] [font="]umount[size=font-size:10.5pt,10.5pt] [font="]和删除disk table里的数据
[size=font-size:9.0pt,9.0pt] [font="]譬如 /dev/xvdb1 已经挂载在/mnt上,用一下三条命令均可卸载挂载的文件系统:
umount /dev/xvdb1

[size=font-size:9.0pt,9.0pt] [font="]umount /mnt
/etc/fstab
[size=font-size:9.0pt,9.0pt] [font="]是Linux下比较重要的配置文件,它包含了系统在启动时挂载文件系统和存储设备的详细信息。
如果不想在VM启动的时候挂载指定分区,需要在这个文件里面删除对应的行,删除下述语句可以在启动的时候断开xvdb1
/dev/xvdb1  /mnt ext4    defaults   0  0

[size=font-size:9.0pt,9.0pt] l[size=; font-size: 7pt,7pt][font='Times New Roman'] [size=font-size:10.5pt,10.5pt] [font="]确认数据盘已经卸载,并可以开始创建自定义镜像?
[size=font-size:9.0pt,9.0pt] [font="]需要确认fstab文件里面对应的自动挂载数据盘分区语句行已经删除
使用mount命令可以查看所有设备的挂载信息,请确认执行结果中不包含对应的数据盘分区信息

[size=font-size:9.0pt,9.0pt] l[size=; font-size: 7pt,7pt][font='Times New Roman'] [size=font-size:9.0pt,9.0pt] [font="]
[font="]
[size=font-size:10.5pt,10.5pt] [font="]2.[size=; font-size: 7pt,7pt][font='Times New Roman']     [font="]用户在控制台基于当前的AZ1上的ECS实例的磁盘系统盘和数据盘分别创建快照。[size=font-size:10.5pt,10.5pt] [font="]
[font="]

[font="]

[font="]

[size=font-size:10.5pt,10.5pt] [font="]1.[size=; font-size: 7pt,7pt][font='Times New Roman']     [font="]从上面的创建的系统盘快照创建自定义镜像[size=font-size:10.5pt,10.5pt] [font="]
[font="]
[font="]导航到实例的快照列表,找到上面创建的系统盘快照信息,点击创建自定义镜像。[size=font-size:10.5pt,10.5pt] [font="]
[font="]

[font="]

[font="]
[size=font-size:10.5pt,10.5pt] [font="]1.[size=; font-size: 7pt,7pt][font='Times New Roman']    [size=font-size:10.5pt,10.5pt] [font="]在AZ2使用自定义镜像和快照创建ECS实例
[size=font-size:10.5pt,10.5pt] [font="]

[size=font-size:10.5pt,10.5pt] [font="]

[size=font-size:10.5pt,10.5pt] [font="]

[size=font-size:10.5pt,10.5pt] [font="]1.[size=; font-size: 7pt,7pt][font='Times New Roman']    [size=font-size:10.5pt,10.5pt] [font="]Linux[size=font-size:10.5pt,10.5pt] [font="]需要在启动ECS实例后mount 数据盘分区
[size=font-size:10.5pt,10.5pt][font="]添加分区信息[size=font-size:9.0pt,9.0pt] [font="]
[size=font-size:9.0pt,9.0pt] [font="]使用“echo '/dev/vdb1 /mnt ext4    defaults    0  0' >>/etc/fstab”(不含引号)命令写入新分区信息。
然后使用“cat /etc/fstab”命令查看

[size=font-size:10.5pt,10.5pt] [font="]
[size=font-size:9.0pt,9.0pt] [font="]*  [size=font-size:9.0pt,9.0pt] [font="]如果需要把数据盘单独挂载到某个文件夹,比如单独用来存放网页,可以修改以上命令中的/mnt部分
[size=font-size:9.0pt,9.0pt] [font="]

[size=font-size:9.0pt,9.0pt] [font="]

[size=font-size:9.0pt,9.0pt] [font="]

[size=font-size:10.5pt,10.5pt][font="]挂载新分区[size=font-size:9.0pt,9.0pt] [font="]
[size=font-size:9.0pt,9.0pt] [font="]
[size=font-size:9.0pt,9.0pt] [font="]使用“mount -a”命令挂载新分区,然后用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了
[size=font-size:9.0pt,9.0pt] [font="]

[size=font-size:9.0pt,9.0pt] [font="]

展开
收起
德鲁克 2016-03-03 10:04:09 6179 0
1 条回答
写回答
取消 提交回答
  • 码农|Coder| Pythonista
    建议重新编辑下格式
    2016-03-03 10:11:59
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
如何运维千台以上游戏云服务器 立即下载
网站/服务器取证 实践与挑战 立即下载
ECS快储存加密技术 立即下载