在Ubuntu下制做Windows的启动盘,直接dd或etcher写的盘是启动不起来的。ubuntu
最近想 ,在Ubuntu上刻录个windows的安装U盘,在网上看了些资料,不过好多都说的很模糊,因而乎,我走了很多弯路。这里记录下来,但愿了帮到你们。windows
首先你的有个USB吧,这里咱们假定USB在ubuntu中为/dev/sdbide
1. 给USB设备 /dev/sdb 分区,注意,要是主分区,工具
sudo fdisk /dev/sdb Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): Using default value 1 First sector (2048-15564799, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-15564799, default 15564799): Using default value 15564799 Command (m for help): p Disk /dev/sdb: 7969 MB, 7969177600 bytes 246 heads, 62 sectors/track, 1020 cylinders, total 15564800 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 Disk identifier: 0x8d55b9cb Device Boot Start End Blocks Id System /dev/sdb1 2048 15564799 7781376 83 Linux
上面/dev/sdb1就分出来了,所有的空间都给了sdb1spa
2. 而后把/dev/sdb1设置为启动分区ci
Command (m for help): a Partition number (1-4): 1 Command (m for help): p Disk /dev/sdb: 7969 MB, 7969177600 bytes 126 heads, 10 sectors/track, 12353 cylinders, total 15564800 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 Disk identifier: 0x8d55b9cb Device Boot Start End Blocks Id System /dev/sdb1 * 2048 15564799 7781376 83 Linux
咱们能够看到,sdb1后面,多了个*get
3. 接下来,把上面作的全部改动写入USBit
Command (m for help): w
The partition table has been altered!io
Calling ioctl() to re-read partition table.table
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
而后就是q退出
4. 将分区格式化为ntfs的
sudo mkfs -t ntfs /dev/sdb1
这个过程当中,会把分区中写入全0,大概会等几分钟
5. 接下来就是把下载好的iso文件dd到这个启动分区了
# 把下载的iso文件刻录到usb的分区中(及得,必定是分区,不然下次用这个usb是会出现 Operating not found的问题 sudo dd if=/home/peter/Downloads/WindowsTechnicalPreview-x64-ZH-CN.iso of=/dev/sdb1 bs=4M iflag=direct
看到了吧,我在安装win10
6. 如今还不能够从usb盘启动,还要在usb盘MBR区信息写入,这须要一个工具LILO
sudo apt-get install lilo sudo lilo -M /dev/sdb mbr
下次启动的时候,选择这个USB启动就会出现windows的安装界面了!