通过Parted Chef脚本对/ dev / sdb进行分区

时间:2017-12-29 18:35:31

标签: chef chef-recipe parted

我正在使用Parted chef cookbook将我的/ dev / sdb分区为/ dev / sdb1,/ dev / sdb2,/ dev / sdb3。这三个都有一定的范围,但下面的代码不起作用,sdb1被创建但在sdb2上出错。在创建了所有三个分区之后,我需要在/ dev / sdb1和/ dev / sdb2上挂载/ var / lib / docker和/ var / lib / mesos。请帮忙。

parted_disk "/dev/sdb" do
  label_type "gpt"
  action :mklabel
end

parted_disk "/dev/sdb" do
  part_type   "primary" # logical or extended
  file_system "xfs"
  part_start "1"
  part_end "100000"
  action :mkpart
end 

parted_disk "making_sdb1" do
  file_system "xfs"
  device "/dev/sdb1"
  part_start "1"
  part_end "100000"
  action :mkfs
end

parted_disk "/dev/sdb" do
  part_type   "primary" # logical or extended
  file_system "xfs"
  part_start "100000"
  part_end "200000"
  action :mkpart
end 

parted_disk "making_sdb2" do
  file_system "xfs"
  device "/dev/sdb2"
  part_start "100000"
  part_end "200000"
  action :mkfs
end

parted_disk "/dev/sdb" do
  part_type   "primary" # logical or extended
  file_system "xfs"
  part_start "200000"
  part_end "-1"
  action :mkpart
end

parted_disk "making_sdb3" do
  file_system "xfs"
  device "/dev/sdb3"
  part_start "200000"
  part_end "-1"
 action :mkfs
end

mount '/var/lib/docker' do
  device '/dev/sdb1'
  fstype 'xfs'
  options 'nodiratime 0 0'
end

mount '/var/lib/mesos' do
  device '/dev/sdb2'
  fstype 'xfs'
  options 'nodiratime 0 0'
end

0 个答案:

没有答案