Created
April 4, 2020 01:08
-
-
Save requinix/fb487d956f650af46daab1c9dbac4a7b to your computer and use it in GitHub Desktop.
Installing Windows on a USB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Requirements | |
============ | |
* USB device (actually, any storage device works) with an appropriate size for the OS | |
* A target computer capable of booting from the device | |
Before you start | |
================ | |
* Don't run commands blindly | |
* Customize commands as needed | |
* ? is a placeholder for something | |
Setup | |
===== | |
* Insert the installation media into the computer and boot from it | |
* When the installer finishes loading, hit Shift+F10 to get a command prompt | |
* Note the drive letter of the installation media - probably X or D or E | |
Prepare the USB with DISKPART | |
============================= | |
?:\> DISKPART | |
DISKPART> LIST DISK | |
* Note the disk number of the USB | |
DISKPART> SELECT DISK ? | |
DISKPART> CLEAN | |
DISKPART> CREATE PARTITION PRIMARY | |
DISKPART> FORMAT QUICK FS=NTFS | |
DISKPART> ACTIVE | |
* Unassign C: from any existing drives | |
DISKPART> LIST VOLUME | |
* If there is any volume mounted to C: then remove it | |
* If somehow C: is the installation media, and it really shouldn't be, then don't REMOVE but ASSIGN a different letter | |
DISKPART> SELECT VOLUME ? | |
DISKPART> REMOVE | |
* Go back to the USB and assign it C: | |
DISKPART> SELECT DISK ? | |
DISKPART> ASSIGN LETTER=C | |
DISKPART> EXIT | |
?:\> C: | |
C:\> DIR /A | |
* Make sure the drive is empty and that the free space reported sounds right | |
Install Windows | |
=============== | |
* ?:\sources\install.wim should be the path to the installation data from the media | |
* install.wim supports multiple OS types, with indexes starting from 1 - as listed in the installer UI when it asks what to install | |
- Windows Server example: 1=Standard Core, 2=Standard UI, 3=Datacenter Core, 4=Datacenter UI | |
C:\> DISM /Apply-Image /ImageFile:?:\sources\install.wim /Index:? /ApplyDir:C:\ | |
* Install the bootloader | |
C:\> BOOTSECT /nt60 C: /mbr | |
C:\> BCDBOOT C:\Windows /s C: /f ALL | |
* Hyper-V Server, or Windows with the Hyper-V role pre-installed, may need the hypervisor enabled at boot | |
* If you don't do this and it's necessary, the system will tell you that Hyper-V isn't working | |
C:\> BCDEDIT /store C:\BOOT\BCD /set {default} hypervisorlaunchtype Auto | |
Disable Paging | |
============== | |
* Paging can mean a lot of writing and that will hurt the lifetime of a USB device - but make sure you have plenty of memory | |
* The ExistingPageFiles setting probably won't exist for new installations, in which case the REG DELETE will error | |
C:\> REG LOAD HKLM\foo C:\Windows\system32\config\SYSTEM | |
C:\> REG ADD "HKLM\foo\ControlSet001\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "" /f | |
C:\> REG DELETE "HKLM\foo\ControlSet001\Control\Session Manager\Memory Management" /v ExistingPageFiles /f | |
C:\> REG UNLOAD HKLM\foo | |
Reboot | |
====== | |
Sources | |
======= | |
* https://web.archive.org/web/20190831154752/https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/microsoft-hyper-v-server-2008-R2/ee731893(v=ws.10) | |
* https://web.archive.org/web/20190912065716/https://www.danielstechblog.info/how-to-deploy-windows-server-2016-tp3-onto-an-sd-card/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment