Nik*_*pte 153 amazon-ebs amazon-web-services
我对亚马逊的EC2和EBS服务印象深刻.我想知道是否可以增加EBS卷.
例如:如果我有50 GB的音量并且我开始没有空间,我可以在需要时将它提升到100 GB吗?
Con*_*oyP 103
您可以增加存储空间,但无法在运行中完成.您需要拍摄当前块的快照,添加新的更大的块并重新附加快照.
这里有一个简单的演练,基于使用亚马逊的EC2命令行工具
ech*_*hox 44
如果需要,您不能简单地"碰上"更多空间,但您可以使用快照调整分区大小.
步骤做到这一点:
请看http://aws.amazon.com/ebs/ - EBS快照:
快照还可用于实例化多个新卷,扩展卷的大小或跨可用区移动卷.创建新卷时,可以选择基于现有Amazon S3快照创建新卷.在该场景中,新卷开始时是原始卷的精确副本.通过可选地指定不同的卷大小或不同的可用区,此功能可用作增加现有卷大小或在新可用区中创建重复卷的方法.如果选择使用快照来调整卷的大小,则需要确保文件系统或应用程序支持调整设备大小.
See*_*ker 22
我遵循了所有的答案,所有方面都缺少了一些东西.
如果您按照这些步骤操作,则可以增加EBS卷并保留数据(这不是根卷).为简单起见,我建议使用AWS consule来创建快照,......您也可以使用AWS命令行工具来实现.
我们这里没有触及根卷.
转到您的AWS控制台:
SSH到您的实例:
$ sudo fdisk -l
Run Code Online (Sandbox Code Playgroud)
这给你的东西:
Disk /dev/xvdf: 21.5 GB, 21474836480 bytes
12 heads, 7 sectors/track, 499321 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd3a8abe4
Device Boot Start End Blocks Id System
/dev/xvdf1 2048 41943039 20970496 83 Linux
Run Code Online (Sandbox Code Playgroud)
记下Start和Id值.(在这种情况下为2048和83)
使用fdisk,删除分区xvdf1并创建一个完全从同一个块开始的新分区(2048).我们将给它相同的Id(83):
$ sudo fdisk /dev/xvdf
Command (m for help): d
Selected partition 1
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 83
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Run Code Online (Sandbox Code Playgroud)
这一步解释如下:http://litwol.com/content/fdisk-resizegrow-physical-partition-without-losing-data-linodecom
差不多完成了,我们只需要挂载卷并运行resize2fs:
安装ebs卷:(我的是/ mnt/ebs1)
$ sudo mount /dev/xvdf1 /mnt/ebs1
Run Code Online (Sandbox Code Playgroud)
并调整它的大小:
$ sudo resize2fs -p /dev/xvdf1
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/xvdf1 is mounted on /mnt/ebs1; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/xvdf1 to 5242624 (4k) blocks.
The filesystem on /dev/xvdf1 is now 5242624 blocks long.
ubuntu@ip-xxxxxxx:~$
Run Code Online (Sandbox Code Playgroud)
完成!使用df -h验证新的大小.
Jef*_*uer 19
只要你有几分钟的停机时间,Eric Hammond写了一篇关于在运行的EBS实例上调整根磁盘大小的好文章:http://alestic.com/2010/02/ec2-resize-running-ebs -根
小智 9
所有伟大的建议,我想我会添加我发现的这篇文章,它与使用Amazon Web UI工具扩展Windows Amazon EC2 EBS实例以执行必要的更改有关.如果您不习惯使用CLI,这将使您的升级更加轻松.
http://www.tekgoblin.com/2012/08/27/aws-guides-how-to-resize-a-ec2-windows-ebs-volume/
感谢TekGoblin发布这篇文章.
您现在可以通过AWS管理控制台执行此操作.该过程与其他答案中的过程相同,但您不再需要转到命令行.
| 归档时间: |
|
| 查看次数: |
79451 次 |
| 最近记录: |