Create a bootable windows 10 USB stick from linux: Difference between revisions

From www.ReeltoReel.nl Wiki
Jump to navigation Jump to search
(Created page with "Creating a bootable Windows 10 USB on Ubuntu 10 Aug 2016 - by 'Maurits van der Schee' Whenever I have to help somebody with Windows 10 I find myself making a bootable Window...")
 
mNo edit summary
Line 5: Line 5:
Whenever I have to help somebody with Windows 10 I find myself making a bootable Windows 10 USB drive. If you are on Windows this is provided via a menu option, but on Ubuntu Linux this requires some commands. This post will explain in detail how to do this.
Whenever I have to help somebody with Windows 10 I find myself making a bootable Windows 10 USB drive. If you are on Windows this is provided via a menu option, but on Ubuntu Linux this requires some commands. This post will explain in detail how to do this.


GPT partition table with FAT32 partition
=GPT partition table with FAT32 partition=


Modern systems support UEFI booting and this differs from traditional BIOS in that it does not read the boot sector. Instead it will look in the /efi/ directory in a FAT32 partition of a drive with GPT partitioning. There are no partition flags (like 'boot') necessary either.
Modern systems support UEFI booting and this differs from traditional BIOS in that it does not read the boot sector. Instead it will look in the /efi/ directory in a FAT32 partition of a drive with GPT partitioning. There are no partition flags (like 'boot') necessary either.


Getting the official Windows 10 ISO image
=Getting the official Windows 10 ISO image=


You can download the official Windows 10 ISO image from Microsoft by visiting:
You can download the official Windows 10 ISO image from Microsoft by visiting:
Line 17: Line 17:
But you must be on Linux (or pretend to be using user agent switcher) to download the file.
But you must be on Linux (or pretend to be using user agent switcher) to download the file.


Writing to the USB drive
=Writing to the USB drive=


Your USB drive has a drive letter in Linux typically something like 'b', which leads to a path to the device of /dev/sdb and a partition path for the first partition of /dev/sdb1. To avoid you screwing up your computer I use 'h', which you should replace in the commands below. You can use the 'gparted' graphical tool to find the drive letter of your USB drive.
Your USB drive has a drive letter in Linux typically something like 'b', which leads to a path to the device of /dev/sdb and a partition path for the first partition of /dev/sdb1. To avoid you screwing up your computer I use 'h', which you should replace in the commands below. You can use the 'gparted' graphical tool to find the drive letter of your USB drive.
Line 23: Line 23:
If your USB drive is behaving weird, then you can reset it by issuing the following command:
If your USB drive is behaving weird, then you can reset it by issuing the following command:


sudo dd if=/dev/zero of=/dev/sdh bs=512 count=1
# dd if=/dev/zero of=/dev/sdh bs=512 count=1


Normally this is not nessecary. Then to create a new layout on the drive:
Normally this is not nessecary. Then to create a new layout on the drive:


sudo fdisk /dev/sdh
# fdisk /dev/sdh


This is what you should enter in fdisk:
This is what you should enter in fdisk:
Line 36: Line 36:
Enter '11' for the 'Microsoft basic data' type.
Enter '11' for the 'Microsoft basic data' type.
Press 'w' to write the changes to disk.
Press 'w' to write the changes to disk.
The following command will format the first partition with FAT32.
The following command will format the first partition with FAT32.


sudo mkdosfs -F32 /dev/sdh1
# mkdosfs -F32 /dev/sdh1


Now we need to mount the downloaded ISO file:
Now we need to mount the downloaded ISO file:


sudo mount Downloads/Win10_1607_Dutch_x64.iso /mnt
# mount Downloads/Win10_1607_Dutch_x64.iso /mnt


And copy all contents to the USB drive (this takes up to 15 minutes and shows no progress):
And copy all contents to the USB drive (this takes up to 15 minutes and shows no progress):


