• Welcome to Jose's Read Only Forum 2023.
 

Using Windows to Prepare for Non-Windows OS Installs

Started by Donald Darden, March 21, 2008, 05:54:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Donald Darden

The slow development of PC technology has had totry and  accomidate new concepts and old design standards at the same time in an ongoing cycle.  If we knew then what we know now, much of what is would not be.  But much of progress is measured in terms of failures and what we learn in the aftermath, and often the steps taken and gains made are small ones.

Software and hardware development do not go hand in hand.  Software often lags years behind the potential offered by new and continuing hardware capabilities.  When hard drives outstripped the maximum addressing capacity supported by the software, new methods addressing the added capacity of drives had to be developed.  They could increase individual sector sizes, group sectors into clusters, increase the number of bits used in the address itself, or allow you to subdivide the physical hard drive into multiple partitions.  And they could consider some way to map the drive so that the operating system sees it one way, but at a lower level, the drive is accessed a different way.

Guess what:  They did all these things, because drives kept getting bigger and people wanted to use what they bought.  Now one of the design decisions made was that you could have 1, 2, 3, or 4 primary partitions on a single hard drive.  If you wanted more than that, you could make one of the primary partitions into an extended partiton, then put 1 or more logical partitions in that.  And each drive could have one active partition, which is the partiton that you boot to when you start up.  And "Oh by the way", the active partition must also be a primary partiton.

Sounds simple and straightforward, doesn't it?  But actually, it can get rather involved.  For instance, almost everyone that uses an extended partition puts it at the spot where the last partiton would go.  But that doesn't seem to be spelled out anywhere, which means you could try to put it at the second or third partiton spot instead.  You could also try to put up a couple of extended partitons, and put up logical partitions in each.  You could strive for something strange, like primary - extended (logical - logical) primary - primary, and maybe that would work.  Partitions can also be marked as hidden, so that they OS will ignore them - no drive letter, no ability to read or write to them.

Most PCs today have one hard drive set up as two partitions, which are your C: drive and our D:  drive.  The C drive is you system drive, and you have everything that you use installed there - your operating system, which is probably some version of Windows, your applications, your data, and all your photos, videos and music clips.

Your D: drive may be flagged as hidden, and it may be very small, only needed to hold your initial software in compressed form, and only used to restore your hard drive to its original configuration if you have to do a recovery..

Different venders implement the D: partition in different ways on your hard drive.  Some put the D: partition as the first parttion, then mark it as hidden.  What happens then is that the D: drive is ignored, and the second drive becomes the C: drive by default, and that is where the system boot from.  During a recovery, the process unhides the first partition, and it now shows up as the C: drive and gets booted to, and then it automatically restores the original software to the second partiton, formatting the second partiton as well, then hides itself and does another reboot, so now it boots back to the second partition, which it now sees as the C: drive.

Other venders use the typical large C: primary, followed by a small D: primary arrangement.  The recovery process hides the C: primary so that the D: is recognized as the new C:, gets booted to, unhides the C; partiton which is given a temporary drive letter, the software is restored to it, and on the reboot the original C: drive becomes our system partiton again.

In practical terms, it really only matters whether the C: or D: drive is first on the hard drive, and what happens if we decide to subdivide the C: partition into other partitions, or whether we want to install another (or replacement) hard drive. 

So far we have only discussed now Windows sees partitons.  And Windows only recognizes partitions that are flagged as FAT or NTFS volumes, it ignores all other kinds.  Further, Windows scans across drives and by partitons, looking for primary partitions first, which it normally assigns consecutive letters to, starting with C:, then it assigns letters to the logical partitions that it finds.  Extended partitions are not identified with letters, and foreign (nonMicrosoft) partitons are likewise ignored.

The problem then is that if you have any logical partitions on your first hard drive, then install a second hard drive and set up any primary partitions, the drive letters will change based on the way that Windows searches and finds each partition.  A further complication is that your BIOS may support USB or other boot devices, and in detecting valid, bootable devices and partitions, for which drive letters may be assigned on the fly.  Thus, drive letters become a matter of concern when handling a changing partition environment.

Linux does not use drive letters, but rather designates partitons by where they are found and in what order, and it does not care what format is used with those partitons.  The first floppy drive is always fd0 (floppy drive 0), and the first hard drive partiton is always hda0 (hard drive 0), while the first hard drive partiton on the second drive is hdb0.  These designations do vary somewhat - in Ubuntu, which mistakenly sees EIDE drives as SCSI removable drives, the first hard drive partiton is designated sda0 rather than hda0.  And under Ubuntu, since it thinks I have removable hard drives, it has two drive records for each, one under /dev, and one under /media.

Some Linux distro might shorten the drive name slightly, such as ha0 in place of hda0,  But as a general rule, Linux shows more consistency in how it references partitions than Windows does, and it is somewhat more tolerant of various partition arrangements.

The problem is, you set up Windows, then you repartition your hard drive and install Linux, then you try to boot up Windows again, and you may find a problem.  Or you cannot get Linux to boot after you install it.  Or you can't even get access to Linux after you install it.

