How to Install MOFO Linux On A Hard Drive.

MOFO Linux is a fast and lightweight operating system, derived from Porteus, and distributed as a live CD iso file. There is an installer application included with MOFO Linux, and it may be used for hard drive or USB installations. It works quite well. The built in installer can set up MOFO Linux as the only system on the machine or put it on a disk partition as one of multiple installed systems. If you have a USB flash drive with at least 8 GB in capacity, it is possible to use the installer to create a portable system on a bootable stick.

Instructions given below are for a "frugal install" using an iso image or files copied from an image. It is much smaller than a full-on installation because the filesystem is maintained in compressed form as found on a DVD. A frugal install only requires enough space on a USB stick to hold the iso file and bootloader. Frugal installs can be added to an existing system with minimal cost in drive space.

To add frugal istalls to an existing Linux system, it is suggested to create a separate partition to hold MOFO Linux and other special frugal installs. This will ensure that updates or clean-ups for one system do not damage or clutter the other one. Yes, you could create a folder in existing system's root partition to hold isofiles, but it requires caution. The webmaster has accidentally erased frugal installs kept on his main system during overzealous maintenance. Take the lesson and keep MOFO Linux on a different partition...


Prerequisites (Systems Already Running Linux)

  1. A mainstream Linux system already installed, such as Debian, Ubuntu, Arch, Mint, or other type with Grub2 as the bootloader.
  2. At least 2 GB of free space available for MOFO Linux
  3. A MOFO Linux ISO file. Get MOFO Linux from here.

In the example used here, the computer has one hard drive, and it is divided into two partitions. The main system runs on the first partition. The second partition serves as storage for documents, backups, and a frugal installation of MOFO Linux. Be aware that the drive and partitioning scheme is peculiar: the first drive is "hd0" while the first partition is numbered "1" and so forth.


Installing the MOFO Linux ISO File.

  1. Start up the main operating system on the computer.
  2. Open the file manager as root.
  3. On the hard drive, in the partition to be used for frugal installations, create a folder called "isofiles."
  4. Navigae to the MOFO Linux ISO image and Copy it (CTRL-A).
  5. Paste the disc image to your new "isofiles" folder (CTRL-V).

Configuring Grub2 to Boot MOFO Linux

  1. In the file manager, as root, navigate into the folder /etc/grub.d
  2. Create (or edit) the file "40_custom" to contain the following:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry 'MOFO Linux' {
        insmod part_msdos
        insmod ext2
	set root='(hd0,2)'
        set isofile='/isofiles/mofolinux-4.4.iso'
        search --no-floppy --file --set=root $isofile
        loopback loop $isofile
	linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile boot=casper quiet splash threadirqs ---
	initrd (loop)/casper/initrd.lz
}

  1. Startup options included after vmlinuz were taken from the file "/boot/grub/grub.cfg" on the disc and can be changed to suit user preferences."
  2. For multiple MOFO Linux startup options, create more "menuentry" items and give each its own startup options.

Installing MOFO Linux Frugally on Windows Machines.

Yes, it is entirely possible to put MOFO Linux on a machine with Windows already installed! Similar to other dual boot setups, it is necessary to create a partition separate from Windows and install Grub2 as the bootloader on that partition. It is actually much like the dedicated USB installation shown below, but instead of a separate flash memory device, the files and bootloader are installed to an extra partition just above Windows. To boot windows, Grub2 is set up to chainload the Windows bootloader.

For accomplishing this sort of installation, you must correctly determine the partition to be used for holding the MOFO Linux iso file and Grub2 configuration files. This example depicts a hard drive with Windows on the first partition and MOFO Linux on the second. Expect Windws to occupy /dev/sda1; install Grub2 and MOFO Linux to /dev/sda2.

We will begin by installing Grub2 to the second partition on the hard drive. Boot the machine into Linux from a live DVD or USB stick, mount the partition, and then write the Grub2 data to the second partition as shown below:

1) Open the terminal and get root priveleges:

sudo su

2) Verify the location of the second drive partition:

fdisk -l

3) Set up a mount point to work on the partition. You may delete it later:

mkdir /mnt/MOFOPARTITION && mount /dev/sda2 /mnt/MOFOPARTITION

4) Install Grub2 to the drive:

sudo grub-install --force --no-floppy --boot-directory=/mnt/MOFOPARTITION/boot /dev/sda2

5) Create a directory to hold the one or more isofiles:

mkdir /mnt/MOFOPARTITION/isofiles

6) Use your file manager, drag and drop the MOFO Linux iso file into the "isofiles" directory in the partition.

7) Create a "grub.cfg" file located at /boot/grub/grub.cfg in the partition which will hold menu data and direct grub to boot using one or more isofiles. In this example we will configure for booting MOFO Linux, Skywave Linux, and Windows 7. Be aware that Grub counts drives starting at zero and partitions starting at one:

set timeout=20
set default=0

