Story of a deep space exploration

In Chapter I I pretended to touch the ground but what I did was just a setup of the overall system that I need. Nevertheless, I learned really a lot along the way and now I feel closer to "the ground" than I was at the beginning. In this chapter, I will try to do some other steps ahead, but I want to introduce a different metaphor now, which may communicate my feeling in doing what I am attempting to do. Consider that I have no computer science education and I am doing it as a hobbyist. So the metaphor is: we want to explore an alien planet in the deep space1. The alien planet is my bare-bones PC. Any piece of software, that I am writing in this chapter, is an exploration module to be sent to the planet. GRUB2 is the spaceship which travels the space and delivers the exploration module on the planet. As every space exploration story, we will try to build simple modules to accomplish simple tasks and increase the complexity step by step. We will have a simulation and test centre here on earth (DEBUG) to check out our module as far as it is possible before sending them to space. Now we need a method to put our module in the cargo bay of the spaceship.
For this purpose we will use the command dd in Ubuntu in the following way:

dd if=/home/mik/Desktop/module.bin of=/dev/sda2 bs=512 count=1

In short, what this command does is to take an input file (in this case truly a file specified in if=) and write to an output location (even if of= should stand for an output file, which in this case is the first block of the partition 2 of the HDD). So our modules will be 512 bytes in size to fit within the first sector of the drive. At boot, our spaceship (GRUB2) will put the module on the surface of the alien planet and release control.

Space exploration can be very dangerous and one should be prepared to everything so it is wise to use the command dd in the opposite way around to create backup copies of the boot sectors of each partition in the following way ( x=0,1,2,.. stands for progressive numbers for each partition):

dd if=/dev/sdax of=/home/mik/Desktop/sdax.bin bs=512 count=1



  1. From now on, I used this metaphor in all the rest of my diary. It makes so sense to me that I made it the theme of the blog. [click back]

<PREV.  -  ALL  -  NEXT>

Comments