开发者社区> 技术小甜> 正文

AWS标准扩容(三)

简介:
+关注继续查看

AWS扩容过程:

You can increase the storage space of an existing EBS volume without losing the data on the volume.

你能够不丢数据地增加现在EBS卷上的存储空间。

To do this, you migrate your data to a larger volume and then extend the file system on the volume to recognize the newly-available space. After you verify that your new volume is working properly, you can delete the old volume.要做到这一点,你迁移你的数据到一个更大的卷然后扩展卷上的文件系统来识别新的可用空间。在你验证新的卷工作正常后,你可以删除老的卷。

 

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.打开EC2Console

  2. In      the navigation pane, choose Instances and      then locate the instance with the volume that you want to expand. 找到导航窗格,选择“Instances”然后找到需要扩容的实例

  3. Make      a note of the instance ID and Availability Zone. You will specify this      information when you attach a new volume to the instance later in this      procedure.记录下实例的ID号和可用区域。当你附加一个新的磁盘到此实例的过程中你需要指定这些信息。

  4. Verify      that the instance Shutdown      Behavior is set to Stop and not Terminate.

    1. Choose the instance.

    2. From       the context-menu (right-click) choose Instance Settings, and then choose Change Shutdown Behavior.

    3. If       the Shutdown behavior is       set to Terminate,       choose Stop,       and then choose Apply.
                   If the
       Shutdown       behavior is already set to Stop, then choose Cancel.

 

核实是被stop而不是terminate.a.选择实例  b.右击选择“Instance settings”然后,选择“Change shutdown behavior. c.如果“shutdown behavior”将被设置为“Terminate,选择“Stop,然后选择“Apply;如果“shutdown behavior”已经被设置为“Stop,选择“Cancel.

 

 

5. Stop the instance. For more      information about how to stop an instance, see Stopping and Starting Your Instances.
           
Warning
           
When you stop an instance, the data on any      instance store volumes is erased. Therefore, if you have any data on      instance store volumes that you want to keep, be sure to back it up to persistent storage.

停止实例。如果有数据放在instance store,请备份到persistent storage.

6. Create a snapshot of the volume to expand.

    1. In the navigation pane, choose Volumes, and then locate the volume you want to expand.

    2. From       the context-menu (right-click) choose the volume that you want to       expand, and then choose Create Snapshot.

    3. Enter       information in the Name and Description fields,       and then choose Yes,       Create.

创建一个卷的snapshot用于扩展。右击需要做snapshot的磁盘创建snapshot,加入名字和描述。

7. Create a new volume from the snapshot.

    1. In the navigation pane, choose Snapshots.

    2. When       the status of the snapshot that you just created is set to completed, choose the snapshot, and       then from the context-menu (right-click) choose Create Volume.

    3. In       the Create Volume dialog       box, choose the desired volume type and enter the new volume size. You       must also set the Availability       Zone to match the instance       Availability Zone. Choose Yes, Create.
                   
      Important
                   
      If you do not set the Availability Zone to       match the instance then you will not be able to attach the new volume to       the instance.

创建新的卷对于这个snapshot.当 备份完毕后右击这个snapshot创建卷。输入卷的类型和大小。你必须把它放在可用区域。

 

8. Detach the old volume.

    1. In the navigation pane, choose Volumes, and then choose the old volume from the list. Make a note       of the device name in the Attachment Information field. You will specify this information when you attach a       new volume to the instance later in this procedure. The information       appears in the following format:
                   
      i-xxxxxxxxxxxxxxxxx (instance_name):device_name

    2. From       the context-menu (right-click) choose the old volume, and then choose Detach Volume.

    3. In       the Detach Volume dialog       box, choose Yes,       Detach. It may take several minutes for the       volume to detach.

分离老的卷。

  1. 找到老的卷,记下设备名称,在attachment      information你可以找到。当你附加一个新的卷在这个实例的时候你需要指定这个信息。

  2. 右击老的卷,然后选择detach      volume.

  3. 选择yes,detach.

 

