将ubuntu linux机器的实例类型从c4.large更改为c5.xlarge时,与磁盘相关的错误

时间:2019-04-16 05:32:18

标签: linux ubuntu nginx amazon-ec2

当我使用c4类类型(例如c4.large,c4.xlarge)时,我正在通过cloudformation向Linux机器提供用户数据,并且可以正常工作,而当我在cloudformation中更改实例类型并部署在Linux上时,它将停止工作运行jenkin作业的服务器。

下面提供了用户数据。

我正在使用c4.large,当我将实例类型更改为c5.xlarge时,它无法正常工作,因此当我将其更改为c4.xlarge时进行测试时,它仍在正常工作,因此问题仅在于c5实例类型。我还使用优化的EBS卷检查了这两种实例类型,因此磁盘级别没有太大差异。

日志:

Mar 28 05:50:30 ip-10-116-54-180 cloud-init[1876]: Setting up python3-botocore (1.4.70-1~16.04.0) ...
Mar 28 05:50:30 ip-10-116-54-180 cloud-init[1876]: Setting up python3-s3transfer (0.1.9-1~16.04.0) ...
Mar 28 05:50:31 ip-10-116-54-180 cloud-init[1876]: Setting up awscli (1.11.13-1ubuntu1~16.04.0) ...
Mar 28 05:50:31 ip-10-116-54-180 cloud-init[1876]: Processing triggers for libc-bin (2.23-0ubuntu11) ...
Mar 28 05:50:32 ip-10-116-54-180 cloud-init[1876]: Error: Could not stat device /dev/xvdb - No such file or directory.
Mar 28 05:50:32 ip-10-116-54-180 cloud-init[1876]: #015                                                                          #015Error: Could not stat device /dev/xvdb - No such file or directory.
Mar 28 05:50:39 ip-10-116-54-180 systemd[1]: Created slice User Slice of ubuntu.
Mar 28 05:50:39 ip-10-116-54-180 systemd[1]: Starting User Manager for UID 1000...
Mar 28 05:50:39 ip-10-116-54-180 systemd[1]: Started Session 1 of user ubuntu.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Reached target Sockets.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Reached target Timers.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Reached target Paths.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Reached target Basic System.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Reached target Default.
Mar 28 05:50:39 ip-10-116-54-180 systemd[8734]: Startup finished in 8ms.
Mar 28 05:50:39 ip-10-116-54-180 systemd[1]: Started User Manager for UID 1000.
Mar 28 05:50:55 ip-10-116-54-180 amazon-ssm-agent.amazon-ssm-agent[1800]: 2019-03-28 05:50:55 INFO [HealthCheck] HealthCheck reporting agent health.
Mar 28 05:53:32 ip-10-116-54-180 systemd[1]: Started Session 2 of user ubuntu.

例如用户数据:

#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y awscli python-pip python-dev python-virtualenv
mkdir /var/log/nginx
parted /dev/xvdb mklabel gpt
parted -a opt /dev/xvdb mkpart primary ext4 0% 100%
echo '/dev/xvdb1 /var/log/nginx ext4 defaults 0 0' >> /etc/fstab
sleep 10
while [ ! -e /dev/xvdb1 ]; do sleep 1; done
mkfs.ext4 /dev/xvdb1
mount /var/log/nginx
chown root:adm /var/log/nginx
aws s3 cp s3://bw-ald-euwe1-dev-routing/aws-ss-routing/features/P2PDO-3152-scaleup-routingservice-nodes-to-c5.xlarge-all-region/000003/aws-ss-routing.tar.gz .
tar zxvf aws-ss-routing.tar.gz
chmod +x nginx/install.sh
cd nginx && ./install.sh

由于c5类是c4类类型的高级类,因此我需要使用它并解决此问题。

0 个答案:

没有答案