Saturday, March 28, 2009

Ideal Partitioning for Machines with Multiple OS

Machines with multiple Operating systems must have separate partitions for each operating systems. Typically, most linux distributions use ext3/ext4 formats for file system partitioning while windows uses fat32/ntfs type file systems.
I visualize Partitions to be some kind of super-blocks of a disk. I also think they are necessary for effective disk space utilization.
There is no hard and fast rule to partition the disk and most users content with a single partition disk. However, for better handling and usage of space, partitioning is recommended.

While installing any linux distribution, the installer prompts u to specify the disk partitioning. I wanted to partition my 80 GB disk in such a way that it would be capable of accomodating multiple linux distributions. Users from any distribution (residing in one partition) should be able to access files/users of the any another distribution (residing in another partition). I do so by using the following space allocation technique

The main advantage of such a approach being
  1. Effective utilization of space - every user in each distribution will have the maximum possible space at his disposal.
  2. Disk checking ( an often observed phenomemon in ext 3/4 partitions) can be speeded up/skipped.
  • /boot - This partition is used for all the boot files including the bootloader. The ideal space recommended for the boot partition is 100 MB. I choose this as the first primary partition (hda1) with 100 MB allocated to it.
  • / - The root partition is used for the actual system files of the kernel and the ideal space recomended is 10- 15 GB. (Though any distribution wud not take more than 2-3 GB, many packages and add-ons may be required during the normal usage post installation. If space is a constraint, 3 GB should suffice) I choose this as a second primary Partition (hda2) with 10GB allocated to it.
  • /home - This partition is used for the user specific files, documents, data, movies. pictures and so on. It is advisable to allocate the maximum possible disk space for this partition. I choose this as a extended partition as hda5 with 50GB allocated to it.

Install Ubuntu from an ISO without burning to a CD/DVD

Pre-requisites and Assumptions

1) A minimum of 2 partitions in the disk with at least one partition having enough space to accommodate the downloaded distribution's ISO image. (Use graphical partition manager like gparted to create multiple partitions in case you have only a single partition machine).

To know about partitions check this link.
This partition must be mounted and not touched during the installation. Let this partition be mounted at the location PartitionU.

2) Grub Boot Loader is installed in the machine.( May work with LILO also. But i have'nt tried)

3) The RAM and other hardware requirements specified by the distribution vendor are met.

Procedure:

1) Download the ISO image of the linux distribution to the PC from the appropriate website. In my case, it is Ubuntu Jaunty Jackalope 9.04 from here

2) Navigate to the directory where the ISO is downloaded. Move the ISO image to the partition in which the distribution will not be installed (PartitionU).

3) Mount the ISO image in a mount point using the -o loop option as

# mount -o loop ubuntu-9.04-desktop-i386.iso /mnt

4) Navigate to the mounted folder using

# cd /mnt/

5) In this directory, navigate into the casper directory as

# cd casper/

6) Copy the files initrd.gz and vmlinuz to the partition directory (PartitionU)

# cp casper/vmlinuz Partition2/
# cp casper/initrd.gz Partition2/

Note: for other distributions these files may be present in a different directory instead of casper. Locate them and make appropriate changes in the steps

7) Open the grub configuration file /boot/grub/menu.lst.

# vi /boot/grub/menu.lst

Replace X,Y and Z according to your machine's partition table and add the following contents to the file menu.lst. (u will find similar entries. Append these three lines to them)

title Ubuntu 9.04 Installation
kernel (hdX,Y)/boot/vmlinuz root=/dev/Z ro
initrd (hdX,Y)/boot/initrd.img

The values of X and Y are to be chosen based on the partitions in the machine. To know about Grub naming conventions please read this.

Z may be sd(a/b/c/d) or hd(a/b/c/d) depending on whether PartitionU is on a sata/scsi or ide disk respectively. a/b/c/d denoting the primary partition number 1/2/3/4. Choose the appropriate number.

8) Reboot your machine and choose the new grub entry while booting into.

Note: On reboot, if the machine hangs with the error message "Waiting for Root File System...", the Grub entries were specified incorrectly in step 7. Boot into the right kernel, change the entries and try again.

9) During the Installation, choose "Install from Hard disk option " and also the location of the ISO image as Partition2 if asked. Make sure the partition2 containing the ISO is not touched or formatted during the installation.

10) Thats it ... Enjoy the new distribution !!! The grub entries and ISO may removed after the installation.


Intro

Hi,
I hope i can post some useful linux tricks that i have picked up or some nice links i come across in here...