Home  >  Article  >  Operation and Maintenance  >  Detailed introduction on how to create a windows boot disk in linux system

Detailed introduction on how to create a windows boot disk in linux system

黄舟
黄舟Original
2017-06-05 10:32:533040browse

I use many linux operating commands in my daily work, so for the sake of convenience, I installed dual systems on my computer. When I usually work, I choose to enter the Linux system. But today there is something other than work that needs to be solved: creating a Windows boot disk. If I follow the usual rules, I will start Windows, and then use xxx to make a USB boot tool to create a boot disk in a fool-proof way. But today I don’t want to restart the system and enter Windows to make a USB boot disk. I am thinking about making a USB boot disk in a Linux system.

I have come across some blogs or other information about making a USB bootable disk in Linux before. They all said that it can be done with the dd command. I have tried it before and found that there was a problem with the dd command when burning the Windows iso file. The system cannot recognize the burned boot disk. I didn't delve into the cause before, so I continued this problem today and looked for solutions online. After searching for a long time, I finally found an article that can make a boot disk normally. The following is the URL of the article. If you are interested, you can check it out by yourself:

url: http://blog.csdn.net/mike8825/article/details/51138575?locationNum=9 Thanks to "Tianwai Guest" for sharing .

It is also mentioned in the blog that Linux iso comes with mbr, so there is no problem when dd burns Linux iso, and mbr will be burned into the USB disk together. However, the Windows iso file does not come with mbr, so when making a Windows startup disk in a Linux system, you first need to write the mbr information to the USB disk. Then copy the Windows iso content to the USB flash drive. In this way, bios can correctly identify mbr and installwindows system.

Following the steps in the blog above, I performed the following operations:

My operating system: ubuntu 17.04

1. First check whether ntfs-3g is installed. See I have installed it. If it is not installed, execute the command: sudo apt install ntfs-3g

1 $ apt list ntfs-3g            #检查是否安装了ntfs-3g
3 正在列表... 完成
4 ntfs-3g/zesty,now 1:2016.2.22AR.1-4 amd64 [已安装]
5 6 $sudo apt install ntfs-3g   #如果没有安装,则执行这个命令安装

2. Install lilo and see that the installation is completed. If it is not installed, execute the command: sudo apt install lilo. Installation of lilo.

$dpkg -l lilo

期望状态=未知(u)/安装(i)/删除(r)/清除(p)/保持(h)
| 状态=未安装(n)/已安装(i)/仅存配置(c)/仅解压缩(U)/配置失败(F)/不完全安装(H)/触发器等待(W)/触发器未决(T)
|/ 错误?=(无)/须重装(R) (状态,错误:大写=故障)
||/ 名称                            版本                 体系结构             描述
+++-===============================-====================-====================-===================================================================
ii  lilo                            1:24.2-2             amd64                LInux LOader - the classic OS boot loader

$ sudo apt install lilo #如果提示未安装,则进行安装操作

3. Check the drive letter of the U disk, back up the contents of the U disk, and then format the U disk. The formatting process is fat32. (You can see that my U disk format has been It’s fat32)

$ sudo fdisk -l                #查看U盘的分区

...

Disk /dev/sdb: 7.3 GiB, 7784628224 bytes, 15204352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x48156368

设备       启动   Start     末尾     扇区  Size Id 类型
/dev/sdb1  *    1347328 15204351 13857024  6.6G  c W95 FAT32 (LBA)

You can see that the drive letter of my U disk is /dev/sdb

1 $ sudo mkfs.vfat /dev/sdb1        #格式化U盘,前提是U盘被正确卸载
2 mkfs.fat 4.0 (2016-05-06)

I used the command above to format the U disk into fat32 format.

4. Create mbr in the USB disk (what does mbr mean? Search yourself). The lilo I used here

1 $ sudo lilo -M /dev/sdb mbr           #在u盘中写入mbr
2 Backup copy of /dev/sdb in /boot/boot.0810
3 The Master Boot Record of  /dev/sdb  has been updated.

has been prompted above that I have successfully created the mbr. .The following is to copy the contents of the windows iso to the U disk.

5.Hang the image and the U disk, and copy the contents of the windows image to the U disk.

$mkdir /tmp/win7
$mkdir /tmp/usb

$sudo mount -o loop cn_windows_7_professional_with_sp1_vl_build_x64_dvd_u_677816.iso /tmp/win7

$sudo mount /dev/sdb1 /tmp/usb

$ df -h                  #查看挂载点
文件系统        容量  已用  可用 已用% 挂载点
.....
.....
/dev/loop4      3.1G  3.1G     0  100% /tmp/win7
/dev/sdb1       6.6G  4.0K  6.6G    1% /tmp/usb

Seeing that I have mounted the system, the only thing left is to copy the contents of /tmp/win7 to /tmp/usb

6. Copy the contents of the iso file to USB.

$ cp -rf /tmp/win7/* /tmp/usb           #拷贝到U盘中

$sync           #将内存中数据flush到磁盘中

$sudo umount /dev/sdb1           #卸载U盘

$sudo umount /tmp/win7            #卸载镜像

Now it’s done. Restart the computer and verify the results of your work

The above is the detailed content of Detailed introduction on how to create a windows boot disk in linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn