在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的安裝界面了!