menuentry 'MOFO Linux 4.3' {
        insmod part_msdos
        insmod ext2
	set root='(hd0,2)'
        set isofile='/isofiles/mofolinux-4.3.iso'
        search --no-floppy --file --set=root $isofile
        loopback loop $isofile
	linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile boot=casper quiet splash threadirqs --
	initrd (loop)/casper/initrd.lz
}
menuentry 'Skywave Linux 1.4' {
        insmod part_msdos
        insmod ext2
	set root='(hd0,2)'
        set isofile='/isofiles/skywavelinux-1.4.iso'
        search --no-floppy --file --set=root $isofile
        loopback loop $isofile
	linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile boot=casper quiet splash threadirqs --
	initrd (loop)/casper/initrd.lz
}
menuentry 'Windows 7' {
        insmod part_msdos
        insmod ntfs
        set root='(hd0,msdos1)'
        chainloader +1
}

Booting the MOFO Linux Frugal Install

To run MOFO Linux, simply boot the computer and await the appearance of Grub2's menu. It should list both the main system and also MOFO Linux. Select MOFO Linux, and observe a normal startup sequence. After a few seconds of scrolling messages, the desktop should appear. At this point, the system is ready to run.

Other systems may be added in the same manner as MOFO Linux. Kali Linux, Slitaz, SLAX, Siduction, Knoppix, or any other live CD or DVD may be installed alongside MOFO Linux. The iso files may all reside in one group, but each will need its own entry (plus startup options) written to "/etc/grub.d/40_custom."


A Dedicated USB Stick For Frugal Installs

Yet another option is putting multiple systems onto a large USB stick or SD card. In that case, you must install grub to the USB stick and then use the file "/boot/grub/grub.cfg" for the menu entries. There are computer users who actually use nothing but frugal installs on a large USB stick, with the hard drive strictly storing documents, multimedia files, and so forth.

To install Grub2 to the boot sector of a USB stick, you will plug in the stick, mount it, and then write the Grub2 data to the stick. In the following example, we'll install to a USB flashdrive plugged into a machine running Linux on the hard drive. The hard drive is "sda" and the USB stick is "sdb". The first partition on the USB stick is "sdb1".

1) Open the terminal and get root priveleges:

sudo su

2) Verify the location of the USB stick:

fdisk -l

3) Set up a mount point to work on the USB drive. You may delete it later:

mkdir /mnt/USBDRIVE && mount /dev/sdb1 /mnt/USBDRIVE

4) Install Grub2 to the drive:

sudo grub-install --force --no-floppy --boot-directory=/mnt/USBDRIVE/boot /dev/sdb

5) Create a directory to hold the isofiles:

mkdir /mnt/USBDRIVE/isofiles

6) Use your file manager, drag and drop the MOFO Linux iso file into the "isofiles" directory on the USB stick.

7) Create a "grub.cfg" file located at /boot/grub/grub.cfg on the USB stick which will hold menu data and direct grub to boot using one or more isofiles. In this example we will configure for booting MOFO Linux and Skywave Linux. Be aware that Grub counts drives starting at zero and partitions starting at one:

set timeout=20
set default=0

menuentry 'MOFO Linux 4.3' {
        insmod part_msdos
        insmod ext2
	set root='(hd0,2)'
        set isofile='/isofiles/mofolinux-4.3.iso'
        search --no-floppy --file --set=root $isofile
        loopback loop $isofile
	linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile boot=casper quiet splash threadirqs --
	initrd (loop)/casper/initrd.lz
}
menuentry 'Skywave Linux 1.4' {
        insmod part_msdos
        insmod ext2
	set root='(hd0,2)'
        set isofile='/isofiles/skywavelinux-1.4.iso'
        search --no-floppy --file --set=root $isofile
        loopback loop $isofile
	linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile boot=casper quiet splash threadirqs --
	initrd (loop)/casper/initrd.lz
}

Test the USB stick by rebooting the computer system and making sure the BIOS is set to look for the stick as either a USB flash memory or as a hard drive on the system. If necessary, use "E" to edit the Grub commands at boot time and find out what works. Most problems involve pointing Grub to the isofile, then to the vmlinuz and initrd files within the iso.

Persistence: How to Keep Your Changes

There is no need to lose files you create or changes you make while operating your system from an iso file! Configure the system to boot with persistence enabled. In the persistent mode, new data and settings are written to a dedicated partition which holds them safely between shutdown and subsequent restarts. Sure, it is possible to manually save your files before shutting down at the end of a computing session, but why bother when persistent mode does it automatically? You can even install software and retain it for future computing sessions.

Persistence requires two things: a dedicated partition of at least 128 MB and an additional boot parameter. When setting up partitions, create one in EXT2 or EXT3 format and label it "casper-rw". Persistence can be added to an existing USB stick or SD card by creating a new partition and setting the label to "casper-rw". For best results, consider making the partition 1GB to 2GB in size. Then add "persistent" to the kernel boot options in grub2. At start-up, the system will find and use the partition for any changes made.

Good luck, and enjoy the convenience and robustness of having one or more operating systems frugally installed to an inexpensive USB drive.


Tags:Linux Multiboot Grub2, MOFO Linux Grub2, Customize Grub2
©2015-2017 MOFO Linux, All Rights Reserved.
About, Contact Us, Privacy Policy, XML Sitemap.