two computers in one?
August 17, 2007 6:33 PM   Subscribe

I have one computer and two hard drives. I'd like to emulate 2 completely separate computers. That is, each hard drive will have a separate Windows XP image and I will choose at startup which one to boot. OK so far, but, I do not want either Win XP image to ever see or interact with the other one in any way. If I am running from one hard drive, I want the other one to be completely invisible. Possible?

I have the idea that one Win XP installation will mess with another one if it is visible on the local machine. I want to avoid any possibility of this. I only have space for one computer, and I'd like both a production system and another system to mess around with, screw up, and blow away at will.

I'm thinking this separation of systems might be possible with GRUB, but I'm not conversant enough with low level hard drive stuff to be sure, and to be sure it's a good idea. What do you think? Any info you might have would be greatly appreciated. Thanks!

As a side note, each hard drive may also contain other OS's on other partitions, but I don't think that part will be a problem.
posted by DarkForest to Computers & Internet (34 answers total) 2 users marked this as a favorite
I have no experience with this company, and there are probably other hardware solutions to this problem. However, a hardware switch seems like the easiest and most bulletproof solution.
posted by BrotherCaine at 6:48 PM on August 17, 2007

See also.
posted by BrotherCaine at 6:51 PM on August 17, 2007

maybe i'm missing something, but this seems like a standard dual boot arrangement. any bootloader should be able to do this (well, grub lilo and nt - i haven't used a windows boot manager since then). unless by "completely invisible" you mean "cannot even mount the other disk", in which case i suspect you're best just setting things up in in bios as required at that moment (but even there's probably a boot option to disable the other disk - that would work one way, at least).

your life would probably be significantly simpler (apart from linux bootloaders being more forgiving you can disable either drive) if you got a third, small disk, put linux on it, and used that for booting. or maybe even using a cd.
posted by andrew cooke at 6:52 PM on August 17, 2007

I only have space for one computer, and I'd like both a production system and another system to mess around with, screw up, and blow away at will.

This is a perfect scenario for virtual machines.

VMWare Workstation running virtual Windows machines (and other guest OSes like Linux, simultaneously if you like) and using snapshots (to restore it to a previous state) would accomplish this.
posted by edverb at 7:14 PM on August 17, 2007

Lame-ass way to do it: If you can boot off a USB2 drive, then just have both drives connect that way, and when you turn on the computer, plug in whichever drive you want to boot from.
posted by -harlequin- at 7:15 PM on August 17, 2007

Yeah, seconding VMWare. Why bother with dual booting when you can run both machines at once!
posted by delmoi at 7:16 PM on August 17, 2007

