Install Windows on Ubuntu hard drive
7
Required tools and files
Windows 7 installation image;
I downloaded 7600.16385.090713-1255_x64fre_client_zh-cn_retail_ultimate-grmculxfrer_cn_dvd.iso, 3.1 GB.
grub4dos
is used to guide Windows installation, later, I heard that grub2 is more convenient, but I cannot install it again. The following uses grub4dos as an example.
easybcd
it is used to retrieve the menu for starting Ubuntu after Windows is installed.
Back up MBR
$ Sudo dd If =/dev/SDA of =/backup/MBR. img bs = 512 COUNT = 1
Important. During Ubuntu installation, Windows startup items are retained, but the installation process of Windows is too aggressive. After installation, You need to import MBR to retrieve the Ubuntu startup items.
Files in Ubuntu cannot be accessed in windows. Therefore, you need to copy the backup file to a Windows file system, or use a USB flash disk to back up the file.
Mounting Windows 7 ISO
$ Sudo Mount/ISO/7600.16385.090713-1255_x64fre_client_zh-cn_retail_ultimate-grmculxfrer_cn_dvd.iso/mnt-o loop
Mount Windows 7 ISO to/mnt, open this directory, and copy all the files in it to the root directory of an NTFS partition-it cannot be used to install Windows 7 partitions, that is, two windows partitions need to be prepared in advance.
Because windows and Ubuntu coexist, C, D, and E disks exist in windows, and C disks are used to install Windows 7. The above installation files are copied to the root directory of the E disk.
Add Startup Menu
Open the downloaded grub4dos.zip file and extract grub.exe from it.
Modify/boot/GRUB/menu. lst and add the following lines:
Title grub4dos
Root (hd0, 3)
Kernel/home/grub.exe
Boot
You can check the original part of menu. lst and find the Ubuntu option and copy it to the same one.
For example, the first item of my original startup Item is:
Title Ubuntu 9.10, kernel 2.6.31-16-generic
Root (hd0, 3)
The/home/grub.exein the third line needs to be modified to the path of the newly decompressed grub.exe.
Restart Installation
Restart, select grub4dos in the operating system menu, enter the Operating System menu again as soon as the screen flashed, press C to enter the command line grub>, and enter the following commands in sequence:
Grub> Find -- Set-root/bootmgr
Grub> chainloader/bootmgr
Grub> boot
Then go to the Windows 7 Installation Guide interface and install it all the way.
Recover MBR
After windows is installed, the multi-system menu disappears and you need to restore the MBR. Several articles I found online before installation Article In Windows, you can run the following command to restore data:
Echo c: \ "Linux. lnx" = Linux> boot. ini
Unfortunately, there seems to be no boot. ini in Windows 7. I tried it. This method is invalid.
Instead, I had to use easybcd, run it after installation, and add a Linux Startup item. C: \ NST \ nst_linux.mbr file will be generated under drive C. Delete it, copy the previously backed up MBR. IMG to this location, and rename it nst_linux.mbr.
Restart the system and select the Linux option in the multi-system menu to view the original Ubuntu multi-system menu. Go to Ubuntu and then completely restore the MBR.
$ Sudo dd If =/backup/MBR. IMG of =/dev/sda bs = 446 COUNT = 1
Grub4dos download
Grub4dos-0.4.4-2009-01-11-src.zip 12-Jan-2009
1.4 m
Grub4dos-0.4.4-2009-01-11.zip 12-Jan-2009
807 K
This article is from the Linux community website (www.linuxidc.com)
Source: http://www.linuxidc.com/Linux/2010-05/26118.htm