Recently, I was thinking about to use Puppy Linux with my old computer. Yet my computer is already installed with Arch Linux. I wish not to uninstall or replace the Arch Linux, because installing Arch Linux is time consuming and exhaustive.
Puppy Linux is a live media like KNOPPIX. The official website mentioned that it can be installed into the computer without affecting the original OS, that is, installed side-by-side. This makes me re-called side-by-side installation of Ubuntu and Linux Mint. I tried this feature before using Linux Mint installed in a computer with Windows. It works fine until I give up because of the upgrade problem.
I was interested to test how does it work for Puppy Linux to be installed with Arch Linux side-by-side without affecting the partitions. Thus, I tried it with VirtualBox. Finally, I learnt some interesting things.
To install side-by-side, is actually copying the sfs (SquashFS) and some other related files to a computer filesystem path, such as C:\somewhere (for Windows) or /mount_point/somewhere (for Linux). The sfs contains the compressed filesystem for the Linux distro. That means, it will contains the important binary files such as bash, vim, grep, firefox, thunderbird, and so on. However, the question is, how the computer boots and mount the sfs file?
There is a file, called initrd (or initramfs), may be given with different name based on the Linux distro. It is a small file which is archived with “cpio”. It is small enough to load in the computer RAM. It contains a very limited command-line environment, normally using busybox so that it can perform the commands such as cp, mv, ls, grep, [, etc. Therefore, this initrd is responsible to run an “init” script to load the Linux kernel, mount the filesystem, and so on. It actually happens for other Linux distros like Arch Linux, not necessarily the live media like Puppy Linux.
Now, another question is how does computer load this initrd? This can be done through the boot loader such as GRUB, LILO, or Syslinux. The boot loader, will run the initrd so to load into the RAM. Therefore, the filesystem which contains these sfs and initrd must be recognisable by the boot loader. That is why, the filesystem such as FAT32, NTFS, and ext2/3/4, is able to be installed with Puppy Linux (or other distros) without affecting the partitions (side-by-side installation).
So, after trying this, now I have better knowledge about how Linux doing the booting,
- starts from the boot loader, such as GRUB,
- loads the initrd or initramfs, and finally
- initialises the Linux distro.
So, this initrd is actually part of the Linux distro. Different Linux distro may have a little difference for the filesystem structure, as a result, initrd may also work differently.