For example I have an image its snapshot sized 20 GiB (Total size of EBS Volumes: 20 GiB) and it has 15 GiB free space. I want to create new image having 10 GiB from the instance.
When I do: Image => Create Image and entered 10 GiB for the volume, I do face with following error message:
Volume size must be at least the size of the snapshot (20 GiB)
[Q] Is it possible to prevent this error and create an Image having smaller volume than the snapshot's EBS volume?
Thank you for your valuable time and help.
Please note that following two approaches that did not work, and the owner of the answer did not guide me further! I don't what anyone with same problem lose time with those approaches since copy paste operations takes a long time in between volumes. I would be grateful if someone guide me further.
Approach 1: (target volume is a single EBS volume)
I have followed following guide based on the @EFeit
's answer, which links to: https://serverfault.com/a/718441
First I stopped the instance I want to resize. Than I have created smaller EBS volume as 5 GiB and attached it into my instance as /dev/xvdf
. Start the instance and log onto the new instance via SSH; and did the followings:
sudo mkdir /source /target sudo mkfs.ext4 /dev/xvdf sudo mount -t ext4 /dev/xvdf /target sudo e2label /dev/xvdf / sudo mount -t ext4 /dev/xvda1 /source sudo rsync -aHAXxSP /source/ /target sudo umount /target sudo umount /source
Back in AWS Console: Stop the instance, and detach all the volumes. Attach the new sized volume into the instance as: "/dev/sda1
" Start the instance, and it should boot up.
Error message:
Approach 2: (target volume is obtained from newly created smaller instance)
I have followed following guide. I have also faced with Error 15
on the boot menu :(
3 Answers
Answers 1
There's no simple way to do this, but I think this tutorial will give you the outcome you're looking for.
Answers 2
You think the disk space is allocated contiguously? You may think only the first 5GB is used. But the allocation can be all over the disk. It is your responsibility to copy the data to a smaller disk, attach it to your instance and discard the old disk. There are many tutorials on how to do it.
Answers 3
check this answer here, I has the same issue, and asked this question.
I haven't tried the solution mentioned as I don't need this volume anymore and I was only concerned about the snapshot size, but it has been brought to my attention that the snapshot is stored as data based not block based so it won't reserve the same capacity as if it was live.
I really liked your blog post.Much thanks again. Awesome.
ReplyDeleteOracle BPM training
Oracle Cloud Administration online training
Oracle Cloud Administration training
Oracle Data Integrator online training
Oracle Data Integrator training
Oracle DBA online training
Oracle DBA training
Oracle Enterprise Manager online training
Oracle Enterprise Manager training
Oracle Exadata online training
Oracle Exadata training
Oracle fusion order management online training