As a result of my experience when configuring multiboot PCs with Windows and other OSes on them, I have settled on some rules of thumb about the best way to do this.

First of all, I limit my boot options to using the Windows boot manager.  This is managed by the boot.ini file on the C: drive.  This file is normally flagged System, Read-only and Hidden, but you can the /Start/Run to change this:

cmd  [Enter]                              'Enter the command line mode from Start/Run
cd \   [Enter]                                         'change directory to the the root folder level
attrib -r -s -h boot.ini [Enter]                'clear the flags on boot.ini
edit boot.ini [Enter]                   'you can also edit this file in the GUI using notepad
'make necessary changes to the contents of boot.ini and save & exit
attrib +r +s +h boot.ini  [Enter]          'reflag boot.ini to normal status


That's actually pretty easy to do, and if you don't change the existing boot paths, you will not cripple your ability to boot into Windows later.  You can edit the displayed boot options, change the timeout for the default selection, even change the default selection, and still have a fairly simple boot control that works.

Next, in order to install any version of Linux into its own partition, you actually have to set up two partitions.  One will be the swap partition, which only has to be a megabyte or so in size.  The other should probably be an EXT3 partition.  There are other choices, but EXT3 is something that Windows can almost deal with, and can actually work with if you elect to install the EXT2 driver into Windows.

The problem with arbitrarily setting up partitions is that this means shrinking, and possibly moving, one or more of your existing partitions.  Under Windows, shrinking your C: partition, which is your largest partition and the obvious choice, is a problem because it is also your system partition.  That is the same disk that holds your OS and all applications, and Windows freaks out if you try to do this.  It is best to use third party software for this, most of which either boots from a floppy or CD.  It can be searched for and downloaded from the internet, and some of it is free.  Depending upon the size of your CL partiton or your hard drive overall, you may find that some of the software is outdated and unable to properly access big drives.

Another approach is just to go ahead and download a Linux distro that interests you, then use its partitioning software to downsize that big C: drive.  You might want to go ahead and create the new partitons that you need in the freed-up space, but there is a small concern at this point.

The concern is that Windows may have a problem with those new partitons later.  I don't know why, but I have found that Windows is not real keen when it comes to acknowledging new partitions sometimes, even when they are foreign and it is just suppose to ignore them.  So to deal with this, I generally use that third party tool to shrink the C: partition, but then I boot back into Windows for my next round of changes.

So now let's say you are booted into windows, and your C: partition has been resized to allow enough free space for a Linux install.  What I do then is use Start/Settings/Control Panel/Administrative Tools/Computer Management/Disk Management, and I look at the drives I have on my system.  I can then tell Windows to create two empty partitions in the freed disk space.  I don't format them, and I don't assign a drive letter to them, and I don't try to name them.  I just make them, and I am done.  But what I have done is give Windows the chance to define the outline of these partitions, and I have a much greater certainty that Windows will not have a problem when it comes to idenfitying them later.  Now I can leave Windows and return to my efforts to install Linux.

This time when I perform the Linux Install, I target the blank partitions that Windows set up and tell the system to format the primary one for EXT3 and make the mount point /, which is the root partition.  The swap partiton it designated, and it will get formatted as swap.

The other question that will come up is where the boot process is to be installed.  With distros today, this will probably be managed with GRUB.  You have several valid choices, which may be presented to you by name, or which you can specify by putting in a device name.  For instance, it may ask you if you want to boot from a floppy, or you could enter (fd0), and the boot process will be placed on a floppy disk.

If you specify MBR, which is the Master Boot Record, or name the (hda0) device, the GRUB boot will replace the Windows Boot process on the C: drive.  This may not be bad, in fact it may be what you intended, and if everything goes right, no problem.  GRUB automatically rescans for boot partitions and should correctly recognize most of them, then list them as choices in the menu it creates.

But what I prefer is to designate the first EXT3 partition (in case I have more than one).  GRUB gets set up there instead.  Or if I'm still playing around and experimenting, I might use (fd0), and I can use the insertion of that floppy as a way to get into Linux.  Otherwise, the average user would not even know that Linux is installed on that PC.  Wherever GRUB is used, the equivalent of Windows' boot.ini file is the /boot/grub/menu.lst file, which can also be edited.  It's just a little bit more detailed and daunting to work with.

Alright, on my PC I have boot.ini in control on my C: drive, which Linux sees as being my /dev/sda0 and /media/sda0 drive and removable disk.  I told the boot installer in Linux to put GRUB at (hd1,0), which translates to disk 1, partition 0, the first EXT3 partition in my system.  So how do I get from my c: boot.ini over to the GRUB booter on my drive 1?  That took another program which is called BootPart.  You can find it on the internet, and it is free.

BootPart is a simple program that only has one purpose:  To make it easy to add (or remove) boot options from boot.ini.  To work right, it has to also be installed on the C: drive.  It only has four modes of operation:

    bootpart                    'shows you all partitions on your PC (* marks bootable partitions)
    bootpart list               'lists the current boot entries found in boot.ini
    bootpart remove n    'removes boot option n from the list
    bootpart x                  'adds the x partition as a boot choice to boot.ini
