搜索
查看: 2100|回复: 0

[linux] 给aws扩容-亚马逊云

[复制链接]

634

主题

1182

帖子

4030

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4030
发表于 2017-4-23 11:20:51 | 显示全部楼层 |阅读模式
云比较是比较贵的,一般刚开始买个100G就绰绰有余了。
但是随着需求的改变,扩容势在必行。
很简单,在AWS里面操作:
There's no need to stop instance and detach EBS volume to resize it anymore!

13-Feb-2017 Amazon announced: "Amazon EBS Update – New Elastic Volumes Change Everything"
The process works even if the volume to extend is the root volume of running instance!


Say we want to increase boot drive of Ubuntu from 8G up to 16G "on-the-fly".

step-1) login into AWS web console -> EBS -> right mouse click on the one you wish to resize -> "Modify Volume" -> change "Size" field and click [Modify] button



step-2) ssh into the instance and resize the partition:

let's list block devices attached to our box:
lsblkNAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINTxvda    202:0    0  16G  0 disk└─xvda1 202:1    0   8G  0 part /
As you can see /dev/xvda1 is still 8 GiB partition on a 16 GiB device and there are no other partitions on the volume. Let's use "growpart" to resize 8G partition up to 16G:
# install "cloud-guest-utils" if it is not installed alreadyapt install cloud-guest-utils# resize partitiongrowpart /dev/xvda 1
Let's check the result (you can see /dev/xvda1 is now 16G):
lsblkNAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINTxvda    202:0    0  16G  0 disk└─xvda1 202:1    0  16G  0 part /
Lots of SO answers suggest to use fdisk with delete / recreate partitions, which is nasty, risky, error-prone process especially when we change boot drive.


step-3) resize file system to grow all the way to fully use new partition space
# Check before resizing ("Avail" shows 1.1G):df -hFilesystem      Size  Used Avail Use% Mounted on/dev/xvda1      7.8G  6.3G  1.1G  86% /# resize filesystemresize2fs /dev/xvda1# Check after resizing ("Avail" now shows 8.7G!-):df -hFilesystem      Size  Used Avail Use% Mounted on/dev/xvda1       16G  6.3G  8.7G  42% /
So we have zero downtime and lots of new space to use.
Enjoy!




上一篇:gene ID转换问题
下一篇:不同组学研究建议采用的测序策略
你这个问题很复杂,需要打赏,请点击 http://www.bio-info-trainee.com/donate 进行打赏,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树 ( 粤ICP备15016384号  

GMT+8, 2019-8-22 22:32 , Processed in 0.028463 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.