User Tools

Site Tools


windows:windows_usb

Create a USB bootable Windows key on a Linux

Windows cannot be installed to this disk. The selected disk has a mbr partition table, On EFI system window can only be installed to GPT disks.

Once the windows 8.1 iso image downloaded, insert the USB key on the linux server, for the different operation you can use the root user (easier) or sudo:

List the USB disk:

manu-linux:~ # dmesg | tail -20   
...
[  747.310883] usb 1-3: new high-speed USB device number 7 using xhci_hcd
[  747.440062] usb 1-3: New USB device found, idVendor=0e39, idProduct=f100
[  747.440066] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  747.440068] usb 1-3: Product: USB-IBM
[  747.440070] usb 1-3: Manufacturer: SMART
[  747.440072] usb 1-3: SerialNumber: S78P3917YQ10DP486127
[  747.960845] usb-storage 1-3:1.0: USB Mass Storage device detected
[  747.961057] scsi host3: usb-storage 1-3:1.0
[  747.961181] usbcore: registered new interface driver usb-storage
[  747.963772] usbcore: registered new interface driver uas
[  748.959220] scsi 3:0:0:0: Direct-Access     SMART    USB-IBM          025D PQ: 0 ANSI: 6
[  748.959404] sd 3:0:0:0: Attached scsi generic sg1 type 0
[  748.959848] sd 3:0:0:0: [sdb] 15466496 512-byte logical blocks: (7.92 GB/7.38 GiB)
[  748.960664] sd 3:0:0:0: [sdb] Write Protect is off
[  748.960666] sd 3:0:0:0: [sdb] Mode Sense: 2b 80 00 08
[  748.961514] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[  749.563471]  sdb: sdb1
[  749.565929] sd 3:0:0:0: [sdb] Attached SCSI removable disk
manu-linux:~ # lsscsi
[0:0:0:0]    disk    ATA      Samsung SSD 850  2B6Q  /dev/sda 
[3:0:0:0]    disk    SMART    USB-IBM          025D  /dev/sdb 

First convert to MBR instead GPT:

manu-linux:~ # fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 7.4 GiB, 7918845952 bytes, 15466496 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: 5B099F25-08D4-4593-9CCD-CB602E7D5AB8

Device     Start      End  Sectors  Size Type
/dev/sdb1   2048 15466462 15464415  7.4G Microsoft LDM metadata

Command (m for help): o
Created a new DOS disklabel with disk identifier 0x94bed3f3.

Command (m for help): p
Disk /dev/sdb: 7.4 GiB, 7918845952 bytes, 15466496 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: 0x94bed3f3

Command (m for help): w

Create a primary partition type 7 (windows), and bootable (a):

manu-linux:~ # fdisk /dev/sdb

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/sdb: 7.4 GiB, 7918845952 bytes, 15466496 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: 0x94bed3f3

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-15466495, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-15466495, default 15466495): 

Created a new partition 1 of type 'Linux' and of size 7.4 GiB.

Command (m for help): t
Selected partition 1
Partition type (type L to list all types): L
.....
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
...        
Partition type (type L to list all types): 7
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/sdb: 7.4 GiB, 7918845952 bytes, 15466496 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: 0x94bed3f3

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     2048 15466495 15464448  7.4G  7 HPFS/NTFS/exFAT

Command (m for help): w

Format the partition with type NTFS:

manu-linux:~ # mkfs.ntfs -f /dev/sdb1

Install the package ms-sys from your distribution or sources from https://sourceforge.net/projects/ms-sys/

Make your USB key bootable:

manu-linux:~ # ms-sys -7 /dev/sdb
Windows 7 master boot record successfully written to /dev/sdb

Mount the partition:

manu-linux:~ # mkdir /mnt
manu-linux:~ # mount /dev/sdb1 /mnt

Now Copy your ISO windows 8.1 image to your USB key:

manu-linux:~ # mkdir /mnt1
manu-linux:~ # mount -o loop Downloads/Win_Pro_8.1_64BIT_English.ISO /mnt1
mount: /dev/loop0 is write-protected, mounting read-only
manu-linux:~ # cp -r /mnt1/* /mnt/
manu-linux:~ # umount /mnt
manu-linux:~ # umount /mnt1
windows/windows_usb.txt · Last modified: 2021/01/01 21:25 (external edit)