Blog Feed about something 2018-01-12T11:53:00+01:00 Elias Abacioglu parted multi partition alignment 2018-01-12T11:53:00+01:00 2018-01-12T11:53:00+01:00 This post describes how I realised that I wasn't aligning our partitions and how I did to properly align multiple partitions using parted.

A few weeks back I was replacing a SATA-DOM with a (internal) USB stick on a node in our Hyper-Converged cluster. (Basically a OpenNebula + KVM + Open vSwitch + Ceph cluster.) So out of 12 Nodes, we have 1 odd HP machine. Being a typical HP node it need to have quirky quirks, otherwise it wouldn't be a HP. So using our our bare-metal image installer I boot a image over the network and partition and write the Linux image to the USB. Then the installer reboots the node and it is supposed to boot into the OS, err guess again! It doesn't!

So I'm at a loss here. I've done this procedure on our other Dell nodes in the cluster and it works. So my first instinct is, okay there's gotta be something wrong in the BIOS settings, I start testing shitloads of different setting combinations. That didn't work! So my next instinct is to try the different pxe boot options.

KERNEL <%= foreman_server_url %>/files/helpers/chain.c32

I even upgrade the NIC firmware and try the above stuff again.

Ehrm I'm feeling my hair is getting greyer and greyer, so what do I do next. I start debugging the installer, it must have failed with grub or something. I spent more time that I would like to admit. But during all this debugging I get stuck cause I see a message in the output/journalctl log. The partitions are not optimally aligned. And I was devastated, cause previously I was under the illusion that I did properly align my partitions, which apparently I wasn't. So I spend a lot of time trying to fix that, for now I gotta keep you in suspense about this HP not booting a USB stick, cause it's more important to fix the damn alignment.

I did a google and I get to this blog about how to calculate alignment. I learn from there that I can add /sys/block/sdb/queue/optimal_io_size with /sys/block/sdb/alignment_offset and divide the result with /sys/block/sdb/queue/physical_block_size. Sure, but I was under the illusion that parted could do the alignment for you. So I start doing a lot of trial-and-error and I learn a couple of things.

  1. This Rainbow Chard blog only shows you how to align one partition.
  2. The rest of the Internet is drowning in examples on how to align one partition with parted.
  3. parted does handle alignment, but only under some circumstances which are not fitting for a granular multi partition of a disk.
  4. Doing multiple partitions with parted and wanting to align them all is a real pain in the...

So basically you can use parted to align multiple partitions IF you use percentage. I tried

parted -a optimal -s -- /dev/sdX mkpart primary 0% 32MiB
parted -a optimal -s -- /dev/sdX mkpart primary 0% 32MB

Both of these fail caused...

Linux image installs for Bare Metal 2017-09-11T23:26:00+02:00 2017-09-11T23:26:00+02:00

Are you like me that use preseed/kickstart netboot installs for physical nodes and perhaps use images prepped with cloud-init to deploy virtual nodes?
Having two or more different ways of deploying bare metal, virtual servers, multiple ways of bootstrapping a node.
Have you been thinking or wanting to deploy physical nodes the same way you would virtual ones? Are you tired of the whole setup that needs to be different on different scenarios?
If so, read on.

So for a while I was looking for a decent solution to deploy physical/bare metal nodes in the same way we do with cloud or virtual nodes. I've saw some small mentions on one or two blog posts about installing Linux images on bare metal. But no Open Source solution for it.
So I was thinking, how hard can this be, why haven't anyone done this? So I wanted to do this.

My next thought was, do I have to components to be able to achieve my goal? I went on looking at the components that we were currently using.
We use Foreman for lifecycle management of our Linux nodes. Foreman manages our PXE, DHCP and DNS and later even auto discovery.
And with the help of Foreman we were deploying Ubuntu Linux nodes using preseed netboot installs. So installation of our bare metal node were already automated.
But the downsides where that it took a long time to install. We had to utilize preseed which IMO sucks. It needs a lot of guesswork to get working and you end up needing to compromise. And whenever a new Ubuntu version comes you have to verify that you preseed scripts work for that version. I think the worst of all is the partman part of preseed. Don't get me started on partman, I get upset just writing about it. Then if you are going to deploy CentOS, RHEL, SuSE etc. They all have different ways of doing netinstalls (it's the linux way, no two vendors can cooperate and make something universal).

So I went on. How am I going to use this toolset I have available to write an Linux image to a hard drive.
The idea is simple.

  1. Network boot a machine.
  2. Write a Linux image to disk, reboot.
  3. Configure/bootstrap the OS.

I mean how hard can that be, it's just 3 steps? Well there were some challenges, but I won't go in to that cause it would lead to a very long blog post.

First of all we had Foreman in place and PXE+DHCP setup. So we are able to netboot machines.
But then I had find a way to have a lightweight image (that has support for different types of hardware and RAID controllers) to boot and download a image and write it to disk.
Really I wanted a Linux image or ISO that can PXE boot and directly after execute a script, so I Googled a bit and didn't find anything suiting. And I really didn't want to build and...