sudo cp -R /mnt/* /media/maurits/39F5-8B34/
# cp -R /mnt/* /media/maurits/39F5-8B34/


Now unmount the ISO...
Now unmount the ISO...


sudo umount /mnt
# umount /mnt


and the USB drive before removing it:
and the USB drive before removing it:


sudo umount /media/maurits/39F5-8B34/
# umount /media/maurits/39F5-8B34/


To ensure the drive is OK, print the contents using 'fdisk':
To ensure the drive is OK, print the contents using 'fdisk':
Line 64: Line 65:
Be careful before using the write command.
Be careful before using the write command.


 
<pre>
Command (m for help): p
Command (m for help): p
Disk /dev/sdh: 7.2 GiB, 7735541760 bytes, 15108480 sectors
Disk /dev/sdh: 7.2 GiB, 7735541760 bytes, 15108480 sectors
Line 77: Line 78:


Command (m for help): q
Command (m for help): q
 
</pre>
Note that the drive should say 'Disklabel type: gpt' and 'Microsoft basic data'.
Note that the drive should say 'Disklabel type: gpt' and 'Microsoft basic data'.

Revision as of 12:36, 15 June 2017

Creating a bootable Windows 10 USB on Ubuntu

10 Aug 2016 - by 'Maurits van der Schee'

Whenever I have to help somebody with Windows 10 I find myself making a bootable Windows 10 USB drive. If you are on Windows this is provided via a menu option, but on Ubuntu Linux this requires some commands. This post will explain in detail how to do this.

GPT partition table with FAT32 partition

Modern systems support UEFI booting and this differs from traditional BIOS in that it does not read the boot sector. Instead it will look in the /efi/ directory in a FAT32 partition of a drive with GPT partitioning. There are no partition flags (like 'boot') necessary either.

Getting the official Windows 10 ISO image

You can download the official Windows 10 ISO image from Microsoft by visiting:

https://www.microsoft.com/en-us/software-download/windows10ISO

But you must be on Linux (or pretend to be using user agent switcher) to download the file.

Writing to the USB drive

Your USB drive has a drive letter in Linux typically something like 'b', which leads to a path to the device of /dev/sdb and a partition path for the first partition of /dev/sdb1. To avoid you screwing up your computer I use 'h', which you should replace in the commands below. You can use the 'gparted' graphical tool to find the drive letter of your USB drive.

If your USB drive is behaving weird, then you can reset it by issuing the following command:

# dd if=/dev/zero of=/dev/sdh bs=512 count=1

Normally this is not nessecary. Then to create a new layout on the drive:

# fdisk /dev/sdh

This is what you should enter in fdisk:

Press 'g' to create a new GPT, Press 'n' to create a new partition and accept the defaults, Press 't' to choose the partition type, Enter '11' for the 'Microsoft basic data' type. Press 'w' to write the changes to disk.

The following command will format the first partition with FAT32.

# mkdosfs -F32 /dev/sdh1

Now we need to mount the downloaded ISO file:

# mount Downloads/Win10_1607_Dutch_x64.iso /mnt

And copy all contents to the USB drive (this takes up to 15 minutes and shows no progress):

# cp -R /mnt/* /media/maurits/39F5-8B34/

Now unmount the ISO...

# umount /mnt

and the USB drive before removing it:

# umount /media/maurits/39F5-8B34/

To ensure the drive is OK, print the contents using 'fdisk':

maurits@nuc:~$ sudo fdisk /dev/sdh

Welcome to fdisk (util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

Command (m for help): p
Disk /dev/sdh: 7.2 GiB, 7735541760 bytes, 15108480 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: gpt
Disk identifier: 1F574274-2552-4728-831F-90D768723297

Device     Start      End  Sectors  Size Type
/dev/sdh1   2048 15108095 15106048  7.2G Microsoft basic data

Command (m for help): q

Note that the drive should say 'Disklabel type: gpt' and 'Microsoft basic data'.