« Hyperv » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Ligne 70 : Ligne 70 :
* [https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/gg318055(v=ws.10)#step-12-prevent-the-vhd-from-expanding-to-its-full-size Prevent the VHD from expanding to its full size]<br>
* [https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/gg318055(v=ws.10)#step-12-prevent-the-vhd-from-expanding-to-its-full-size Prevent the VHD from expanding to its full size]<br>
{{boxx|HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FsDepends\Parameters}} → {{boxx|1=VirtualDiskExpandOnMount = 4}}
{{boxx|HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FsDepends\Parameters}} → {{boxx|1=VirtualDiskExpandOnMount = 4}}
= [https://docs.microsoft.com/en-us/archive/blogs/askcore/compacting-a-dynamically-expanding-virtual-hard-disk-in-windows-server-2012 Compact] =
Squeeze the empty bits out to reduce the amount of space consumes on host physical disk. It doesn't reduce the capacity of the guest disk.<br>
Prerequisites:
* defrag the drive
* does not work on fixed VHDX
* virtual hard disk has to be NTFS formatted
# Hyper-V manager - Edit disk
# Choose action - compact


= [https://superuser.com/questions/1211099/native-boot-vhd-deployed-operating-system-does-not-hibernate Hibernation] =
= [https://superuser.com/questions/1211099/native-boot-vhd-deployed-operating-system-does-not-hibernate Hibernation] =

Version du 16 octobre 2020 à 17:17

Activer Hyper-V

  1. Windows → Turn Windows Features on or off
  2. Cocher Hyper-V

Dossiers

Virtual machine configuration folder C:\ProgramData\Microsoft\Hyper-V
Checkpount store C:\Users\Public\Documents\Hyper-V\Virtual hard disks
Smart Paging folder C:\Users\Public\Documents\Hyper-V\Virtual hard disks
Storage folder C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks

Monter un lecteur hote

  1. Connect
  2. Fenêtre Connect to → Show Options
  3. onglet Local Resources → More → Drives → C:

Booter sur une machine virtuelle

Dos.svg
REM lancer diskpart
diskpart

list volume

REM ajouter le fichier vhdx
select vdisk file="C:\folder\windows.vhdx"
attach vdisk

REM changer la lettre de montage
select volume 3
assign letter=v

REM détacher un vdisk
select vdisk
select vdisk file="C:\folder\windows.vhdx"
detach vdisk
Ps.svg
# ajouter une nouvelle entrée au boot menu
bcdboot V:\Windows

# connaître l'id ("{default}" et "{current}" désignent les OS par défaut et courant)
bcdedit /v
# changer la description
bcdedit /set "{id}" description "Windows 10 (VHDX)"

# changer l'entrée par défaut
bcdedit /default "{id}"

# ne plus afficher le boot menu
bcdedit /timeout 0

# supprimer une entrée
bcdedit /delete "{id}"
Configurer le boot menu:
  • Windows + RSystemPropertiesAdvanced
  • Windows + Rmsconfig

VHD_BOOT_HOST_VOLUME NOT ENOUGH SPACE

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FsDepends\ParametersVirtualDiskExpandOnMount = 4

Compact

Squeeze the empty bits out to reduce the amount of space consumes on host physical disk. It doesn't reduce the capacity of the guest disk.
Prerequisites:

  • defrag the drive
  • does not work on fixed VHDX
  • virtual hard disk has to be NTFS formatted
  1. Hyper-V manager - Edit disk
  2. Choose action - compact

Hibernation

You cannot hibernate an operating system that runs on a VHD. However, sleep functionality is available.
Limitation of VHDX native boot

Erreurs

Property ‘MaxInternalSize’ does not exist in class ‘Msvm_VirtualHardDiskSettingData’

Le snapshot ne reconnait plus son parent.

Ps.svg
# essayer une première fois sans IgnoreIDMismatch
Set-VHD "C:\folder\Win10_snapshotId.avhdx" -ParentPath "C:\folder\Win10.vhdx" -IgnoreIDMismatch