PDA

View Full Version : A re-installing windows challenge/puzzle


Smike
1st March 2008, 09:55 AM
Due to the fact that I'm now using ubuntu for the majority of my computer-based extravaganzas, I find my windows installation to be slow and unnecessarily bloated. In an effort to trim it down to the bare essentials that I do use it for (playing games, running a few programs that are not linux compatible and don't have linux equivalents) I am planning to reinstall it.

However, this tends to be a slow process (particularly the post-installation customisation) and rather than having to devote a whole day to it, I would like to be able to keep my current windows installation whilst preparing the new one (also means I am less likely to lose saved games etc).

The physical setup:

I have 3 hard drives, one with windows on it, one with ubuntu (which is the primary boot option) and one (currently disconnected) empty drive.

Unfortunately, the empty drive is connected by IDE cable, whereas the other two are SATA drives. It is also significantly older, so I'd rather not have an OS on it long-term.

Ideas?

ddt
1st March 2008, 06:13 PM
Due to the fact that I'm now using ubuntu for the majority of my computer-based extravaganzas, I find my windows installation to be slow and unnecessarily bloated. In an effort to trim it down to the bare essentials that I do use it for (playing games, running a few programs that are not linux compatible and don't have linux equivalents) I am planning to reinstall it.

However, this tends to be a slow process (particularly the post-installation customisation) and rather than having to devote a whole day to it, I would like to be able to keep my current windows installation whilst preparing the new one (also means I am less likely to lose saved games etc).

The physical setup:

I have 3 hard drives, one with windows on it, one with ubuntu (which is the primary boot option) and one (currently disconnected) empty drive.

Unfortunately, the empty drive is connected by IDE cable, whereas the other two are SATA drives. It is also significantly older, so I'd rather not have an OS on it long-term.

Ideas?

So, basically, the new Windows install must end up on one of the SATA drives. If there's enough space on them for the new install, you can of course just install the new Windows in the free space. If not, there's two avenues to pursue:

1) Is there enough free space inside the old Windows partition? Then you should look for, e.g., PartitionMagic: that's a program that can shrink, expand, and move Windows partitions (and the newest version of PM can also do this for Linux partitions I think). That gives you space for the new Windows install, and once you're finished, you could also erase the old one and move the new one to the front of the drive.

2) Move the Windows install temporarily onto the IDE drive, so you have room for the new install on the SATA drives. However, I'm not sure how happy Windows is to be moved onto another drive. I could tell you exactly what needs to be altered in a Linux install when moving it to another drive :).

Another thing you could look into is virtualization: running Windows from inside Linux, so you don't have to reboot. Current virtualization techniques are not good at graphics, so if your games demand a modern accelerated graphics card, it's no option for you :(. Otherwise, it would also save you hugely on the reinstallation time, as you can just run Windows update, or reinstall MS-Office, while minding more interesting business with your computer.

Smike
2nd March 2008, 02:17 AM
So, basically, the new Windows install must end up on one of the SATA drives. If there's enough space on them for the new install, you can of course just install the new Windows in the free space. If not, there's two avenues to pursue:

1) Is there enough free space inside the old Windows partition? Then you should look for, e.g., PartitionMagic: that's a program that can shrink, expand, and move Windows partitions (and the newest version of PM can also do this for Linux partitions I think). That gives you space for the new Windows install, and once you're finished, you could also erase the old one and move the new one to the front of the drive.

This sounds like a good idea, if it will work. Will there not be problems with the new install overwriting the MBR and preventing me booting the old version? Can I configure Grub to deal with this?

2) Move the Windows install temporarily onto the IDE drive, so you have room for the new install on the SATA drives. However, I'm not sure how happy Windows is to be moved onto another drive. I could tell you exactly what needs to be altered in a Linux install when moving it to another drive :).

Interesting. In that case, couldn't I just move the linux install, then move it back afterwards? Please elaborate...

Another thing you could look into is virtualization: running Windows from inside Linux, so you don't have to reboot. Current virtualization techniques are not good at graphics, so if your games demand a modern accelerated graphics card, it's no option for you :(. Otherwise, it would also save you hugely on the reinstallation time, as you can just run Windows update, or reinstall MS-Office, while minding more interesting business with your computer.

Unfortunately, I need those graphics! (Though I'm hoping that wine will improve over the next few years).

MKR
2nd March 2008, 10:30 AM
This sounds like a good idea, if it will work. Will there not be problems with the new install overwriting the MBR and preventing me booting the old version? Can I configure Grub to deal with this?

Windows may not recognize any bootloader other than its own, but it will add any existing Windows installation to its bootloader. :)

ddt
2nd March 2008, 11:05 AM
First, a general problem that you may encounter when re-attaching the IDE-disk: what does the BIOS of your computer then see as the first disk drive: the first SATA disk or the IDE disk? When it then counts the IDE disk as the first, grub's numbering of the disks will be wrong, so it won't boot any OS. And after you've corrected that, Windows won't boot either because it also uses the BIOS numbering in designating the disks.

1) On shrinking the existing Windows partition and installing the new Windows alongside it:
This sounds like a good idea, if it will work. Will there not be problems with the new install overwriting the MBR and preventing me booting the old version? Can I configure Grub to deal with this?
Good you mention this. I've heard rumors of several levels of "nastiness" from Windows - including it wiping Linux partitions - but it will definitely rewrite your MBR, and toggle the "boot" flags in the partition table.

