Monday, February 14, 2011

Manual / Advanced Partitioning in Ubuntu Installer (Windows dual-boot included)

Ubuntu (Ubiquity) installer prior to 10.10 Maverick Meerkat used to come with a handy option "Use the largest continuous free space" which used to automatically create partitions in the free space. It is no longer available. Here is the bug report:

https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/652852

And another option in Ubiquity installer, "Install alongside other operating system" in 10.10 is known to cause some severe damage. It has been reported that under certain circumstances, it doesn't install Ubuntu alongside the other OS. Instead, it just wipes out whole of the drive and you lose everything including the other OS and your personal data as well. Here is the bug report:

https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/682429

Also see kansasnoob's disaster thread at the Ubuntu Forums:

http://ubuntuforums.org/showthread.php?t=1622388

So, the safest option is "Specify partitions manually (advanced)". In case of a dual boot or even a single boot, I am a big supporter of Manual Partitioning as you can choose the size of your System partition, /home partition and Swap. You can also add separate partitions for /boot, /home, /var, etc.

And the option to choose the location of Grub (Ubuntu bootloader) is only presented if you choose the Manual partitioning option. So if you want to install Grub to a location other than the default one (which is MBR of your first HDD), you need to choose manual partitioning.

Basic Partition Setup

Ubuntu basically needs just 2 partitions for installation:
  1. / partition (System), Mount Point '/', which holds all the base install. File system ext3/ext4, (ext4 is the default since 10.04 Lucid Lynx) and recommended minimum size is 8 GB.
  2. Swap partition (Virtual RAM), mount point 'Swap'. If you intend to hibernate/suspend your Ubuntu install, size should be 2 X RAM or at least equal to RAM. If you've got large amounts of RAM say 2GB or more and don't want to hibernate/suspend, you can survive without a Swap partition but that is not recommended in most cases.
Ubuntu doesn't need a Primary partition to boot. It can boot from an Extended/Logical partition and it doesn't require a boot flag on the system partition either.

Windows Dual-Boot (Windows pre-installed)

A basic disk can have a maximum of 4 Primary partitions. An Extended partition itself is a Primary partition so you are left with 3 Primary partition and one Extended partition. Then you can create as many Logical partitions inside the Extended one as your disk space permits you.

Partitions don't need to be in order. It means that if you free up some space from your first Primary partition and want to create an Extended partition in its place, it can be done. That way you'll have a Primary partition in the first place, Extended in the second and Primary in the third and fourth places.

So imagine, you already have Windows XP/7 installed on one of your Primary partitions and there 2 Primary data partition as well. So your setup roughly looks like,
  1. sda1, NTFS, Windows XP
  2. sda2, NTFS, Backup
  3. sda3, NTFS, Data
If Windows 7 is installed, there may be an additional System partition in the first place. Its default size is 100MB and filesystem is NTFS. So in either case, you need to free up some space for Ubuntu and for that, either need to delete one of your partitions permanently or need to resize it and create an Extended partition in the freed up space. If there are 4 Primary partitions already, you can't resize and create an Extended partition in the freed up space as 4 Primary partitions is the limit. In that case, you need to get rid of one of your Primary partitions, no other choice.

If you plan to delete one of the partitions, it can be done right from the installer's partitioner.

If you plan to resize one of your existing partitions, and as the partitions are formatted NTFS, it is strongly recommended that you use the Windows partitioning tools instead of GParted or any of the Linux tools. You can find Windows partitioning tool by right clicking Computer > Manager > Disk Management. It was specifically built to resize the Windows partitions without data loss. Defrag your driver, resize it, run chkdsk multiple times and before trying to install Ubuntu, make sure by rebooting multiple times that Windows itself is running properly.

If you are going to dual-boot Ubuntu and Windows 7, make sure your drive is a Basic disk and not a Dynamic one as Dynamic disk is Microsoft proprietary thing. Linux doesn't support it and you may end up losing some or all of your data. If you find that your disk is a Dynamic disk, Windows 7 partitioning tool can convert it to Basic for you but make sure to have strong backups of everything important on your drive.

http://www.sevenforums.com/tutorials/26829-convert-dynamic-disk-basic-disk.html

If you wish to find out if your disk is a Basic or a Dynamic one from the Ubuntu Live CD, run following command in Terminal (Applications > Accessories).

sudo fdisk -l

If the output contains "SFS", probably you've got Dynamic disk. Time to go back to Windows and convert the disks.

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x22feface

Device Boot Start End Blocks Id System
/dev/sda1 1 26 204768+ 42 SFS
/dev/sda2 * 26 57876 464679936 42 SFS
/dev/sda3 57876 60802 23500824 42 SFS

Manual Partitioning

At the "Allocate drive space" page, choose "Specify partitions manually (advanced)".


At the next screen, it would show you all your existing partitions and on the same page, you can delete, change or create new partitions. If you have more than one hard disks, choose your intended hard disk from the drop down menu.


Now we need to free up some space. If you've already freed up some space using the Windows tools, skip this step. If you want to delete one or more of your existing partitions, highlight them one by one and click delete.


So once you have deleted all the intended partitions, select the unallocated space and click "Add".


We'll create Logical partitions for Ubuntu. For a basic setup, you need just a '/' partition and a 'Swap' partition.

Follow the screenshot below. Use custom size whatever you can afford, recommended is > 8GB. You can also change the Filesystem to ext3 if you've got some strong reason to do so otherwise ext4 is the default choice.

From the drop down menu under Mount Point, choose '/' and click OK when you are done.


Now choose the remaining unallocated space and once again click Add.


Create a Swap partition as shown in the screenshot below.


Press OK and you've defined the essential partitions for Ubuntu installation. I say 'defined' because the partitions have not yet been created yet. They will be created once you click Install Now. Using the 'Revert' button, you can revert any changes to the partitions without data loss.

If you want to, you can create a separate /home partition. Minimum recommended size is 4 GB, mount point /home and filesystem ext4.

/home holds you personal files configuration for all the software on your PC e.g, Firefox bookmarks, VLC settings, themes etc. Having a separate /home is bonus in case you decide to re-install Ubuntu as it would keep all your settings. All you need to do is define a mount point '/home' during re-install and remember not to format the /home partition.

Grub Loader

In most cases, the Grub Loader needs to be installed to the MBR of first hard disk. If there are more than one HDDs, you need to make sure that your Bios is capable of booting from the HDD to which you are going to install Grub. Most of the Bios do, but some don't which include Laptops and Notebooks mostly.

At the bottom of "Allocate drive space" page, you can see a drop down menu listing all the possible destinations of Grub.

If Windows is installed on one HDD and Ubuntu is going to be installed to the other HDD, it is recommended that you install Grub to your second HDD thus leaving the Windows MBR intact. That way, if you lose Grub somehow or remove the Ubuntu HDD later, you'll still be able to boot Windows and won't need to repair the boot record.

You always need to choose a device i.e, sda, sdb, sdc, sdd, sde and so on (without an integer) from the drop down menu instead of a partition i.e, sda1, sda2, sda3, sdb1, sdc1 and so on unless you know exactly what you are doing (in which case you won't be looking at this guide).

So, choose your preferred device and click "Install Now". Hopefully everything will be ok and your shiny Ubuntu system would be installed successfully.


Good Luck!

Related Posts:

Installation , System