Partition of /dev/sdb through Parted Chef script

623 Views Asked by At

I am using Parted chef cookbook to partition my /dev/sdb into /dev/sdb1, /dev/sdb2, /dev/sdb3. All three have certain range but the code below does not work, sdb1 gets created but errors out on sdb2. After all three partitions are created, I need to mount /var/lib/docker and /var/lib/mesos on /dev/sdb1 and /dev/sdb2. Please help.

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

There are 0 best solutions below