That's easily mended, though. Can you use your Ubuntu CD also as a rescue CD? (I'm not familiar with Ubuntu installs - I usually use RedHat or Fedora, and their CD's always can also act as rescue CD). Then it will recognize your Ubuntu install, and propose to boot into it. Once you've booted into that, you can run the command 'grub-install' to re-install the grub MBR. It won't recognize the Windows-installs then, but print out the grub configuration file (/boot/grub/grub.conf) before the whole operation and edit it afterwards and you're set.

On moving an installed OS to another drive:

Interesting. In that case, couldn't I just move the linux install, then move it back afterwards? Please elaborate...
Absolutely. It would require two moves, though, to get it back on a SATA disk. I can only explain it with command line tools, so I hope you're familiar with that - but I'll start with the concepts. There are three places where changes must be made:

1) /etc/fstab
As Linux doesn't deal with drive letters, but assembles all partitions into one big tree, the only place where drive names or partition names are used during operations is the configuration file where the tree structure is defined: the file /etc/fstab (fstab stands for "file system table"). It looks like this:

/dev/sda1 / ext3 defaults 1 1
/dev/sda2 /boot ext3 defaults 1 2
/dev/sda3 swap swap defaults 0 0
none /proc proc defaults 0 0

The first two lines describe partitions containing file systems; the second says that the file system on partition /dev/sda2 is mounted under /boot: that means its files are visible under the /boot directory and its subdirectories. It may very well be that your install is all on one partition: I get the impression that most Linux distros work that way. The third line describes a partition used for swap. The fourth line describes a pseudo-file system which has no relation to disk contents.

So in a copy of your install on another disk, you only need to change the designations of the partitions involved. The naming system is simple: /dev/sda2 means the second partition on the first SCSI-disk - and SATA disks count as SCSI-disks too. IDE disks are named /dev/hda, /dev/hdb, etc.

2) /boot/initrd.img
The actual name of this file is something like /boot/initrd-2.6.20.img or some such, where 2.6.20 is the version number of the Linux kernel used. This file contains the image of the RAM-disk Linux uses during the boot process. When booting, grub makes a RAM-disk, copies this file into it, and the kernel first uses the RAM-disk for some initialization work, like the loading of kernel modules, and then changes the root file system to the one mentioned in the grub.conf file. Somewhere in this RAM-disk image is the command to change the root file system. With some luck, there is a command to make such a RAM-disk image. RedHat has the command 'mkinitrd', and I think Debian (on which Ubuntu is based) too.

3) /boot/grub/grub.conf
Obviously, you need to make a new entry for grub too. grub uses another notation for disk partitions: (hd0,1) means the second partition on the first disk (both numbers count from zero...) - and grub takes the disks in the order that the BIOS presents them. This can be a problem if you re-attach the IDE disk: when it is counted before the SATA disks, the numbering is altered :)

As a general strategy, I'd say:

Re-attach the IDE drive and check if booting still works.
Look how many Linux partitions you have, how big they are and how much they're filled; the 'df' command gives you all of this
Partition the IDE drive with sufficiently big partitions, using Linux 'fdisk', and make filesystems on the partitions with 'mkfs'; initialize the swap partition(s) with 'mkswap'
For each partition, copy the contents from the original one to the new one (using cp -a -x)
Edit the new /etc/fstab, and add an entry to the grub.conf
Reboot from the rescue CD into the new Linux install.
Run 'mkinitrd' with the right options. Now you should be able to boot from grub.



Unfortunately, I need those graphics! (Though I'm hoping that wine will improve over the next few years).
I suspected as much :D. I'm using the Xen hypervisor, and I run Windows in a virtual machine, for such mundane tasks as my accounting program. A resolution like 1280x1024 is no problem, but 50 frames/second or so is :). I wouldn't pin my hopes on wine though for such a thing to happen: it would have to implement DirectX 8 and to be able to tap into the proprietary acelerated graphics drivers. No easy task.

voidx
3rd March 2008, 09:21 PM
I imagine that by the time you bugger around troubleshooting BIOS issues and the like with getting the various OS's to boot, you could just simply reinstall Windows on the current drive and have spent your day reinstalling and be done with it.

Saved games aren't a problem, usually just a file or a directory plunked in My Documents (as much as I hate that).

Slap the IDE drive in as a secondary and let Windows find it and add it as a secondary drive. Copy whatever files you want to it. Pop windows on the original drive, reinstall and copy files back.

I really do think this won't take any longer than what your planning, and will likely be much less of a headache.

My .02

Smike
4th March 2008, 04:16 AM
I tried to move linux using gparted, but there appeared to be a problem with my IDE drive, so in the end I just reinstalled windows over the old version. It now boots and runs about a million times faster than it used to.

But thanks to all for the suggestions!