Install Windows 7 on Ubuntu hard drive

Source: Internet
Author: User
Previously, Windows 7 was installed with virtualbox in Ubuntu, which is indeed much better than Windows in the past. So it took some time to upgrade Windows XP, which originally existed with Ubuntu, to Windows 7. The required tools and files are Windows 7 installation images. I downloaded 7600.16385.090713-1255_x64fre_client_zh-cn_Retail_Ultimate-GRMCULXFRER_CN.

Previously, Windows 7 was installed with virtualbox in Ubuntu, which is indeed much better than Windows in the past. So it took some time to upgrade Windows XP, which originally existed with Ubuntu, to Windows 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
It is used to guide Windows installation. Later I heard that Grub2 is also good, but it is more convenient, but I have not installed it again. The following uses grub4dos as an example;
EasyBCD
It is used to retrieve the menu for starting Ubuntu after Windows installation is complete.

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. I have specified several articles on the Internet before installation. In Windows, you can run the following command to restore it:
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.