个人工具

“UbuntuHelp:How to dual-boot Ubuntu and XP after installing them separately on two HDs”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的7个中间版本)
第1行: 第1行:
{{From|https://help.ubuntu.com/community/How to dual-boot Ubuntu and XP after installing them separately on two HDs}}
+
{{From|https://help.ubuntu.com/community/How_to_dual-boot_Ubuntu_and_XP_after_installing_them_separately_on_two_HDs}}
{{Languages|UbuntuHelp:How to dual-boot Ubuntu and XP after installing them separately on two HDs}}
+
{{Languages|UbuntuHelp:How_to_dual-boot_Ubuntu_and_XP_after_installing_them_separately_on_two_HDs}}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+
== Introduction ==
<html>
+
You have installed Ubuntu on a separate HD because you were afraid to loose things on your Windows disk?
<head>
+
You absolutely want to keep XP and Ubuntu separate?
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+
Then this might help you. :)
<meta name="robots" content="index,nofollow">
+
== Case 1: You haven't installed Ubuntu yet  ==
<title>How - Community Ubuntu Documentation</title>
+
Do a fresh install of Ubuntu with the windows hard drive still plugged in. Ubuntu will automatically detect the other hard drive, and Grub will automatically list it as a choice at startup.
<script type="text/javascript">
+
You can then also see the other hard drive and access it while in Ubuntu by mounting it.
<!--// common functions
+
== Case 2: You already installed Ubuntu on an HD ==
// We keep here the state of the search box
+
=== Short tutorial ===
searchIsDisabled = false;
+
If you were afraid to partition and format another hard drive just for Ubuntu and disconnected the previous one with Windows during the installation, you will run into this problem to have to add Windows boot manually.
function searchChange(e) {
+
The solution is simply adding this to /boot/grub/menu.lst:
// Update search buttons status according to search box content.
+
<pre><nowiki>
// Ignore empty or whitespace search term.
+
title Windows XP Professional
var value = e.value.replace(/\s+/, '');
+
root (hd1,0)
if (value == '' || searchIsDisabled) {
+
savedefault
searchSetDisabled(true);
+
makeactive
} else {
+
chainloader +1
searchSetDisabled(false);
+
map (hd0) (hd1)
}
+
map (hd1) (hd0)
}
+
</nowiki></pre>
function searchSetDisabled(flag) {
+
The parts with '''(hd1,0)''','''(hd0) (hd1)''' and '''(hd1) (hd0)''' depend on where your Windows partition is, which you can find out by typing:
// Enable or disable search
+
<pre><nowiki>
document.getElementById('fullsearch').disabled = flag;
+
sudo fdisk -l
document.getElementById('titlesearch').disabled = flag;
+
</nowiki></pre>
}
+
In this example, Windows is assumed to be on ''hd1'' and Ubuntu on ''hd0''.
function searchFocus(e) {
+
The problem is that [http://www.gnu.org/software/grub/manual/html_node/DOS_002fWindows.html#DOS_002fWindows Windows boot must be on the first hard disk/partition in order to boot]. You trick it into thinking that by adding those last two lines with the ''map'' command in the Grub menu entry.
// Update search input content on focus
+
=== Case 3: Windows was installed on the first hard disk, you physically disconnected that hard disk because you were afraid losing data and installed Ubuntu on the second disk ===
if (e.value == 'Search') {
+
Here, '''first disk''' means SATA 0 (instead of SATA 1 or SATA 2) or Primary-Master disk when talking about IDE. The BIOS will always boot the SATA 0 physical disk first (or the Primary-Master IDE disk). When reconnecting the Windows hard disk, you'll notice the system boots in Windows directly and ignores Ubuntu. Since you don't want to fall into installing GRUB in that disk (because, after all, if you disconnected it, it's your important disk), it would be more convenient to ask the BIOS to boot the Ubuntu disk first, where you could easily configure GRUB to list Windows for booting it from the other disk.
e.value = '';
+
Unfortunately, that's not always possible. However, the simplest solution is to '''physically''' swap your two SATA connections (either on the motherboard or on the disks themselves), or for that matter swap your master/slave IDE hard disks (or primary/secondary... whatever, just make the Ubuntu disk the most important one for the BIOS). Then, you'll notice Ubuntu boots instead of Windows! When Ubuntu finishes booting, just follow the "complete tutorial" section below.
e.style.color = 'black';
+
Also, you may want to comment the "hiddenmenu" line so that you actually '''see''' the menu. You may also want to increase the timeout value, from 3 to about 15 so that it lets you enough time for checking and testing each item.
searchIsDisabled = false;
+
=== Complete tutorial (cases 1 and 2) ===
}
+
Backup your menu.lst first:
}
+
<pre><nowiki>
function searchBlur(e) {
+
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.bkp
// Update search input content on blur
+
</nowiki></pre>
if (e.value == '') {
+
Find out where your Windows hard disk is with (if you are confused here just post the result here and someone might help)
e.value = 'Search';
+
<pre><nowiki>
e.style.color = 'gray';
+
sudo fdisk -l
searchIsDisabled = true;
+
</nowiki></pre>
}
+
Then you need to add the new entry to grub with
}
+
<pre><nowiki>
function actionsMenuInit(title) {
+
gksudo gedit /boot/grub/menu.lst
// Initiliaze action menu
+
</nowiki></pre>
for (i = 0; i < document.forms.length; i++) {
+
And then add the following entry to the very end of the file
var form = document.forms[i];
+
<pre><nowiki>
if (form.className == 'actionsmenu') {
+
title Windows XP Professional
// Check if this form needs update
+
root (hd1,0)
var div = form.getElementsByTagName('div')[0];
+
savedefault
var label = div.getElementsByTagName('label')[0];
+
makeactive
if (label) {
+
chainloader +1
// This is the first time: remove label and do buton.
+
map (hd0) (hd1)
div.removeChild(label);
+
map (hd1) (hd0)
var dobutton = div.getElementsByTagName('input')[0];
+
</nowiki></pre>
div.removeChild(dobutton);
+
The "hd" is always "hd" even if Windows is on a Sata drive. The second line of the map command is just so your Ubuntu hard drive will be recognizeable on Windows. If you need to read/write on Ubuntu partitions from Windows or vice-versa, you need to search for other tools (ntfs-3g and ntfs-config for Ubuntu and ext3 for Windows), but that's outside the scope of this thread.
// and add menu title
+
If you need more information on Grub's map command you can find it '''[http://www.gnu.org/software/grub/manual/html_node/map.html#map here]'''.
var select = div.getElementsByTagName('select')[0];
+
== References ==
var item = document.createElement('option');
+
* [http://ubuntuforums.org/showthread.php?p=2702832#post2702832 Tutorial by eks on the Ubuntu forums]
item.appendChild(document.createTextNode(title));
+
* See also [http://ubuntuforums.org/showthread.php?t=179902 Dualboot two hard drives]
item.value = 'show';
+
== Go back ==
select.insertBefore(item, select.options[0]);
+
* [[UbuntuHelp:Installation|Go|back to Installation]]
select.selectedIndex = 0;
+
----
}
+
[[category:CategoryInstallation]]
}
+
}
+
}
+
//-->
+
</script>
+
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/htdocs/ubuntu/css/common.css">
+
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="/htdocs/ubuntu/css/screen.css">
+
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="/htdocs/ubuntu/css/print.css">
+
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="/htdocs/ubuntu/css/projection.css">
+
<link rel="Start" href="/community/UserDocumentation">
+
<link rel="Alternate" title="Wiki Markup" href="/community/How?action=raw">
+
<link rel="Alternate" media="print" title="Print View" href="/community/How?action=print">
+
<link rel="Search" href="/community/FindPage">
+
<link rel="Index" href="/community/TitleIndex">
+
<link rel="Glossary" href="/community/WordIndex">
+
<link rel="Help" href="/community/HelpOnFormatting">
+
</head>
+
<body  lang="en" dir="ltr">
+
<script xmlns="" src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>
+
<script xmlns="" type="text/javascript"><![CDATA[
+
_uacct = "UA-1018242-8";
+
urchinTracker();
+
]]></script>
+
<div id="header">
+
<div id="mastwrap"><div id="masthead">
+
<div id="logo"><a href="/community/UserDocumentation">Community Ubuntu Documentation</a></div>
+
<form id="searchform" method="get" action="">
+
<div>
+
<input type="hidden" name="action" value="fullsearch">
+
<input type="hidden" name="context" value="180">
+
<label for="searchinput">Search:</label>
+
<input id="searchinput" type="text" name="value" value="" size="20"
+
onfocus="searchFocus(this)" onblur="searchBlur(this)"
+
onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
+
<input id="titlesearch" name="titlesearch" type="submit"
+
value="Titles" alt="Search Titles">
+
<input id="fullsearch" name="fullsearch" type="submit"
+
value="Text" alt="Search Full Text">
+
</div>
+
</form>
+
<script type="text/javascript">
+
<!--// Initialize search form
+
var f = document.getElementById('searchform');
+
f.getElementsByTagName('label')[0].style.display = 'none';
+
var e = document.getElementById('searchinput');
+
searchChange(e);
+
searchBlur(e);
+
//-->
+
</script>
+
<div id="sisternav">
+
<ul>
+
<li id="plain">
+
<a href="https://help.ubuntu.com/6.06"
+
accesskey="t">6.06 LTS</a>
+
</li>
+
<li id="plain">
+
<a href="https://help.ubuntu.com/6.10"
+
accesskey="t">6.10</a>
+
</li>
+
<li id="plain">
+
<a href="https://help.ubuntu.com/7.04"
+
accesskey="t">7.04</a>
+
</li>
+
<li id="plain">
+
<a href="https://help.ubuntu.com/7.10"
+
accesskey="t">7.10</a>
+
</li>
+
<li id="current">
+
<a href="https://help.ubuntu.com/community"
+
accesskey="t">Community Docs</a>
+
</li>
+
</ul>
+
</div>
+
</div></div>
+
<ul class="extranav">
+
<li><a href="/community/UserDocumentation">User Documentation</a></li>
+
</ul>
+
</div>
+
<div id="page" lang="en" dir="ltr"><!-- start page -->
+
<h1 id="title"><a title="Click to do a full-text search for this title" href="/community/How?action=fullsearch&amp;value=linkto%3A%22How%22&amp;context=180">How</a></h1>
+
<div lang="en" id="content" dir="ltr">
+
<a id="top"></a>
+
<div lang="en" id="content" dir="ltr">
+
<a id="top"></a>
+
<p><strong>This page does not exist yet. You can create a new empty page, or use one of the page templates. Before creating the page, please check if a similar page already exists.</strong> </p>
+
<a href="/community/How?action=edit">Create new empty page</a><p> </p>
+
<div>
+
<table>
+
<tr>
+
<td>
+
<p> <strong>Page templates:</strong> </p>
+
</td>
+
<td>
+
<p> <strong>Existing pages with similar names:</strong> </p>
+
</td>
+
</tr>
+
<tr>
+
<td style="vertical-align: top;">
+
<p> <ul>
+
<li><a href="/community/How?action=edit&amp;template=AideTemplate">AideTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=[[category:CategoryTemplate">CategoryTemplate</a></li>]]
+
<li><a href="/community/How?action=edit&amp;template=DocumentationTemplate">DocumentationTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=HelpTemplate">HelpTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=HilfeTemplate">HilfeTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=HomepageTemplate">HomepageTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=PagePersonnelleTemplate">PagePersonnelleTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=Pr%c3%a9sentationTemplate">PrésentationTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=SlideShowHandOutTemplate">SlideShowHandOutTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=SlideShowTemplate">SlideShowTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=SlideTemplate">SlideTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=SupportPapierD'UnePr%c3%a9sentationTemplate">SupportPapierD'UnePrésentationTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=ThuisbladTemplate">ThuisbladTemplate</a></li>
+
<li><a href="/community/How?action=edit&amp;template=TransparentTemplate">TransparentTemplate</a></li>
+
</ul>
+
</p>
+
</td>
+
<td style="vertical-align: top;">
+
<p> <ul>
+
<li><a href="/community/How_to_dual-boot_Ubuntu_and_XP_after_installing_them_separately_on_two_HDs">How to dual-boot Ubuntu and XP after installing them separately on two HDs</a></li>
+
<li><a href="/community/HowTo">HowTo</a></li>
+
<li><a href="/community/HowTo%3a_Theora_and_Vorbis_in_an_Ogg_wrapper">HowTo: Theora and Vorbis in an Ogg wrapper</a></li>
+
<li><a href="/community/HowToAddaLauncher">HowToAddaLauncher</a></li>
+
<li><a href="/community/HowToBuildToraWithOracle">HowToBuildToraWithOracle</a></li>
+
<li><a href="/community/HowToCaptureDigitalVideo">HowToCaptureDigitalVideo</a></li>
+
<li><a href="/community/HowToCompressedSoundFonts">HowToCompressedSoundFonts</a></li>
+
<li><a href="/community/HowToConfigureSoundBlasterAudigySEinBreezy">HowToConfigureSoundBlasterAudigySEinBreezy</a></li>
+
<li><a href="/community/HowToConfigureUbuntuForMicrosoftVirtualPC2004">HowToConfigureUbuntuForMicrosoftVirtualPC2004</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/AboutBook">HowToCookEdubuntu/Chapters/AboutBook</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Administration">HowToCookEdubuntu/Chapters/Administration</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Application">HowToCookEdubuntu/Chapters/Application</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/BehindEdubuntu">HowToCookEdubuntu/Chapters/BehindEdubuntu</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/ContributingToEdubuntu">HowToCookEdubuntu/Chapters/ContributingToEdubuntu</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Difference">HowToCookEdubuntu/Chapters/Difference</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Docs">HowToCookEdubuntu/Chapters/Docs</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/HardwareRequirements">HowToCookEdubuntu/Chapters/HardwareRequirements</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Installation">HowToCookEdubuntu/Chapters/Installation</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/LTSPManagement">HowToCookEdubuntu/Chapters/LTSPManagement</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Philosophy">HowToCookEdubuntu/Chapters/Philosophy</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/StandAloneHardware">HowToCookEdubuntu/Chapters/StandAloneHardware</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/StandAloneInstallation">HowToCookEdubuntu/Chapters/StandAloneInstallation</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/StandAloneIntro">HowToCookEdubuntu/Chapters/StandAloneIntro</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/StandAloneWhatNow">HowToCookEdubuntu/Chapters/StandAloneWhatNow</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/Support%26Docs">HowToCookEdubuntu/Chapters/Support&amp;Docs</a></li>
+
<li><a href="/community/HowToCookEdubuntu/Chapters/ThinClientIntroduction">HowToCookEdubuntu/Chapters/ThinClientIntroduction</a></li>
+
<li><a href="/community/HowToCygwinX">HowToCygwinX</a></li>
+
<li><a href="/community/HowToEnableSpamFilteringInEvolution">HowToEnableSpamFilteringInEvolution</a></li>
+
<li><a href="/community/HowToGetBetterRefreshRatesAndResolutions">HowToGetBetterRefreshRatesAndResolutions</a></li>
+
<li><a href="/community/HowToGetHelp">HowToGetHelp</a></li>
+
<li><a href="/community/HowToJACKConfiguration">HowToJACKConfiguration</a></li>
+
<li><a href="/community/HowToMD5SUM">HowToMD5SUM</a></li>
+
<li><a href="/community/HowToMonitorInternetTrafficTotals">HowToMonitorInternetTrafficTotals</a></li>
+
<li><a href="/community/HowToPureDataIntroduction">HowToPureDataIntroduction</a></li>
+
<li><a href="/community/HowToQjackCtlConnections">HowToQjackCtlConnections</a></li>
+
<li><a href="/community/HowToReadline">HowToReadline</a></li>
+
<li><a href="/community/HowToRecordInternetRadio">HowToRecordInternetRadio</a></li>
+
<li><a href="/community/HowToRemoveWindows">HowToRemoveWindows</a></li>
+
<li><a href="/community/HowToRipRealaudioStreamsToMp3">HowToRipRealaudioStreamsToMp3</a></li>
+
<li><a href="/community/HowToSeq24Introduction">HowToSeq24Introduction</a></li>
+
<li><a href="/community/HowToSetupLTSPDevelEnvironment">HowToSetupLTSPDevelEnvironment</a></li>
+
<li><a href="/community/HowToSetupSoundCards">HowToSetupSoundCards</a></li>
+
<li><a href="/community/HowToUseTheTerminal">HowToUseTheTerminal</a></li>
+
<li><a href="/community/HowToUseTheTerminal/Talk">HowToUseTheTerminal/Talk</a></li>
+
<li><a href="/community/HowToVanillaKernelWithRealtimePreemption">HowToVanillaKernelWithRealtimePreemption</a></li>
+
<li><a href="/community/HowToVirtualKeyboardKeymapping">HowToVirtualKeyboardKeymapping</a></li>
+
<li><a href="/community/HowToZeroconf">HowToZeroconf</a></li>
+
<li><a href="/community/HowTos">HowTos</a></li>
+
<li><a href="/community/HowtoConky140">HowtoConky140</a></li>
+
<li><a href="/community/HowtoFixIndicFontRendering">HowtoFixIndicFontRendering</a></li>
+
<li><a href="/community/HowtoPartition">HowtoPartition</a></li>
+
</ul>
+
</p>
+
</td>
+
</tr>
+
</table>
+
</div>
+
<a id="bottom"></a>
+
</div>
+
<a id="bottom"></a>
+
</div>
+
</div> <!-- end page -->
+
<div id="footer">
+
<div id="ubuntulinks">
+
&copy; 2007 <a href="http://www.canonical.com">Canonical Ltd</a>. Ubuntu, Kubuntu, Edubuntu and Canonical are registered trademarks of Canonical Ltd.<br />
+
<a href="https://help.ubuntu.com/community/WikiGuide">Feedback</a> &mdash;
+
<a href="https://help.ubuntu.com/community/License">Legal</a> &mdash;
+
<a href="https://help.ubuntu.com/community/Credits">Credits</a>
+
<br />
+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">
+
<img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" />
+
</a>
+
</div>
+
</div>
+
</body>
+
</html>
+
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2009年5月12日 (二) 17:18的最新版本

Introduction

You have installed Ubuntu on a separate HD because you were afraid to loose things on your Windows disk? You absolutely want to keep XP and Ubuntu separate? Then this might help you. :)

Case 1: You haven't installed Ubuntu yet

Do a fresh install of Ubuntu with the windows hard drive still plugged in. Ubuntu will automatically detect the other hard drive, and Grub will automatically list it as a choice at startup. You can then also see the other hard drive and access it while in Ubuntu by mounting it.

Case 2: You already installed Ubuntu on an HD

Short tutorial

If you were afraid to partition and format another hard drive just for Ubuntu and disconnected the previous one with Windows during the installation, you will run into this problem to have to add Windows boot manually. The solution is simply adding this to /boot/grub/menu.lst:

title		Windows XP Professional
root		(hd1,0)
savedefault
makeactive
chainloader	+1
map (hd0) (hd1)
map (hd1) (hd0)

The parts with (hd1,0),(hd0) (hd1) and (hd1) (hd0) depend on where your Windows partition is, which you can find out by typing:

sudo fdisk -l

In this example, Windows is assumed to be on hd1 and Ubuntu on hd0. The problem is that Windows boot must be on the first hard disk/partition in order to boot. You trick it into thinking that by adding those last two lines with the map command in the Grub menu entry.

Case 3: Windows was installed on the first hard disk, you physically disconnected that hard disk because you were afraid losing data and installed Ubuntu on the second disk

Here, first disk means SATA 0 (instead of SATA 1 or SATA 2) or Primary-Master disk when talking about IDE. The BIOS will always boot the SATA 0 physical disk first (or the Primary-Master IDE disk). When reconnecting the Windows hard disk, you'll notice the system boots in Windows directly and ignores Ubuntu. Since you don't want to fall into installing GRUB in that disk (because, after all, if you disconnected it, it's your important disk), it would be more convenient to ask the BIOS to boot the Ubuntu disk first, where you could easily configure GRUB to list Windows for booting it from the other disk. Unfortunately, that's not always possible. However, the simplest solution is to physically swap your two SATA connections (either on the motherboard or on the disks themselves), or for that matter swap your master/slave IDE hard disks (or primary/secondary... whatever, just make the Ubuntu disk the most important one for the BIOS). Then, you'll notice Ubuntu boots instead of Windows! When Ubuntu finishes booting, just follow the "complete tutorial" section below. Also, you may want to comment the "hiddenmenu" line so that you actually see the menu. You may also want to increase the timeout value, from 3 to about 15 so that it lets you enough time for checking and testing each item.

Complete tutorial (cases 1 and 2)

Backup your menu.lst first:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.bkp

Find out where your Windows hard disk is with (if you are confused here just post the result here and someone might help)

sudo fdisk -l

Then you need to add the new entry to grub with

gksudo gedit /boot/grub/menu.lst

And then add the following entry to the very end of the file

title		Windows XP Professional
root		(hd1,0)
savedefault
makeactive
chainloader	+1
map (hd0) (hd1)
map (hd1) (hd0)

The "hd" is always "hd" even if Windows is on a Sata drive. The second line of the map command is just so your Ubuntu hard drive will be recognizeable on Windows. If you need to read/write on Ubuntu partitions from Windows or vice-versa, you need to search for other tools (ntfs-3g and ntfs-config for Ubuntu and ext3 for Windows), but that's outside the scope of this thread. If you need more information on Grub's map command you can find it here.

References

Go back