Dec 03 2021 05:30 AM - edited Dec 08 2021 12:26 AM
How to install Windows 10 on NVMe SSD on old PC? Since old computers don't load NVMe SSD drives when they start up, the way I think about it is to load them during BCDBoot? But I don't know how.
Because the hardware of the old computer is not configured with NVMe SSD OPROM or EFI driver, but I found that win10 installation disk can load NVMe SSD and normal use of NVMe SSD, which indicates that in the process of win10 startup can still be joined by software NVMe SSD driver and use this hardware device, Hardware can be loaded at operating system boot, just as the SCSI card driver was previously loaded when installing the Windows operating system.
Jan 16 2022 03:15 AM
I've done this before actually, it does work but it's complex (be warned.) It's like network booting, but instead your SSD will have a virtual image within the drive itself. It's smarter to set this up in a VM on an HDD, and then copy the image, leaving a certain percentage of free space available for wear leveling / TRIM / garbage collection purposes, as to extend the lifespan of the drive.)
Here's an example of some random things I use specifically for this:
wsl --install
DISM /Online /Enable-Feature /All /Norestart /featurename:Microsoft-Windows-Subsystem-Linux
DISM /Online /Enable-Feature /All /Norestart /featurename:VirtualMachinePlatform
DISM /Online /Enable-Feature /All /Norestart /FeatureName:HypervisorPlatform
bcdedit /v
bcdedit /enum {current}
bcdedit /set {current} bootlog no
bcdedit /set {current} bootmenupolicy Legacy
bcdedit /set {current} quietboot on
bcdedit /set {current} disableelamdrivers yes
bcdedit /set {current} nx AlwaysOn
bcdedit /set {current} disabledynamictick no
bcdedit /set {current} pciexpress default
bcdedit /set {current} tpmbootentropy ForceEnable
bcdedit /set {current} tscsyncpolicy Enhanced
bcdedit /set {current} usefirmwarepcisettings yes
bcdedit /set {current} uselegacyapicmode no
bcdedit /set {current} highestmode on
"bcdedit" -> https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/bcdedit
"BCDEdit Options Reference" -> https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/bcd-boot-options-reference
"4-Gigabyte Tuning: BCDEdit and Boot.ini" -> https://docs.microsoft.com/en-us/windows/win32/memory/4-gigabyte-tuning
"Bootsect Command-Line Options" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bootsect-command-line-options
"BCDBoot Command-Line Options" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcdboot-command-line-options-techref-di?view=windows-11#command-line-options
"Boot to a virtual hard disk: Add a VHDX or VHD to the boot menu" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/boot-to-vhd--native-boot--add-a-virtual-hard-disk-to-the-boot-menu
"[MS-VHDX]: Virtual Hard Disk v2 (VHDX) File Format" -> https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-vhdx/83e061f8-f6e2-4de1-91bd-5d518a43d477
For additional types that apply to the boot manager, memory diagnostic
application, windows OS loader, or the resume application, run
"bcdedit /? TYPES <apptype>", where <apptype> is one of the following:
BOOTMGR The boot manager.
MEMDIAG The memory diagnostic application.
OSLOADER The Windows OS loader.
RESUME The resume application.
"Boot Settings" -> https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set#boot-settings
"Manufacturing Windows Engineering Guide (WEG)" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/manufacturing-windows-engineering-guide
"Compact OS Size comparisons" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/compact-os#size-comparisons
"/Optimize-Image" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism-image-management-command-line-options-s14#optimize-image
"Oscdimg Command-Line Options" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/oscdimg-command-line-options#file
"Create an ISO image for UEFI platforms for a Windows PE CD-ROM" -> https://docs.microsoft.com/en-US/troubleshoot/windows-server/deployment/create-iso-image-for-uefi-platforms
"Installing Windows to an EFI-Based Computer" -> https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/dd744321(v=ws.10)
"Device and OSDevice Settings" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bcd-system-store-settings-for-uefi#device-and-osdevice-settings
"Secure Boot" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/secure-boot-landing
"WIM vs. VHD vs. FFU: comparing image file formats" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/wim-vs-ffu-image-file-formats
"Sample scripts" -> https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-deployment-sample-scripts-sxs
bcdboot C:\Windows /s S: /f UEFI
Jan 16 2022 03:35 AM
Another example of what it might look like in diskpart (it's not that different on nix btw, especially if you want partition alignment, advanced format disk or another type (512e vs 4k sectors I mean,) it's basically like using a raid calculator.
NTFS:
1TB = 1048576 (MB) -> 2^20 * 1
500GB = 512001 (MB) -> 500 * 1024 + 1
250GB = 256001 (MB) -> 250 * 1024 + 1
150GB = 153601 (MB) -> 150 * 1024 + 1
100GB = 102401 (MB) -> 100 * 1024 + 1
50GB = 51201 (MB) -> 50 * 1024 + 1
NTFS -> (Size in GB * 1024) + 1
FAT32 (up to 32GB) -> (Size in GB * 1024) + 12
Minimum page file size: Varies based on page file usage history, amount of RAM (RAM ÷ 8, max 32 GB) and crash dump settings.
Maximum page file size: 3 × RAM or 4 GB, whichever is larger. This is then limited to the volume size ÷ 8. However, it can grow to within 1 GB of free space on the volume if required for crash dump settings.
https://docs.microsoft.com/en-US/windows/client-management/determine-appropriate-page-file-size
58369 (57GB NTFS)
16385 (16GB NTFS)
1025 (1GB NTFS)
Old PC Pagefile: MIN 128 MAX 3075 (MAX > 2560 = 1/8th of 20GB Volume)
New PC Pagefile: MIN 2048 MAX 49155 (MAX > 19200 = 1/8th of 150GB Volume | MAX > 7296 = 1/8th of 57GB Volume )
51073 = 58369 - 7296 (Virtual Drive File Size = System Drive Size - Swap File Size)
CREATE VDISK FILE="M:\Win11_64.vhdx" MAXIMUM=51073 TYPE=FIXED
DISKPART> help create vdisk
Creates a virtual disk file. Currently only VHD and VHDX format files are
supported and are specified through the file extensions (.vhd and .vhdx)
of the virtual disk file.
Syntax: CREATE VDISK FILE=<"filename"> MAXIMUM=<N> [TYPE={FIXED|EXPANDABLE}]
[SD=<SDDL string>] [PARENT=<"filename">] [SOURCE=<"filename">]
[NOERR]
FILE=<"filename">
Specifies the complete path and filename of the virtual disk
file. The file may be on a network share.
MAXIMUM=<N> The maximum amount of space exposed by the virtual disk, in
megabytes (MB).
TYPE={FIXED|EXPANDABLE}
FIXED specifies a fixed size virtual disk file. EXPANDABLE
specifies a virtual disk file that resizes to accommodate
the allocated data. The default is FIXED.
[PARENT=<"filename">]
Path to an existing parent virtual disk file to create a
differencing disk. With the PARENT parameter, MAXIMUM should
not be specified because the differencing disk gets the size
from its parent. Also, TYPE should not be specified since only
EXPANDABLE differencing disks can be created.
[SOURCE=<"filename">]
Path to an existing virtual disk file to be used to
pre-populate the new virtual disk file. When SOURCE is
specified, data from the input virtual disk file is copied
block for block from the input virtual disk file to the
created virtual disk file. There is no parent-child
relationship established however.
NOERR For scripting only. When an error is encountered, DiskPart
continues to process commands as if the error did not occur.
Without the NOERR parameter, an error causes DiskPart to exit
with an error code.
Example:
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000
CREATE VDISK FILE="c:\test\child.vhdx" PARENT="c:\test\test.vhdx"
CREATE VDISK FILE="c:\test\test.vhd" MAXIMUM=1000 SD="D:P(A;;GA;;;WD)"
CREATE VDISK FILE="c:\test\new.vhdx" SOURCE="c:\test\test.vhd"
Another example for an EFI / UEFI system in diskpart (you can find similar ones in the sample scripts for MBR partitions. This one is for 150GB obviously, zero-indexed, so it's a perfect 150GB, not more not less. You can set it to whatever you want using the above examples, although MSR is almost always going to be 500MB, and the EFI partition will be something in the range of 100-128MB, depending on bootloader complexity, menu options, if you have a multi-boot setup I mean. Most of the time, 100MB is good enough for the system partition, unless of course you have some type of Unix / Linux multi-boot setup utilizing a complex GRUB 2.x menu with RHEL, Solaris, alongside the Windows 10 / 11 bootloader, etc. I'm sure even then 100mb is probably fine (the example below utilizes binary prefixes.)
list disk
select disk <enter disk number>
list partition
clean
convert gpt
create partition efi size=100
create partition msr size=500
create partition primary size=153601
list volume
select volume <enter volume number>
assign letter=c
format fs=ntfs unit=4096 quick
Comparable Linux / Unix examples:
NEWFS: TB = {[(1099511627776 * Size in TB) + 1048576] / 512}
NEWFS: GB = {[(1073741824 * Size in GB) + 1048576] / 512}
1TB = 2147485696 sectors = 1048576.0MB ( cyl groups)
500GB = 1048578048 sectors = 512001.0MB ( cyl groups)
250GB = 524289024 sectors = 256001.0MB ( cyl groups)
150GB = 314574848 sectors = 153601.0MB ( cyl groups)
100GB = 209717248 sectors = 102401.0MB ( cyl groups)
50GB = 104859648 sectors = 51201.0MB ( cyl groups)
newfs -N -b4096 -f512 -i8192 –o space -s104859648 /dev/rdsk/c2t0d0p0
FDISK: 59616 cylinders - Cylinder blocks 131072 - 512 byte blocks (sectors)
1TB = 16385 cylinders {[(2^40) / (Cylinder Blocks * Sectors)]+1}
500GB = 8001 cylinders {[(2^30 * 500) / (Cylinder Blocks * Sector Size)]+1}
250GB = 4001 cylinders {[(2^30 * 250) / (Cylinder Blocks * Sector Size)]+1}
150GB = 2401 cylinders {[(2^30 * 150) / (Cylinder Blocks * Sector Size)]+1}
100GB = 1601 cylinders {[(2^30 * 100) / (Cylinder Blocks * Sector Size)]+1}
50GB = 801 cylinders {[(2^30 * 50) / (Cylinder Blocks * Sector Size)]+1}
Jan 17 2022 02:12 AM
If you were to use VirtualBox with Windows 10/11 Home [and a Virtual Hard Disk v2 (VHDX) image,] it would look like this, given VirtualBox for some odd reason doesn't recognize VHDX v2 images yet (even though it's an open specification at this point.)
VirtualBox Example: https://www.virtualbox.org/wiki/Downloads
C:
cd\VirtualBox
C:\Users\username\Desktop>wmic diskdrive list brief
Caption DeviceID Model Partitions Size
xxx xxxxxxxxxxxxxxx \\.\PHYSICALDRIVE0 xxxxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxx
xxx xxxxxxxxxxxxxxx \\.\PHYSICALDRIVE1 xxxxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxx
xxx xxxxxxxxxxxxxxx \\.\PHYSICALDRIVE2 xxxxxxxxxxxxxxxxxxxxxxxxx x xxxxxxxxxxxxx
VBoxManage internalcommands createrawvmdk -filename \VirtualBox\VMs\Win11_64_adk_imaging.vmdk -rawdisk \\.\PHYSICALDRIVE2
VBoxManage storageattach "Windows 11 (64-bit)" --storagectl "AHCI" --port 0 --device 0 --type hdd --medium \VirtualBox\VMs\Win11_64_adk_imaging.vmdk
VBoxManage internalcommands createrawvmdk -filename \VirtualBox\VMs\USB_DRIVE_WIN_64.vmdk -rawdisk \\.\PHYSICALDRIVE2
VBoxManage storageattach "Windows 10 (64-bit)" --storagectl "AHCI" --port 2 --device 0 --type hdd --medium \VirtualBox\VMs\USB_DRIVE_WIN_64.vmdk
"9.7.1. Using a Raw Host Hard Disk From a Guest" -> https://www.virtualbox.org/manual/ch09.html#rawdisk
"Chapter 8. VBoxManage" -> https://www.virtualbox.org/manual/ch08.html
"WMI Command-line Tools" -> https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-command-line-tools
The only caveat with this one, is if anything stops working you have to release the image from the VM in VirtualBox, and recreate it all over again via the console (given it's just a link when operating in RAW access mode.) It's better to dismount it in diskpart like this after you mount it, so the host operating system cannot see it (Windows,) but the guest operating system can still access it (the VM itself.)
PS C:\WINDOWS\system32> diskpart
Microsoft DiskPart version xx.x.xxxxx.xxx
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 9 Removable xxxx MB Healthy Offline
DISKPART> select volume 9
Volume 9 is the selected volume.
DISKPART> assign
DiskPart successfully assigned the drive letter or mount point.
DISKPART> automount disable
Automatic mounting of new volumes disabled.
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 9 F RAW Removable xxxx MB Healthy
DISKPART> remove letter=f dismount
DiskPart successfully removed the drive letter or mount point.
DiskPart successfully dismounted and offlined the volume.
DISKPART> exit
Leaving DiskPart...
PS C:\WINDOWS\system32>
Good Luck! Happy New Year as well! (Year of the Kitten.)