旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 旁门左道:没有 c 盘的 windows

#16

帖子 billbear » 2009-09-06 1:18

wangdu2002 写了: 熊哥要补充一下才好啊,怎样在没软驱的情况下搞出那个软盘引导映像,直接引导之。 :em02
我是这样做的,先 dd 一个空文件,
sudo dd if=/dev/zero of=xpflp.img bs=1024 count=1440
然后把它作为 vBox 的软磁盘,启动 vBox 里的 xp,格式化之,拷贝 ntldr ntdetect.com boot.ini bootfont.bin,修改 boot.ini,最后用 bootsect (http://ftp.ubuntu.org.cn/home/billbear/ 有) 写入启动扇区 nt52 代码:
bootsect /nt52 a:
bootsect 会抱怨一下软盘,不理它。
然后,关闭虚拟机,把 xpflp.img 压缩一下 (initrd 可以用压缩的文件)
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 旁门左道:没有 c 盘的 windows

#17

帖子 billbear » 2009-09-06 1:38

hubert_star 写了:
但是,安装好以后,移动到别的盘,很多软件的内置注册表路径会有问题,要全部改变盘符,尤其是sp补丁这类的东西
盘符在 HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices 里控制,用的也是 uuid 一类的东西。移动自然是不妥的,但如果用 ghost,会把 uuid 一并克隆过去,盘符不会改变。我把第一主分区的映像恢复到某个逻辑分区,启动后这个逻辑分区就叫 c ,一切正常。而 e 盘的 windows,删除 c 盘后启动,仍然叫做 e 盘。注册表里,c 盘, e 盘 就是对于某个 uuid 的分区。
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 旁门左道:没有 c 盘的 windows

#18

帖子 smallapple » 2009-09-06 8:58

用来消灭双windows系统的二重菜单,或救回非C盘的windows,确实是好办法。 :em11
按理说,那些 ghost 版的 xp 应该能这样被安装到逻辑分区里的,我测试了深度的版本,可以启动,但是没等完成安装驱动就死机了。还不清楚原因。
ghost版的xp目前基本上存在两种不同的封装方式,一种是己写好引导代码的,引导方式也是通过 ntldt + boot.ini 引导的,按理这种ghost镜像应该是可
安装成功的。
另外有一种是以DOS方式启动,安装时再用 bootsect 写入引导代码的,这种方式没主分区就不能完成安装的。
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 旁门左道:没有 c 盘的 windows

#19

帖子 billbear » 2009-09-06 22:35

我不了解 ghost 封装技术。我测试的深度版首次引导就是通过 ntldr + boot.ini 引导的。但它似乎调用了 windows 安装程序的最后几步,我看到有生成开始菜单,注册组件,删除临时文件等等。一旦调用 windows 安装程序,就死机。安装程序大概无法接受没有主分区的事实。应该有那种完全是安装结束状态的 ghost 版 ...
我在试验一个新思路,大概可行,呵呵。
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: 旁门左道:没有 c 盘的 windows

#20

帖子 wangdu2002 » 2009-09-06 23:35

熊哥实在牛13,又得好好学习下,以后也找台机器弄个“没有C的windows”. :em11
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 旁门左道:没有 c 盘的 windows

#21

帖子 billbear » 2009-09-07 0:04

新思路是,备份分区表,抹掉分区表,在目标逻辑分区处准确标识一个主分区,安装 xp,恢复原有的分区表。试验圆满成功:) 下面记录此次试验的过程。胆小者勿试。 :em05

工具:ubuntu livecd,windows xp 安装光盘。
环境:单硬盘 sda、单系统 ubuntu、空闲的逻辑分区用来安装 windows
步骤:
0. 确认你目前的分区表没有问题。运行 sudo parted /dev/sda print 。能够输出各分区的大小,说明分区表没有问题。
1. 备份 mbr。运行
sudo dd if=/dev/sda of=mbr bs=512 count=1
这会备份 mbr 引导代码和主分区表。把生成的 mbr 文件保存在外置硬盘或网络上。
2. 精确列出当前分区表。记得用 -lu 选项。我的输出是

代码: 全选

billbear@billbear-laptop:~$ sudo fdisk -lu
[sudo] password for billbear:

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x000b39bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63    11213369     5606653+  83  Linux
/dev/sda2        11213370    12225464      506047+  82  Linux swap / Solaris
/dev/sda3        12225465    33736499    10755517+   5  Extended
/dev/sda5        12225528    33736499    10755486    b  W95 FAT32
sda5 是我预备安装 xp 的逻辑分区。
3. 抹掉分区表。
sudo dd if=/dev/zero of=/dev/sda bs=512 count=1
4. 在预备安装 xp 的逻辑分区处标识一个主分区。用 sudo fdisk /dev/sda -u 以确保绝对精确。下面是我的例子。红色是我添加的注释。
billbear@billbear-laptop:~$ sudo fdisk /dev/sda -u
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x7050e650.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.


The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p 列出分区表,显然,分区表已经被清空。

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x7050e650

Device Boot Start End Blocks Id System

Command (m for help): n 新建分区
Command action
e extended
p primary partition (1-4)
p 主分区
Partition number (1-4): 1 第一主分区
First sector (63-41943039, default 63): 12225528
Last sector or +size or +sizeM or +sizeK (12225528-41943039, default 41943039): 33736499
这里使用第二步中列出的预备安装 xp 的逻辑分区的精确起止位置。请再三确认。
Command (m for help): p 再看看现在的分区表

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x7050e650

Device Boot Start End Blocks Id System
/dev/sda1 12225528 33736499 10755486 83 Linux

