EC2 machine abruptly terminating right after start

2019-07-22 04:30发布

问题:

I was in the process of shrinking the size of the EBS volume attached to my ec2 machine. There are many tutorials on how to do this (here is the one I used).

The gist is that, I create a snapshot of the actual drive, and small empty volume. I then copy the content of the snapshot to the small drive via sudo rsync -aHAXxSP /mnt/snap/ /mnt/small.

When checking the contents of the small drive, it seems like it contains all of the folders/files in the original drive.

At the end, after detaching all volumes and attaching the smallest volume, when starting the ec2 instance, it terminates after initializing. When I get the reason for the termination it says Instance initiated shutdown:

AI2s-MBP-7:~ i-danielk$ aws ec2 describe-instances --instance-ids i-e0ef0910  
RESERVATIONS    645962089403    r-440c95a5
GROUPS  sg-4cdf6427 zfei_profiler
INSTANCES   0   x86_64  tOGHd1424650611612  True    xen ami-146e2a7c    i-e0ef0910  r3.2xlarge  zfei_profiler   2015-08-23T01:56:40.000Z            /dev/xvda   ebs     hvm
BLOCKDEVICEMAPPINGS /dev/xvda
EBS 2015-08-23T01:55:56.000Z    False   attached    vol-1d08fcf0
MONITORING  disabled
PLACEMENT   us-east-1c      default
SECURITYGROUPS  sg-4cdf6427 zfei_profiler
STATE   80  stopped
STATEREASON Client.InstanceInitiatedShutdown    Client.InstanceInitiatedShutdown: Instance initiated shutdown
TAGS    Name    WIKI_TACL_MERGE

Any idea how can I figure out the real reason for my instance shutdown?

Update1: this is really weird ... the "Instance Settings > Get System Log" shows nothing. Here is a screenshot:

Update2: Both cases (original volume, and the small volume) were added as /dev/xvda (I tried /dev/sda but it didn't accept it).

Update3: Here is the content /boot/grub/grub.conf. Based on what I see, there is nothing problematic (and nothing needs to be changed).

[ec2-user@ip-10-167-76-117 target]$ cat /boot/grub/grub.conf
# created by imagebuilder
default=0
timeout=1
hiddenmenu

title Amazon Linux 2014.09 (3.14.33-26.47.amzn1.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-3.14.33-26.47.amzn1.x86_64 root=LABEL=/ console=ttyS0 LANG=en_US.UTF-8 KEYTABLE=us
initrd /boot/initramfs-3.14.33-26.47.amzn1.x86_64.img

title Amazon Linux 2014.09 (3.14.27-25.47.amzn1.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-3.14.27-25.47.amzn1.x86_64 root=LABEL=/ console=ttyS0
initrd /boot/initramfs-3.14.27-25.47.amzn1.x86_64.img

And this is /etc/fstab:

[ec2-user@ip-10-167-76-117 target]$ cat /etc/fstab
#
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0