I had started learning Unix (a couple of months ago),so there was this zest to improve and try doing something worthwhile ,rather than just screw up my system twice a day trying to install may OSs.
Something caught my eyes while surfing belenix.org and it was a project listed there,for it said “Ram based boot for Belenix”.This stood out for me and i took it up.Well no sooner did i take this up than it was time for me to head to college
However as soon as I started working on this,i ran into issues.I was helped in getting an understanding of the processes and how I need to proceed by Moinak Gosh from SUN.So once the tutions were over. It was back to studiesAs i started out the primary focus was on 2 important files, Namely,
Before we start off ,click here to have sneak peek into how a livecd works!!
Currently these files were being mounted directly from the cdrom and evidently these folks needed to be in the RAM for the project to succeed
This was the catch.The reason being at the point in time when this script runs(live-fs-root) the mounting of swap is not initiated yet.So for all reasons I have no RAM suiting my requirements.Like they say,every question has an answer,and so was the case here as well!!!
The option now was to mount swap on /tmp explicitly (in live-fs-root script) and override the default script that does this mounting.As usual there was another issue here,lack of binaries..
Generally the format for mounting is
mount -F tmpfs swap /tmp.
This was not working because there were no binaries in the ramdisk at that moment in time
The surprising thing here was that when i tried booting into the working copy of belenix and made my way to the binaries they were present in the path :/usr/lib/fs/tmpfs, But when i came back to the ramdisk and checked out the same path ,it only extended upto /usr/lib/fs/
No tmpfs directory at all.This ghostly behavior kept me thinking and later I figured out that this specific binary was not omitted but was intentionally kept out,as there was no need for it until now(save every amount of space we can in a livecd).
So I actually, mkdir tmpfs then copied the binaries.Yet no luck.Now it started to get to me,and a few more reboots into the working copy i figured another way out..
There are mount binaries, also present in the /sbin dir, i thought why not give it a shot?so i just executed the binaries itself and hurray!!
code: /sbin/mount -F tmpfs swap /tmp
Now the first stage was done..I have complete control over the swap.Next was to copy the 2 files onto RAM.As one might think a regular cp <files> </tmp> should have done the job…Well this was far from regular !!!!!
Nevertheless I got an error stating “cp: command not found”,So i went back to the ramdisk and checked to see if the binaries were present,as usual it was not there(PATH:/usr/bin/cp).
Again i copied the binaries(by now i was very familiar in looking for binaries , to the required path and executed the binaries …Worked flawlessly
The next stage was the “lofiadm” stage.The command is used to associate a file with a block devices,once the association was created , it was only a matter of mounting these 2 files into respectively places…
(Perhaps the easiest of the lot!!It was now time to give it a try (figures crossed)..And it worked magnificently
Some interesting facts!!!!
Since its now running from RAM, the boot time is reduced,which is perhaps the main concern in Livecds
Secondly since belenix 0.7 is now installable and that the processing begins at RAM,the install time is reduced to an staggering 10mins.(No cheeky stuff here ,i’ve tried it out),Amazing isnt it?
Also there is one more Magic that this can do ,Have a look at the picture
That’s right,you can actually eject the cdrom drive which was never before possible…
Advantage:You can watch a movie from an operating system that is not on your HD ,and definitely not on your cdrom
This one shows the actual copy and that the files rest in RAM… The lofiadm command output earlier read
/dev/lofi/1 /.cdrom/solairs.zlib compressed(gzip-9)
/dev/lofi/2 /.cdrom/solairsmisc.zlib compressed(gzip -9)
Plans for the future:
I am currently working on providing a boot time option ,so that the user can select if he want to boot it off ram.
Also to make life more easy,an auto ejection mechanism once the GUI is up and running