Command (m for help): t 把我们新建的这个分区标识为 ntfs。这步应该可以省略。
Selected partition 1
Hex code (type L to list codes): 07
Changed system type of partition 1 to 7 (HPFS/NTFS)

Command (m for help): p 再确认分区表。

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x7050e650

Device Boot Start End Blocks Id System
/dev/sda1 12225528 33736499 10755486 7 HPFS/NTFS

Command (m for help): w 写入
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
5. 丢进 xp 安装盘。重启,在准备好的主分区安装。记得让安装程序格式化这个分区以确保能够启动。

6. 安装全部结束,进入 xp 桌面。丢进 ubuntu livecd 重启。

7. 在 livecd 环境下恢复旧的分区表连同 mbr grub 引导代码:从外置硬盘或网络上得到你先前备份的 mbr,运行
sudo dd if=mbr of=/dev/sda

8. 重启。ubuntu 又回来了。sudo fdisk -l 看看分区表,如有必要,修正分区 id。我原先的 sda5 是 fat32 的,刚才格式化成了 ntfs,所以现在把 id 改成 07。

代码: 全选

billbear@billbear-laptop:~$ sudo fdisk -l
[sudo] password for billbear:

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b39bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         698     5606653+  83  Linux
/dev/sda2             699         761      506047+  82  Linux swap / Solaris
/dev/sda3             762        2100    10755517+   5  Extended
/dev/sda5             762        2100    10755486    b  W95 FAT32
billbear@billbear-laptop:~$ sudo blkid
/dev/sda1: UUID="ac4e71bb-066e-4751-83c0-7b0c4f3e8069" TYPE="ext3"
/dev/sda2: TYPE="swap" UUID="1b76caa3-941b-4210-93ca-32a7221c784f"
/dev/sda5: UUID="9A002DD6002DBA61" TYPE="ntfs"
billbear@billbear-laptop:~$ sudo fdisk /dev/sda

The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): t
Partition number (1-5): 5
Hex code (type L to list codes): 07
Changed system type of partition 5 to 7 (HPFS/NTFS)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
billbear@billbear-laptop:~$ sudo fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000b39bb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         698     5606653+  83  Linux
/dev/sda2             699         761      506047+  82  Linux swap / Solaris
/dev/sda3             762        2100    10755517+   5  Extended
/dev/sda5             762        2100    10755486    7  HPFS/NTFS
9. 修改 menu.lst,添加启动项用软盘映像引导逻辑分区上的 windows。
头像
yanqian
帖子: 25
注册时间: 2005-08-31 14:18

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#22

帖子 yanqian » 2009-10-07 17:52

不错,讲的挺好!

之前红旗论坛(后来转到Linux-ren论坛了)上有个类似的帖子,真是巧啊:
http://www.linux-ren.org/modules/newbb/ ... 2&forum=51

不过因为红旗论坛的资料转到Linux-ren后,格式都乱了,图片也没有了,只能将就看了……
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#23

帖子 wangdu2002 » 2009-10-07 18:00

熊哥实在牛13,本督佩服得五体投地。。。实施过程非常详细,下月找台旧机试试玩下,“没有C盘的windows”。 :em11
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
ulosggs
帖子: 206
注册时间: 2009-03-25 13:17

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#24

帖子 ulosggs » 2009-10-07 18:13

这个好啊!!!
生命诚可贵
不因虚度年华而悔恨
Dropbox: http://db.tt/zYrxtyj
billbear
帖子: 3681
注册时间: 2008-05-03 23:42

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#26

帖子 billbear » 2009-10-07 23:45

yanqian 写了:不错,讲的挺好!

之前红旗论坛(后来转到Linux-ren论坛了)上有个类似的帖子,真是巧啊:
http://www.linux-ren.org/modules/newbb/ ... 2&forum=51

不过因为红旗论坛的资料转到Linux-ren后,格式都乱了,图片也没有了,只能将就看了……
看来此法古已有之。在受到 climbing 先生启发之前我一直没有往这方向想过。

climbing 先生和你提到的贴子都是使用 grub4dos,而我为偷懒直接用的是 GNU GRUB 0.9x 配合 memdisk.gz。但是实际上 grub4dos 的兼容性、可靠性和灵活性要远胜于 GNU GRUB 0.9x。配合 grub4dos 的软盘映像不需要写 boot sector,直接 chainloader /ntldr 就可以了,因此制作 img 更加方便,只要 dd 一下,mkfs 一下,丢进文件就好了。而且确实有些机器用 grub 0.9x 和 memdisk.gz 就是死活不工作,改用 grub4dos 通常会收到很好的效果。

不过 21 楼大概是我的原创。 :em05
jsleemz
帖子: 144
注册时间: 2006-07-27 15:50

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#27

帖子 jsleemz » 2009-10-08 8:26

viewtopic.php?f=77&t=155893

看我3楼的回复

用通用的ghost版已经实现过了
jsleemz
帖子: 144
注册时间: 2006-07-27 15:50

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#29

帖子 jsleemz » 2009-10-08 11:56

billbear 写了:我不信
怎么让你信呢?
jsleemz
帖子: 144
注册时间: 2006-07-27 15:50

Re: 旁门左道:没有 c 盘的 windows。21楼:Howto:在单 ubuntu 系统上再安装一个 xp 到一个逻辑分区

#30

帖子 jsleemz » 2009-10-08 12:13

boot.ini里的这个partition(4)应该ghost后手动修改的,时间长了,忘了

代码: 全选

[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
附件
sendpix0.jpg
回复