WorldTurner Blog

Sunday Feb 20, 2011

Ruby disk utilities - partition editor

In my previous blog post, I described how I was able to create a bootable disk image with a Ubuntu installation, without any manual intervention. Although that was a good first step, I don't consider this an end-result as the shell scripts that I used weren't very error-tolerant or configurable. My next goal is to create a ruby script that can perform these steps, and also pick up where it left of if an error was encountered.

Ruby

Why Ruby? Mainly because many of the DevOps-related tools are written in Ruby, and I want to integrate it with puppet for fine-tuning the image, and puppet is written in Ruby. Although I know the language and have written some smaller apps in it, I don't consider myself to be very experienced in Ruby, so it is a good exercise as well. So I appreciate any feedback, especially in the area of "how things are done in Ruby".

Cabochon disk utilities library

I haven't found existing Ruby libraries for many of the steps in the process of creating a bootable disk image. I want to encapsulate these steps in libraries so that they can be re-used for other purposes, and hopefully other people will want to invest some time in them so that I can profit from those contributions as well.

I had to pick a name, and trying to stick to the corny gem references, I found that 'cabochon' wasn't used yet on github. A cabochon is a polished gemstone with usually one flat side, a bit like a disk, which sounds appropriate for a set of disk-related utilities.

Partition editor

Cabochon is still very much a work in progress. The first parts I am tackling are the creation of an empty file to become a disk image (pretty simple) and the partitioning of that file.

For the latter, I could have wrapped GNU parted, but as I got a bit interested in Guid Partition Tables, I decided to implement this in Ruby completely so that it will run on any platform. I'm afraid that won't be doable for some of the other utilities like 'mkfs' and 'losetup', but being able to read and manipulate MBR and GUID partition tables with native Ruby code must have some use in other tools as well.

Github

If you are interested in these kind of tools, please check out https://github.com/ebolwidt/cabochon. Drop me a note if you want share me your insights on the tools, the proper use of Ruby or anything else. If you think this is useful for another purpose, please send me a message as well.

Erwin Bolwidt

Comments:

Post a Comment:
  • HTML Syntax: Allowed

Calendar

Feeds

Search

Links

Navigation