If space, and not cost or something else, is the main thing keeping you from having two computers, you should consider a small form factor PC. They used be fairly week in the raw power department, but nowadays you can find some pretty sweet set-ups. (Don't forget a KVM switch.)
posted by oddman at 7:26 PM on August 17, 2007

Don't forget a KVM switch

It's not so much the space for the computer, but for the monitor, kbd, etc. I'd considered the KVM/second computer idea, but I got the impression when I looked into it that KVMs can be problematic and can mess with video quality. So I dropped that idea. Guess I don't really know if it's true or not.
posted by DarkForest at 7:33 PM on August 17, 2007

I've done this with a simple double pole double throw switch and PATA drives. Configure your bios to only see a single drive (IE: ignore the slave). Wire the switch to the jumper settings on the drives such that in one position drive A thinks it's the master and B the slave and in position two drive B thinks it's the master and A the slave.You may nopt need a double pole switch depending on the jumper configuration of the system.

Also some MB/Drive combos will freak out if the master and slave aren't plugged into the correct locations on the bus cable.
posted by Mitheral at 7:36 PM on August 17, 2007

You could get close to this using GRUB, but the unused hard drives/partitions would not end up 100% invisible. GRUB allows you to "hide" partitions you're not using at boot time, but the way it does it is to manipulate the "hidden" bits inside the partition tables. The Windows XP logical volume management service can still see hidden partitions, but Windows will not interact with them of its own accord.

The most reliable way to do what you want is to visit the BIOS setup menu every time you boot, and disable the drive you're not using. For the least pain, do your Windows installations after you've connected both drives and BIOS-disabled the one you're not installing Windows on.

If what you're doing with your disposable Windows installation doesn't rely on high performance graphics, VMWare will indeed get you where you want to go with the least possible fuss.

I've used several Chinese Good Factory #3 Excellent Generic KVMs, and the only kind that screwed up the video quality was the one that came with pissy little extra-thin video cabling. If your KVM cables are about as chunky as your existing VGA cable, they'll probably be fine.
posted by flabdablet at 7:50 PM on August 17, 2007

It's just occurred to me that you could actually achieve most of what you want within Windows itself.

Install your production Windows on the first hard drive (the one you've set your BIOS to boot from), then install your disposable Windows on the second drive. The second installation should make an entry in the first one's BOOT.INI, allowing you to pick which one you want during the Windows boot sequence.

Next, boot your production Windows and use the Disk Management console to remove the drive letter from the disposable Windows' partition.

Next, boot your disposable Windows and do the same thing from that side.

Windows won't touch partitions that have no drive letter or mount point defined. The only disadvantage of this arrangement over doing things the BIOS or GRUB way is that if your production Windows goes belly-up, you might not be able to boot your disposable one.
posted by flabdablet at 7:59 PM on August 17, 2007

Good KVMs are available these days that do DVI, so you shouldn't see any issues as far as picture quality goes. Old VGA ones? Freaking terrible, especially for people that can't handle refresh rates on CRT monitors below 80.

Not specifically what the original question was, but you mentioned that as a concern as well. Good luck!
posted by mikw at 8:41 PM on August 17, 2007

Dual boot environments == snore.

Go with VMWare or VirtualPC. Both are free to good homes (depending on product selection) and they're the bees knees.
posted by purephase at 8:44 PM on August 17, 2007

I'm not recommending this exact item but I have a programmer friend who has these in his testing rig to troubleshoot different operating system/software environments.

It lets you shut down the computer, pull the hard drive, and plug another one in and restart the computer.

It takes all of 5 seconds longer than a normal cold reboot.
posted by porpoise at 8:54 PM on August 17, 2007

Ok. KVMs and virtualization are probably the way to go, but for the sake of being comprehensive, this is the (inelegant, not to say serpentine and/or ugly) method I came up with after mulling this over for a minute -- just to prove that it can be done:

Create a tiny Linux partition on either HD
Install GRUB to the MBR of the master HD
Set the minimal Linux installation to auto login, hide/deactivate the partition of the currently active/default XP install and activate/boot-flag the other (currently inactive) XP install, and have it change GRUB's menu.conf to make whichever system that is not currently active the default boot option.

Effect: by default (and, say, a 3 second timeout), GRUB will always boot into the XP install you last booted into -- unless you choose the GRUB menu entry for the linux install (which you can rename "Switch working environments", or whatever), which will perform the aforementioned switcharoo.

Another way to approach your situation is to set up just one instance of XP, install all your usual software, tweak it to your liking, and then use something like Acronis True Image (or Norton Ghost, which is not as good, IMO) to create a bootable, self-expanding DVD which restores your computer to that state. That way you can be as flagrantly wanton and risky as you want, knowing that you can always get your computer to an optimal state in a matter of minutes. It works even better if you move your "My Documents" and "Desktop" folders to a separate drive -- that way restoring the image doesn't kill your personal data.
posted by limon at 11:32 PM on August 17, 2007

err -- forgot to say, the linux partition should auto-reboot after performing all the aforementioned tasks. you could easily write a shell script to do all that.
posted by limon at 11:33 PM on August 17, 2007

If you're going to do the GRUB thing, you don't actually need to install Linux at all. All you need is a little partition (one cylinder is enough) to hold /boot/grub and contents. This partition can even be formatted FAT32 if you want (though formatting it with EXT3 or ReiserFS will make it harder for Windows to mess with it). Use any Linux live CD to set it up.

GRUB can do the partition hiding/unhiding thing and the default-saving thing all by itself, with the right set of commands in /boot/grub/menu.lst; there's no need to boot into Linux for that.
posted by flabdablet at 11:44 PM on August 17, 2007

All of the talk of boot loaders and KVM are ignoring part of the original question. The poster does not want either OS to interact with the other. A bootloader will not do that.

A KVM is not the answer, the person only has room for one computer...

My recommendation? A removable hard drive enclosure. They fit in the drive bays that CD-ROM/DVD, etc drives fit into on your PC.

If you have two drives, each in their own little enclosure, whichever one you put in the PC is the one that is active. The other one is on your desk or wherever you put it. When you want to change to the other system, power down, change drives, and boot back up.

Because you are only using one drive at a time, the drives can not interact with each other. They are totally independent.

You can see a sample of what I mean here at Google.

I hope that helps.
posted by Leenie at 1:57 AM on August 18, 2007

Why on earth are you people providing such horrendously complex solutions? Porpoise nailed it first try... just get a removable drive tray. Leenie is saying the same thing; they're both right. Swap drives when you want to boot the other OS. Total invisibility; physical separation is an absolute barrier.

You don't, however, want the particular one that porpoise pointed at, because it will wear out the drive's own connectors. You want a tray with a caddy. You plug the drive in just once, and then plug the caddies in and out... so if a plug wears out, it's a $15 item that failed, not the unit with your precious data on it. You can even buy an extra caddy ahead of time just in case.
posted by Malor at 3:12 AM on August 18, 2007

Leenie, yes a bootloader (specifically GRUB) can do that.

GRUB can hide and unhide partitions at boot time before bringing up the OS. It does this by manipulating partition table entries. As I mentioned before, the Windows logical volume management service will be able to see that a hidden partition exists, but Windows will never mount a filesystem residing on a hidden partition, and won't read from it or write to it.
posted by flabdablet at 6:39 AM on August 18, 2007

flabdablet, is there much reasonable danger of partition table corruption if the bootloader is changing parts of it on every boot? Or do bootloaders always rewrite the partition table at each boot to boot the different partitions?
posted by DarkForest at 7:05 AM on August 18, 2007

I still think VMs are the way to go, for several reasons (meets requirements, can run simultaneously, restoring to a snapshot takes minutes rather than the hours it takes to install/patch an OS) but alternately, here's another way to do this I have used in the pre-VM viability past for a similar scenario. Use the BIOS as a boot selector.

Put two hard drives on a controller using cable select jumper settings. Boot to installer CD, install OS w patches etc to the master drive.

Then, on reboot, go into BIOS and disable first drive. Machine will see second drive as primary. Install OS there as well, same way you installed the OS on the master.

Now you have two drives, physically connected at all times, each with an OS.

At each reboot, quickly jump into BIOS and disable the drive you're not using -- it takes about five keystrokes, same as choosing from OS's via some bootloader. The OS will boot from the drive you didn't disable, and will not see the other drive at all b/c you turned it off at the HW controller level.

No external drive trays, software, swapping of drives required.
posted by edverb at 10:31 AM on August 18, 2007

I also vote for VMs. Why limit yourself to only two indepent systems, when you can have many systems you can play with?
posted by reformedjerk at 10:43 AM on August 18, 2007

Put each drive on a separate drive controller card. In each respective Windows install, permanently disable the driver for the controller card that you don't need.
posted by neckro23 at 11:00 AM on August 18, 2007

+1 for the simplicity of removable drive bay caddies. I'd also look into either buying different coloured caddies, or painting the front of one a different colour - so you can look at the front of the PC and know with a glance whether you've booted from your Production or Disposable drive.
posted by Nice Guy Mike at 12:05 PM on August 18, 2007

Just get a NickLock and be done with it. The switch connects to the master/slave jumpers on the drives, and so changes the order in which they appear on the bus.

Advantages: Dead-simple, fast, no physical drive abuse while switching cartridges.

Disadvantage: Only works with PATA drives. (SATA have no concept of master and slave.)
posted by Myself at 3:02 PM on August 18, 2007

that's neat.
posted by andrew cooke at 4:04 PM on August 18, 2007

DarkForest, hiding or unhiding a partition involves one write to one 512-byte disk sector. I think you'd need to be unbelievably unlucky to mess that up just by doing it once per machine start. If the thought of rewriting your partition table at startup makes you unhappy, though, you could always make a backup copy of it.

The default dual-boot GRUB configuration that comes with Ubuntu does an "unhide" on the Windows partition every time it boots Windows. I've not heard of anybody suffering partition table corruption as a result.

Ms. flabdablet uses a triple-boot machine I set up using GRUB (Damn Small Linux, Windows XP Home, Windows 95) that messes with hiding and unhiding things on every Windows boot, and it's never had partition table trouble.
posted by flabdablet at 12:08 AM on August 19, 2007

Plus, of all the ways a drive can get corrupt, partition table corruption is the easiest to fix.
posted by flabdablet at 12:09 AM on August 19, 2007

Thanks, flabdablet, for some reason I never thought of just backing up the partition tables. I may end up using this approach. It's zero cost and non-invasive. I also want to try out the VMs. It doesn't look like nicklock is around anymore, though maybe they could be found on ebay or something.

Thanks, everyone, for your ideas!
posted by DarkForest at 4:34 AM on August 19, 2007

I still believe that most of these solutions violate this requirement:

OK so far, but, I do not want either Win XP image to ever see or interact with the other one in any way. If I am running from one hard drive, I want the other one to be completely invisible.

Completely invisible means, to me, completely inaccessible. Virtualization is not an absolute barrier, and partition tweaking certainly isn't.

The only absolute guarantee is a physical drive swap. If the other drive's not there, it cannot be modified by the wrong OS. No technical failure or mistake is possible.
posted by Malor at 5:00 AM on August 19, 2007

If you back up blocks 0..62 of your drive before you install GRUB, you can put it back exactly the way it was before if you end up not liking it.

GRUB's first-stage loader replaces the original Microsoft boot code at LBA 0 (which is also where partition table entries for the first four partitions live). When you install GRUB, the first stage gets a block list inserted into it that tells it which disk blocks to load the second stage from.

The most usual thing is for the second stage to be a so-called "stage 1.5" and occupy the first logical track on the drive (LBA 1 through 62). This space is usually unused, since partitions usually start on logical track boundaries.

GRUB comes with a bunch of "stage 1.5" loaders, each one of which understands how to read the "real" Stage 2 from a different filesystem, and all of which can be patched in a standard way so they know which partition to look for that filesystem on. So if you create a little /boot partition, format it with the filesystem of your choice, and install GRUB specifying the appropriate stage 1.5 intermediate loader as "stage 2", you're then free to make purely file-level changes inside /boot without telling GRUB anything further about it.

If you boot a Linux live CD that includes GRUB (most of them do), you should be able to launch the GRUB shell just by typing grub in a terminal. From there, you have help available, and you should be able to work out how to stick it on your disk using its inbuilt setup or install commands.

If you haven't played the GRUB game before, you might prefer just to do something easy like install Ubuntu on your box so you get a GRUB setup that Just Works, then use that as a basis for your own further experimentation. A standard Ubuntu install will stick a little over 10MB worth of files into /boot (the compressed Linux kernel and a bunch of map stuff goes in there, along with all the GRUB stuff under /boot/grub).

If you hand-partition your disk during the Ubuntu install and make the first partition 20MB mounted as /boot and the second partition 4GB mounted as /, you will be able to blow away the / partition afterwards in favour of Windows, use the Ubuntu live CD to delete everything in /boot outside of /boot/grub, and you will still have a working bootloader. Just use the example Windows-booting stanzas in /boot/grub/menu.lst for your Windows booting needs.

Naturally, I recommend you actually allocate a decent partition size for Ubuntu, and keep it; you'll eventually get sick of Windows :-)

Also very helpful:
The GRUB manual
posted by flabdablet at 8:23 AM on August 19, 2007

« Older What's a good walkie-talkie?   |   Helpful guides for writing a dissertation? Newer »
This thread is closed to new comments.