类似的试验我做过,我从前试验的结果是 ntldr 不能找到逻辑分区上的 boot.ini。windows 好像只会使用主分区上的 boot.ini。windows 是个黑箱子,我不知道怎么突破这个限制。
如果你写一个 step by step 的 instruction 并且可以在我的机器上重现,我就信
![:em09 :em09](./images/smilies/em09.gif)
另外据说 bootmgr 是可以从逻辑分区启动系统的。如果用 ghost 的 win7,大概像你说的直接从逻辑分区 chainloader +1 就行。
代码: 全选
cd /tmp && wget 'http://home.comcast.net/~ubuntu_grub/boot_info_script.txt' && sudo bash boot_info_script.txt && cat RESULTS.txt
如果这样实际和21楼方法的有点类似。PQ是否能这样分区,还没尝试过。billbear 写了:我以前测试也是这样的。jsleemz 的成果我能想到的合理解释是他也许用 pq 做出了重叠分区-扩展分区内的主分区。那个看似逻辑分区的 c 盘也许是个主分区。
这会引起磁盘分区表错误吗?应该逻辑分区内可以用分区备份工具还原一个主分区,但马上就磁盘错误那个看似逻辑分区的 c 盘也许是个主分区。
装完使用都是没有问题的,就是关机会不能自动关,最后会出现“现在可以安全的关闭计算机”的问题作者:红旗linux社区 redflag2005
引言:
之前有人提到一个问题:能不能在第一分区装好XP,ghost备份,删除装XP的分区,在该分区上装Linux,然后把备份起来的XP恢复到后面的分区。
类似的活干过,不过是从虚拟软盘启动任意磁盘任意分区上的XP,觉得这个也有希望,于是研究了以下,果然可以。
原理:利用grub4os载入一个装有os loader的虚拟硬盘文件,然后从该虚拟硬盘文件启动目标Windows。
分区结构:
如果要在该分区结构上安装XP,提示错误:
方法和步骤:
1。下载grub4dos的grub.exe,用英文的那个,如果用汉化的,还得挂载中文字体,放到linux分区,如/grub.exe。
[bbs.znpc.net]
2。编辑/boot/grub/grub.conf,加入类似如下内容:
title Windows XP
kernel (hd0,0)/grub.exe
boot
之所以使用grub4dos,是因为grub4dos支持一些GUN grub没有的功能。
3。用VPC(估计VM也可以)创建一个虚拟硬盘,固定容量,容量尽量小(可以省一些内存,这里以16MB为例),把它格式化为FAT16文件系统,并安装os loader,可以用XP光盘启动,然后进入故障恢复控制台,执行fixmbr和fixboot c:,也可以用DiskGenius里的“重建主引导记录”功能,然后把XP里的bootfont.bin、ntdetect.com和ntldr复制到该虚拟硬盘根目录,然后在该虚拟硬盘根目录创建一份名为boot.ini的文本文件,可能需要保存为ANSI格式,其内容类似如下:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="XP11" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(2)\WINDOWS="XP12" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(3)\WINDOWS="XP13" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(4)\WINDOWS="XP14" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(5)\WINDOWS="XP15" /noexecute=optin /fastdetect
以上内容可以启动第一硬盘上分区1~5上的Windows XP。注意,os loader引导项目最多只能有10条。示例中,我的硬盘第一分区为ext3(主分区),第二分区为swap(主分区),第三分区为FAT32(逻辑分区),那么,选择“multi(0)disk(0)rdisk(1)partition(3)\WINDOWS="XP13" /noexecute=optin /fastdetect”这条命令就可以启动了。
关闭虚拟机,把该虚拟机文件保存到linux分区上,如/boot/xpboot.vhd。
4。创建grub4dos的启动菜单。
在保存grub.exe的地方创建一份名为menu.lst的文本文件,内容类似如下:
timeout 30
default 0
title Load Windows XP
map --mem (hd0,0)/boot/xpboot.vhd (hd0)
map (hd0) (hd1)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)
title Reboot
reboot
之所以写两条,是为了防止grub4dos因为只有一条启动项目而不出现启动菜单。map --mem的意思就是把该虚拟硬盘用内存来虚拟,这就是上面说新建虚拟硬盘时容量尽量小的原因。
5。把备份的XP恢复到目标分区。这里是把GhostXP SP3电脑公司特别版 v9.2恢复到第一逻辑分区。
重启,在linux启动菜单中选择Windows XP,然后出现grub4dos的启动菜单,选择“find and load NTLDR of Windows NT/2K/XP”,出现os loader的启动菜单,选择相应的启动项目就可以启动XP了。
billbear 写了:@ jsleemz:
挺神的,能否让我瞻仰一下这个命令的输出信息代码: 全选
cd /tmp && wget 'http://home.comcast.net/~ubuntu_grub/boot_info_script.txt' && sudo bash boot_info_script.txt && cat RESULTS.txt
代码: 全选
cat RESULTS.txt | more
============================= Boot Info Summary: ==============================
=> Grub0.97 is installed in the MBR of /dev/sda and looks on the same drive
in partition #1 for /grub/stage2 and /grub/menu.lst.
sda1: _________________________________________________________________________
File system: ext3
Boot sector type: Grub
Boot sector info: Grub0.97 is installed in the boot sector of sda1 and
looks at sector 777281 of the same hard drive for the
stage2 file. A stage2 file is at this location on
/dev/sda. Stage2 looks on partition #1 for
/grub/menu.lst.
Operating System:
Boot files/dirs: /grub/menu.lst
sda2: _________________________________________________________________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sda5: _________________________________________________________________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 8.04.3 LTS
Boot files/dirs: /boot/grub/menu.lst /etc/fstab
sda6: _________________________________________________________________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:
sda7: _________________________________________________________________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM
sda8: _________________________________________________________________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda8 starts
at sector 63.
Operating System:
Boot files/dirs:
sda9: _________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
=========================== Drive/Partition Info: =============================
Drive sda: _____________________________________________________________________
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x2acdce2f
Partition Boot Start End Size Id System
/dev/sda1 * 63 1,044,224 1,044,162 83 Linux
/dev/sda2 1,044,225 312,576,704 311,532,480 5 Extended
/dev/sda5 1,044,288 42,989,939 41,945,652 83 Linux
/dev/sda6 42,990,003 246,806,594 203,816,592 83 Linux
/dev/sda7 246,806,658 264,622,679 17,816,022 7 HPFS/NTFS
/dev/sda8 264,622,743 308,383,739 43,760,997 7 HPFS/NTFS
/dev/sda9 308,383,803 312,576,704 4,192,902 82 Linux swap / Solaris
blkid -c /dev/null: ____________________________________________________________
/dev/sda1: UUID="6d88d4ce-8e24-4a65-8384-b0bd767bee27" TYPE="ext3"
/dev/sda5: UUID="0ccbce6f-a197-4b10-ac81-c11aa16368d9" TYPE="ext3"
/dev/sda6: UUID="198f4622-3e50-47d8-a815-2af3ac114193" TYPE="ext3"
/dev/sda7: UUID="84C4A70FC4A70312" TYPE="ntfs"
/dev/sda8: UUID="6CC4CBA2C4CB6D40" TYPE="ntfs"
/dev/sda9: TYPE="swap" UUID="99e79a15-434c-4d8b-9927-5b54823c6125"
=============================== "mount" output: ===============================
/dev/sda5 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
/dev/sda6 on /home type ext3 (rw)
none on /proc/bus/usb type usbfs (rw,devmode=666)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
============================= sda1/grub/menu.lst: =============================
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 8.04.3 LTS, kernel 2.6.31.1leemz0.3
root (hd0,0)
kernel /vmlinuz-2.6.31.1leemz0.3 root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro quiet splash
initrd /initrd.img-2.6.31.1leemz0.3
quiet
title Ubuntu 8.04.3 LTS, kernel 2.6.31.1leemz0.3 (recovery mode)
root (hd0,0)
kernel /vmlinuz-2.6.31.1leemz0.3 root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro single
initrd /initrd.img-2.6.31.1leemz0.3
title Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic
root (hd0,0)
kernel /vmlinuz-2.6.24-24-generic root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro quiet splash
initrd /initrd.img-2.6.24-24-generic
quiet
title Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic (recovery mode)
root (hd0,0)
kernel /vmlinuz-2.6.24-24-generic root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro single
initrd /initrd.img-2.6.24-24-generic
title Ubuntu 8.04.3 LTS, memtest86+
root (hd0,0)
kernel /memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda0
title Windows XP
rootnoverify (hd0,6)
chainloader +1
=================== sda1: Location of files loaded by Grub: ===================
.4GB: grub/menu.lst
.3GB: grub/stage2
.0GB: initrd.img-2.6.24-24-generic
.0GB: initrd.img-2.6.24-24-generic.bak
.0GB: initrd.img-2.6.31.1leemz0.3
.0GB: initrd.img-2.6.31.1leemz0.3.bak
.0GB: vmlinuz-2.6.24-24-generic
.0GB: vmlinuz-2.6.31.1leemz0.3
=========================== sda5/boot/grub/menu.lst: ===========================
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro
## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0
## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 8.04.3 LTS, kernel 2.6.31.1leemz0.3
root (hd0,0)
kernel /vmlinuz-2.6.31.1leemz0.3 root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro quiet splash
initrd /initrd.img-2.6.31.1leemz0.3
quiet
title Ubuntu 8.04.3 LTS, kernel 2.6.31.1leemz0.3 (recovery mode)
root (hd0,0)
kernel /vmlinuz-2.6.31.1leemz0.3 root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro single
initrd /initrd.img-2.6.31.1leemz0.3
title Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic
root (hd0,0)
kernel /vmlinuz-2.6.24-24-generic root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro quiet splash
initrd /initrd.img-2.6.24-24-generic
quiet
title Ubuntu 8.04.3 LTS, kernel 2.6.24-24-generic (recovery mode)
root (hd0,0)
kernel /vmlinuz-2.6.24-24-generic root=UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 ro single
initrd /initrd.img-2.6.24-24-generic
title Ubuntu 8.04.3 LTS, memtest86+
root (hd0,0)
kernel /memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda0
title Windows XP
rootnoverify (hd0,6)
chainloader +1
=============================== sda5/etc/fstab: ===============================
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda5
UUID=0ccbce6f-a197-4b10-ac81-c11aa16368d9 / ext3 defaults,errors=remount-ro 0 1
# /dev/sda1
UUID=6d88d4ce-8e24-4a65-8384-b0bd767bee27 /boot ext3 defaults 0 2
# /dev/sda6
UUID=198f4622-3e50-47d8-a815-2af3ac114193 /home ext3 defaults 0 2
# /dev/sda9
UUID=99e79a15-434c-4d8b-9927-5b54823c6125 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
# the USB group
# 对所有用户开放USB设备的读写权限
none /proc/bus/usb usbfs devmode=666 0 0
=================== sda5: Location of files loaded by Grub: ===================
.9GB: boot/grub/menu.lst
.9GB: boot/grub/stage2
.5GB: boot/initrd.img-2.6.24-24-generic
.5GB: boot/initrd.img-2.6.24-24-generic.bak
.5GB: boot/initrd.img-2.6.31.1leemz0.3
.5GB: boot/initrd.img-2.6.31.1leemz0.3.bak
.5GB: boot/vmlinuz-2.6.24-24-generic
.5GB: boot/vmlinuz-2.6.31.1leemz0.3
.5GB: initrd.img
.5GB: initrd.img.old
.5GB: vmlinuz
.5GB: vmlinuz.old
================================ sda7/boot.ini: ================================
[boot loader]
timeout=3
default=multi(0)disk(0)rdisk(0)partition(4)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(4)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
C:\GHLDR=һ��GHOST V11
=======Devices which don't seem to have a corresponding hard drive==============
hda .