0

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
codechef
  • 65
  • 1
  • 7
  • It would help to also include the error. – coderanger Dec 29 '17 at 19:15
  • @coderanger - It fails because it does not create the second partition from 100000 to 200000. We reviewed the original implementation in Parted Chef cookbook and found a bug there. The code is written so that only one partition can be created under primary type. Ideally we should be able to create upto 4 partitions under primary file type. I am mostly going to write my custom execute script for this. Please let me know if you have any suggestions. – codechef Dec 29 '17 at 21:34
  • If it's a bug in the cookbook then it's a bug in the cookbook. Very few people do disk management in Chef and we don't really recommend it. – coderanger Dec 29 '17 at 21:43

0 Answers0