9. Attach the newly expanded volume

    1. In the navigation pane, choose Volumes.

    2. From       the context-menu (right-click) choose the new volume, and then choose Attach Volume.

    3. Start       typing the name or ID of the instance in the Instance field,       and then choose the instance.

    4. Enter the same device name retrieved in Step       8.a, and then choose Yes,       Attach. It is important to attach       the new volume to the exact location you noted above (for example /dev/sda1).

 

附加新的扩展过的卷。

a.右击,选择attach volume.

b.输入实例的名字和Id在“instance”这个字段,选择实例。

c.输入设备名称,选择yes,attach.


 10.Restart the instance.

    1. In the navigation pane, choose Instances and then choose the instance you want to       restart.

    2. From       the context-menu (right-click) choose Instance State, and then choose Start.

    3. In       the Start Instances dialog       box, choose Yes,       Start. If the instance fails to start, and the volume being       expanded is a root volume, verify that you attached the expanded volume       using the same device name as the original volume, for example /dev/sda1.

 

 

重启实例,右击实例,选择instance state,然后选择start. 然后选择yes,start.

 

 

 

  1. 注意:

Note

After you are done resizing your volume, you should delete the snapshot you created in the procedure above to avoid incurring storage costs.

在你resize你的卷后,你应该删除刚刚创建的snapshot,避免招致存储花费。

 

 

11. Extending a Linux File System扩展文件系统:

For ext2ext3, and ext4 file systems, this command is resize2fs. For XFS file systems, this command is xfs_growfs.注意在使用xfs_growfs需要安装包:

sudo yum install xfsprogs

 

Then use the following command, substituting the mount point of the file system (XFS file systems must be mounted to resize them).注意下括号里面的内容:xfs文件系统必须挂载状态。

[ec2-user ~]$ sudo xfs_growfs -d /mnt

 

 

 

怎么查看文件系统的类型:

file -s /dev/xvd*

 

显示块设备:

lsblk command to list the block devices attached to your instance. The example below shows three volumes: /dev/xvda/dev/xvdb, and /dev/xvdf.

 

注意:

Note

If you receive an xfsctl failed: Cannot allocate memory error, you may need to update the Linux kernel on your instance. For more information, refer to your specific operating system documentation.

如果是收到一个:xfsctl faild:cannot 分配内存错误,你或许需要更新linux内核了。

 

 

 












本文转自chenzudao51CTO博客,原文链接:http://blog.51cto.com/victor2016/1880857 ,如需转载请自行联系原作者





版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,大概有三种登录方式:
13569 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,云吞铺子总结大概有三种登录方式: 登录到ECS云服务器控制台 在ECS云服务器控制台用户可以更改密码、更换系统盘、创建快照、配置安全组等操作如何登录ECS云服务器控制台? 1、先登录到阿里云ECS服务器控制台 2、点击顶部的“控制台” 3、通过左侧栏,切换到“云服务器ECS”即可,如下图所示 通过ECS控制台的远程连接来登录到云服务器 阿里云ECS云服务器自带远程连接功能,使用该功能可以登录到云服务器,简单且方便,如下图:点击“远程连接”,第一次连接会自动生成6位数字密码,输入密码即可登录到云服务器上。
36433 0
使用OpenApi弹性释放和设置云服务器ECS释放
云服务器ECS的一个重要特性就是按需创建资源。您可以在业务高峰期按需弹性的自定义规则进行资源创建,在完成业务计算的时候释放资源。本篇将提供几个Tips帮助您更加容易和自动化的完成云服务器的释放和弹性设置。
20896 0
阿里云服务器ECS登录用户名是什么?系统不同默认账号也不同
阿里云服务器Windows系统默认用户名administrator,Linux镜像服务器用户名root
16424 0
使用SSH远程登录阿里云ECS服务器
远程连接服务器以及配置环境
14739 0
阿里云服务器安全组设置内网互通的方法
虽然0.0.0.0/0使用非常方便,但是发现很多同学使用它来做内网互通,这是有安全风险的,实例有可能会在经典网络被内网IP访问到。下面介绍一下四种安全的内网互联设置方法。 购买前请先:领取阿里云幸运券,有很多优惠,可到下文中领取。
22536 0
+关注
10140
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
JS零基础入门教程(上册)
立即下载
性能优化方法论
立即下载
手把手学习日志服务SLS,云启实验室实战指南
立即下载