note that bootpart x requires options, particularly if you are indicating a Linux install.  It has to know if you are using a large drive (requiring LBA to access), a file name to copy the GRUB boot procedure to (call it Linux.bin for example), and the words that you want in boot.ini to idenfity this boot choice with.  In my case, bootpart showed me this list:

    Microsoft Windows 2000 [Version 5.00.2195]
    (C) Copyright 1985-2000 Microsoft Corp.

    C:\Documents and Settings\Donald R. Darden.CURRENT>cd\

    C:\>bootpart
    Boot Partition 2.60 for WinNT/2K/XP (c)1995-2005 G. Vollant (info@winimage.com)
    WEB :
http://www.winimage.com and http://www.winimage.com/bootpart.htm
Add partition in the Windows NT/2000/XP Multi-boot loader
Run "d:\bootpart\bootpart /?" for more information

Physical number of disk 0 : 3b3d3b3c
0 : C:* type=7  (HPFS/NTFS), size= 38525728 KB, Lba Pos=63
1 : C:  type=5  (Extended), size= 117762120 KB, Lba Pos=77051520
2 : C:  type=7   (HPFS/NTFS), size= 38911288 KB, Lba Pos=77051583
3 : C:  type=5   (Extended), size= 38911320 KB, Lba Pos=154874160
4 : C:  type=7    (HPFS/NTFS), size= 38911288 KB, Lba Pos=154874223
5 : C:  type=5    (Extended), size= 39939480 KB, Lba Pos=232696800
6 : C:  type=7     (HPFS/NTFS), size= 39939448 KB, Lba Pos=232696863
Physical number of disk 1 : 84fe419e
7 : D:* type=83  (Linux native), size= 46085728 KB, Lba Pos=63
8 : D:  type=83  (Linux native), size= 46078200 KB, Lba Pos=92171520
9 : D:  type=83  (Linux native), size= 46078200 KB, Lba Pos=184327920
10 : D:  type=5  (Extended), size= 174326009 KB, Lba Pos=276484382
11 : D:  type=7   (HPFS/NTFS), size= 168981088 KB, Lba Pos=276484383
12 : D:  type=5   (Extended), size= 1738800 KB, Lba Pos=614446560
13 : D:  type=82    (Linux swap), size= 1738768 KB, Lba Pos=614446623
14 : D:  type=5    (Extended), size= 1738800 KB, Lba Pos=617924160
15 : D:  type=82     (Linux swap), size= 1738768 KB, Lba Pos=617924223
16 : D:  type=5     (Extended), size= 1867320 KB, Lba Pos=621401760
17 : D:  type=82      (Linux swap), size= 1867288 KB, Lba Pos=621401823

C:\>
[/list]
It tells me I have two bootable partitions, 1 and 7.  The one at 7 is a type 83,
which is Linux EXT3.  To add this as a choice to boot.ini, I would run this command:

bootpart 7 LBA linux.bin Boot to Linux Distros via GRUB (next screen)

That would add this as the last entry in my boot.ini file.  I could edit the boot.ini file if I want to change any wordage or change the sequence in which they are listed.  If I got it right. picking the GRUB as my choice, I would next be presented with the options listed in the /boot/grub/menu.lst file on that drive, where I would chose which linux distro I wanted to run this time.

Once you have youe EXT2 and swap partitions set up and Linux installed, and you have set up your boot process so that you can get to them, you will find that you probably can access your Windows partitions from within Linux.  But to access your Ext3 partitions from within Windows, you will have to download and install EXT2 FS for Windows (search for it),  Then, going through the process of reaching your Disk Manager again, you will have to assign a drive letter to that partition - but don't format it, or even name it from Windows.  Naming might be alright, but if I were naming a partition, I would rather do it within the OS that uses it natively, as less risk of corrupting the partition.

Windows has its own way of tracking drive letters.  The disk manager allows you to assign a specific letter to a partition, but it can't already be in use.  If you assign a new letter, then the old letter reference will be discarded (and freed up for reuse) after the next reboot.  However, you are not permitted to change the drive letter for the system partition - once that gets assigned, all system paths and applications are dependent upon the drive letter and path.  You can edit the drive letters assigned directly in the Registry, but that is a bit risky.

Because Windows tracks assigned drive letters in the Registry, you can expect that a reinstall or repair of Windows may delete the drive letter assignments, meaning that these could change when reassigned.  It also means that different installs of Windows may see the same partitions with different letters assigned - all depends upon which drives were identified by each Windows and in what order.  If you get exposed to it enough, you will find ways to deal with it.

Linux can have its own little issues.  For instance, Linux may tend to treat the system configuration as fixed at the time when the install is first done, then not properly recognize changes made later.  I found this out when converting some FAT partitions to NTFS, then having to modify the /etc/fstab to reflect those changes.  This impacted both the UUID associated with the partition, and the file system that Linux wanted to use with the partition.  You can change these settings, but it was not an automatic process.