gpt4 book ai didi

linux - aws 在 hvm 虚拟化中使用 Chef 附加 ebs 卷

转载 作者:太空宇宙 更新时间:2023-11-04 03:37:53 28 4
gpt4 key购买 nike

我有一个 Chef 配方,它尝试创建并附加 EBS 卷,但始终失败。它在我之前使用的所有半虚拟化类型的 AMI 上都运行良好。但是,当我尝试切换并使用 hvm 虚拟化时,它失败并告诉我挂载点已在使用中。但似乎并非如此。

我创建/附加卷的方法是从该资源中紧密复制的,作者在其中创建了单个 EBS 卷。 http://clarkdave.net/2013/04/managing-ebs-volumes-with-chef/#creating-the-ebs-volumes

================================================================================
Error executing action `attach` on resource 'aws_ebs_volume[application_ebs_volume]'
================================================================================

Aws::EC2::Errors::InvalidParameterValue
---------------------------------------
Invalid value '/dev/sdb' for unixDevice. Attachment point /dev/sdb is already in use

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:212:in `attach_volume'
/var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:70:in `block (2 levels) in class_from_file'
/var/chef/cache/cookbooks/aws/providers/ebs_volume.rb:68:in `block in class_from_file'

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/company-aws/recipes/ebs.rb

23: aws_ebs_volume "application_ebs_volume" do
24: aws_access_key aws['aws_access_key_id']
25: aws_secret_access_key aws['aws_secret_access_key']
26: description node['companyaws']['ebs']['name']
27: size node['companyaws']['ebs']['size']
28: device device_id.gsub('xvd', 'sd') #aws uses sdx instead of xvdx
29: action [ :create, :attach ]
30: end
31:

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/company-aws/recipes/ebs.rb:23:in `from_file'

aws_ebs_volume("application_ebs_volume") do
action [:create, :attach]
updated true
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :aws_ebs_volume
cookbook_name "company-aws"
recipe_name "ebs"
aws_access_key "XXXXXXXXXXXXXXXXXXXX"
aws_secret_access_key "YYYYYYYYYYYYYYYYYYYYYYYYYYYYY/YYYYYYYYYY"
description "chef-test"
size 50
device "/dev/sdb"
timeout 180
volume_type "standard"
piops 0
end

我尝试验证挂载点不存在

user@chef-test:~$ df -h                                                      
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 9.8G 1.2G 8.1G 13% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 996M 12K 996M 1% /dev
tmpfs 201M 340K 200M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 1001M 0 1001M 0% /run/shm
none 100M 0 100M 0% /run/user

user@chef-test:~$ cat /proc/partitions
major minor #blocks name

202 0 10485760 xvda
202 1 10474380 xvda1

user@chef-test:~$ ls /dev/xvd*
/dev/xvda /dev/xvda1

user@chef-test:~$ cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 0

user@chef-test:~$ sudo mount
[sudo] password for user:
/dev/xvda1 on / type ext4 (rw,discard)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)

最佳答案

@adam_Ocsvari 的方法是正确的。当我将设备从安装 /dev/sdb 切换到 /dev/sdf 时,一切立即正常工作。

关于linux - aws 在 hvm 虚拟化中使用 Chef 附加 ebs 卷,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30982381/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com