Thursday, May 15, 2014

Dual-boot with Windows. Part I

It's most likely that if we have a brand new equipment we will prefer to have two OS instead of only Linux, so we can have the best of world worlds without dedicating in exclusivity a whole machine. This is today a more and more common option as HDDs space has been increasing exponentially while prices have shown little variability. In the 80's a hard disk of few megas could cost thousands of dollar. Now we have HDDs in the magnitude of TB (1024 Gb!) for less than a hundred dollars. Our space needs however will rarely meet this amount, so a multi-boot option for system management in more common nowadays than it was in the past. This system management is, however, still a bit tricky and will require advance knowledge to set a working efficient system. The introduction in the first post will help us to understand what is really happening when we install a new operative system and how we can make our system to recognize both without drawbacks. For this post we are going to assume a non-trivial case, but extremely useful to understand what we can achieve with the right tools and administration knowledge.


Dual-boot with Windows 7 and Kali Linux on a brand new machine

In the first post I commented that most modern systems won't try to take the whole system space for them. Whether this affirmation is true, it's not complete. It would be better to say: Modern OS won't take the whole system space for their exclusive use, but may not recognize other OS to share resources with. Even if OS will keep their partitions for their own use we are going to find an ugly surprise from Windows systems: Installing a Windows OS on a HDD will rewrite the MBR information of other previously installed OS. The partitions from previously OS will be still there, but inaccessible and the boot routines will be removed from the MBR, so they BIOS won't be able to boot another OS. How to proceed? Let's get it on.


1. Installing Windows 7: Partitions of an equipment with two or multiple hard disks


Windows will try to rewrite our MBR area in the HDD where we want to install it, so it will be wise and commonly less problematic to install it first, so we can later redo our MBRs. Let's start by installing Windows 7 and creating our first partitions:



Pass through the typical installation first steps: Select your main language, keyboard configuration (the country and language your keyboard was made specifically for), time zone, etc. Nothing special to do in here. At one point Windows will ask you for creating partitions. Here's where the magic starts. It's better to think carefully how do we want our equip to be configured for in the future it will be more difficult to set again a new configuration.

As said in the title, we are going to assume we have two or more hard disks. If we have bought a new equipment even if we purchased it without a OS preinstalled typically it will come with a minimal OS, let's say a freeDOS. If we purchased it with another OS that we don't want to use, or use minimally, we may want to keep them but reserve them a minimal space in our hard disk. Whatever premises we may have at this point what is really important for ourselves is to know that we can shrink the space that a previous preinstalled OS was occupying.

Moreover, if we have a new equipment with two hard disks, let's say a standard SATA hard disk (the typical hard disk that comes with all PCs, with around 1Tb of space) and a SSD or solid state hard disk (a new version of hard-disk that became popular recently, with a much higher read/write speed than the normal SATA disks, but more expensive and typically with less space. Commercial SSD hard disks are sold with a storage space of 128/256 Gb, beginning of 2014) chances are the pre-installed OS was preinstalled on the SATA disk, except if we asked the retailer to install it specifically in the SSD disk. If we didn't have this option and we purchased a new equipment with an extra disk, let's say a SSD, chances are any preinstalled OS will come in our SATA disk. This is going to create us a little trouble, but that's why you are reading these lines, aren't you? Nothing to worry, we can have many OS in a multi-drive system. For now just remember the past lessons: There's one MBR per HDD, where we can have many boot-loaders for different OSs, not necessarily installed in the same HDD.

Let's make an incise on what is going to happen during installation before we proceed. It's important to know what will happen with the MBRs and the differences between partitions. Not any partition can be used as a boot-loader.

Windows partition types:

  • Primary partitions: These are the standard partitions created by Windows. There's a limit in the number of them that can be created per HDD. A MBR record written by windows will allow up to 4 primary partitions, or 3 primary partitions + an extended partition. Only a partition formatted as primary will be able to host a bootable OS.
  • Extended partition: If we would like to create more than 4 partitions, we will need to create the fourth as an extended partition. The extended partition can contain however many other partitions called logical partitions. The number of logical partitions on a extended partition is limited only by the number of letters in the alphabet, that Windows will assign to each partition, but I'm sure you don't need more than 29 logical partitions.
  • Boot partition: Ha! Windows calls it boot, but its in fact the last part of the chain that starts in the MBR to boot an OS. A partition tagged as boot will contain a loader to run the OS that it holds. However the boot manager that will be started after the MBR checks the partitions on a HDD may be in another partition. Only a primary partition can be tagged as boot, and it will contain a loader to boot the OS it stores.
  • System partition: The primary partition holding the boot manager. After the BIOS jumps to the MBR of the HDD assigned to boot a system from, it will move to a volume boot record (VBR) that contains a little program commonly known as boot manager. After a MBR is read, it will move to the partition holding this manager. The manager can contain the address of many loaders , each of them in different disks. The manager, however, must be in the same disk than the MBR. A MBR can't be redirected to a manager in a different HDD.
  • Active partition: The partition named as active is the one holding the operative system that we have booted. The one you are running while reading this. The active tag is assigned consecuently after booting a OS, and we can't choose it. Nothing to do in here.




Main File-Systems recognized by Kali

Non-linux, but supported
Max. Single file size
Max. Partition size
Journaling*
FAT16 (Legacy, don't use)
2 GB
2 GB
No
FAT32 (Legacy, don't use)
4 GB
8 TB
No
NTFS - Windows standard
2 TB
256 TB
Yes
Linux



ext2 (Legacy, don't use)
2 TB
32 TB
No
ext3
2 TB
32 TB
Yes
ext4
16 TB
1 EB**
Yes
* Consistency support. Detects faulty write processes before overwritting files with corrupted data.
** Yes, that's an Exabyte. 106 TB.

Probably you have heard of the FAT file systems. Sometimes pendrives comes formatted with a FAT32 system. These were the ones used in Windows versions before Windows XP. There's no reason to use a FAT filesystem to install Windows nowadays, as NTFS is recognized by Linux OSs. They are still disposable however in gParted and the Windows Disk Manager for legacy reasons.

NTFS is the standard file system for Windows OSs since XP. It's recognized by Kali, but don't use it for installing it.

ext is the typical file system for Linux Oss. ext4 started to take over the reign of ext3 and nowadays can be accessed from Windows OSs with tools like ext2fsd. In doubt, use ext4.

More to come in Part II, where we will learn about boot managers and boot loaders.

No comments:

Post a Comment