Installing Multiple OS's Without A Floppy/CD/DVD/Etc.

Want to support HowtoForge? Become a subscriber!
 
Submitted by apachedude (Contact Author) (Forums) on Tue, 2007-01-30 14:11. :: Linux

Installing Multiple OS's Without A Floppy/CD/DVD/Etc. 

This article explains how I managed to install over 50 various operating systems on my computer (1 hard drive) without having to burn the distro ISO to disk to boot from. (No floppy, usb, cd, dvd, etc. needed!)

NOTE: There is a full-length version of this article.

I first partitioned my 120GB harddrive into 10 partitions, the 2nd partition is a small swap and the last partition is extra large because it holds all the ISO images..

I then wrote a small shell script to automatically download (I love wget!) the following.

  1. OpenBSD
  2. IpCOP
  3. Libranet
  4. Arch-Linux
  5. Fire
  6. Local Area Security
  7. Packet Master
  8. Devil-Linux
  9. FreeBSD
  10. Knoppix
  11. Helix
  12. Gentoo
  13. Yoper-Linux
  14. NetBSD
  15. RedHat
  16. Slackware

The script also downloads installation manuals and md5 checksums..

I installed Slackware (personal favorite) on hda1 using my last blank CD-R, note that I do not have a separate boot partition. (Should I?). I also installed grub on the MBR. I love grub, if you read through the man pages and all info you can find about grub, you can learn a whole lot. Grub has much more features and capability than lilo, even though lilo comes installed by default with slack.

I organize my kernel situation as follows... In my /boot directory, I mkdir KERNEL, CONFIG, MAP, INITRD and that is a good way for me to keep my kernels and everything organized.. Another good way is a separate dir for each new kernel.

Since Arch-Linux is a solid distro, I'll use that as a first example.

Here is the Arch-Linux section of my shell script

goge Arch-Linux
$w http://puzzle.dl.sourceforge.net/sourceforge/archlinux/arch-0.6.iso
$w http://unc.dl.sourceforge.net/sourceforge/archlinux/arch-0.6.md5sum
$w http://www.archlinux.org/docs/en/guide/install/arch-install-guide.html
md55
cat arch-0.6.md5sum
md5sum arch-0.6.iso
md55

The first thing to do is to mount the downloaded ISO image so we can use it as if it were an actual CD.

mount -t iso9660 -o ro,loop=/dev/loop0 cdimage /mnt/cdrom

Where cdimage= the ISO image. EX. /usr/local/src/ISO/Linux/Arch-Linux/arch-0.6.iso. This mounts the iso as /mnt/cdrom.

Next you need to copy /mnt/cdrom to a separate partition for the booting process.

So

mkfs.ext2 /dev/hda9

(I prefer reiserfs or even XFS to ext but if you use something other than ext2 you could run into some problems because some of the installation kernels and initrds don't include support for reiserfs and so can't recognize the files. Although you could use mkinitrd to create a new initrd with reiserfs support, that might be pushin it IMO... I use the 9th partition consistently for this. I know there is a "right" way to copy the /mnt/cdrom files so everything stays the way it is supposed too, using tar or cpio, but I'm lazy so I just do cp -rp.

So you mount the 9th partition as whatever, say /mnt/hd and then copy the files. Now what?

Now edit your /boot/grub/menu.lst file to include the specific options to boot arch-linux installation. A good idea is to find the isolinux.cfg file somewhere on the distro cd, this will tell you what to include in the menu.lst.

Here is the section in my menu.lst

title Arch Install
  root (hd0,8) 
  kernel /isolinux/vmlinuz load_ramdisk=1 prompt_ramdisk=0 root=/dev/rd/0  
  initrd=/isolinux/initrd.img 

This should be self-explanatory. The root (hd0,8) is pointing to partition 9. So the rest of the commands start from partition 9.

When you experience problems, remember you can always edit the grub boot options by typing 'e' and then edit the section. Also, a good idea is to include several variations in your menu.lst so you can easily try other ways to boot efficiently. And, remember to read up on all the installation guides that come with your distro, specifically, hard-disk installs.

There are special cases, Gentoo, has a semi-new compressed filesystem called squashfs. BTW, this is AWESOME, so check it out. It has to be compiled into the kernel, so some work is in order, but use this recompile to optimize your kernel. You can get the squashfs patch for almost any kernel. I use the latest stable 2.6 kernel. Squashfs is incredible and although I don't think you need it to install from ISO, you do need it to expand the livecd.squashfs filesystem that comes with the cd.

Heres a sample Gentoo section from my menu.lst

title Gentoo Install
  root (hd0,8)
  kernel /isolinux/gentoo root=/dev/ram0 
  initrd=/isolinux/gentoo.igz init=/linuxrc acpi=off looptype=squashfs loop=/livecd.squashfs cdroot vga=791 splash=silent 

A nother' tip is the shell that is provided if you experience problems, typically busybox or ash. The key tools to get you going from here is mount and chroot. Sometimes you will need to manually create a simulated file system and then chroot into it. For instance, you might have to create boot, etc, bin, directories on the target partition.

I generally install each OS onto the next partition (careful of the logical partition) and add it to my menu.lst after install. A good idea is after installation, copy the kernel and initrd (if there is one) to the slackware (or whatever) boot partition on hda1. I copy kernels to /boot/KERNEL/ and initrd's to /boot/INITRD, then menu.lst is more organized...

You then need to add an updated section to your menu.lst (just comment out the install section for later)

Here is the finished arch-linux section from menu.lst

title Arch Linux 6
  root (hd0,2) 
  kernel /boot/vmlinuz26 ro root=/dev/hdc3

Make a backup of MBR using dd and save to floppy, also backup the partition table to floppy, using cfdisk or parted. And boot disks (I use 1 with grub, and 1 with slack, and tomsbootdisk) will invariably come in handy. Tomsbootdisk is recommended, and make the grub boot disk when you install grub. install to floppy.

The final result after some fun experimenting, is when I boot, I have a cool grub boot screen come up with the option to boot into whatever OS I want, this is handy for multiple reasons. One good thing to do after this is to port scan and vuln scan each OS, after you update of course. Write this stuff down and you will know the weaknesses/strengths of the various OS's.

I can boot a custom firewall, snort, or multiple honeypots using this procedure, as well as a graphical kde environment with a kernel optimized for graphics and my processor/architecture, or an environment devoted to forensics or even an environment suitable for programming.

NOTE: There is a full-length version of this article.

P.S. Some of the cooler alternative operating systems are BeOS 5, EOS, ER_OS, V2_OS, and my personal favorite Menuet. Menuet is 100% assembly graphical operating system that fits on a floppy.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.