AWS EBS驱动器需要缩小尺寸

我有一个1TB的AWS EBN驱动器,这个驱动器大概占了25%。 所以我在储存上浪费钱

有没有办法让这个驱动器的更小的快照? 我有一个Drupal网站运行它。

不幸的是,以这种方式减servlets器的大小是不安全的。 Digital Ocean和Rackspace等其他提供商也不允许。

你可以做的是从头创build一个全新的服务器,并将现有服务器中的所有数据复制到新的服务器上。 有一些教程,你可以很容易地find一个简单的谷歌search,但我不会推荐他们(他们自己不)

这些步骤在亚马逊,CentOS,红帽testing。

第1部分:准备阶段

1. Stop the instance and create snapshot of the volume. 2. Now launch a temp working instance. 3. Create a new "source" volume from the snapshot created in step 1 and attach it to the temp working instance as /dev/sdm. 4. Create a new "destination" volume and attach it to the temp working instance as /dev/sdo. 

第2部分:转换

 1. Partition the 'destination' volume. parted /dev/xvdo --script 'mklabel msdos mkpart primary 1M -1s print quit' partprobe /dev/xvdo udevadm settle 2. Check the 'source' volume and minimize the size of original filesystem to speed up the process. We do not want to copy free disk space in the next step. e2fsck -f /dev/xvdm resize2fs -M /dev/xvdm - Output from resize command: Resizing the filesystem on /dev/xvdm to 269020 (4k) blocks. The filesystem on /dev/xvdm is now 269020 blocks long. 3. Duplicate 'source' to 'destination' volume. dd if=/dev/xvdm of=/dev/xvdo1 bs=4K count=269020 ***NB: Ensure you use the exact value for "bs=" and "count=" from the resize2fs command*** 4. Resize the filesystem on the 'destination' volume after the transfer completed. resize2fs /dev/xvdo1 

第3部分:敲定

 1. Create a snapshot of the 'destination' volume. 2. Now create EBS volume from the same and attach it to original instance and mount the volume. 

从下面的链接采取参考