You are on page 1of 12

Κάντε τον υπολογιστή σας με Windows 10 ευέλικτο

Κάντε τον υπολογιστή σας με Windows 10


ευέλικτο χρησιμοποιώντας την εγγενή
εκκίνηση VHDX
Ενώ εργάζονται σε ένα έργο τις προάλλες βρήκα τον εαυτό μου χρειάζεται να
εγκαταστήσετε διάφορα εργαλεία. Πραγματικά δεν ήθελα να εγκαταστήσετε ΣΤΙΒ ΤΖΌΡΝΤΑΛ
τα εργαλεία στην κύρια, εγγενή παρουσία των Windows μου, δεδομένου ότι θα 28 Αυγούστου 2018
ήθελα μόνο τους για το έργο. Δεδομένου ότι τα Windows δεν παρέχει έναν Επικεφαλής Τεχνολόγος
εύκολο τρόπο για να επαναφέρετε ολόκληρο το σύστημα, αποφάσισα να
διερευνήσει ένα χαρακτηριστικό που έχει μέρος των Windows από τα Windows
7 - μητρική εκκίνηση από VHD(X). Εάν δεν είστε εξοικειωμένοι με την έννοια,
Ετικέτες
σας επιτρέπει να διπλή εκκίνηση ενός συστήματος των Windows χωρίς να
χρειάζεται να ασχοληθεί με την ακατάστατη και δύσκολη έννοια της
BCD Εγγενής εκκίνηση
στεγανοποίησης. Μπορείτε να δημιουργήσετε ένα αρχείο VHD(X) στην
κανονική, εγγενή παρουσία των Windows που περιέχει μια ξεχωριστή Vhdx Windows

παρουσία των Windows (ενδεχομένως μια διαφορετική έκδοση) και στη Windows 10
συνέχεια να πείτε το πρόγραμμα φόρτωσης εκκίνησης για εκκίνηση από το
αρχείο VHD(X) αντί για την κανονική μονάδα δίσκου C: .

Για αυτό το έργο, ήθελα να πάω ένα βήμα παραπέρα από την εκκίνηση από
έναν εικονικό δίσκο. Ήθελα να εκκινήσετε από μια αλυσίδα VHD(X) - το ίδιο με
ένα στιγμιότυπο εικονικής μηχανής στην πλατφόρμα εικονικής διαμόρφωσης
της επιλογής σας. Με αυτό, μπορώ να έχω ένα μόνο για ανάγνωση γονέα
VHD(X) που μπορώ να χρησιμοποιήσω για πολλές παρουσίες και ανάγνωση-
εγγραφή differencing δίσκους ή θυγατρικό VHD(X)es που θα περιέχουν τις
διαφορές από το γονικό δίσκο. Έτσι, στο τέλος, θα έχω ένα γονέα VHD(X) που
περιέχει τα Windows 10, και ένα differencing δίσκο που περιέχει τα εργαλεία
ειδικά για αυτό το έργο, και ο συνδυασμός των δύο VHD(X) αρχεία θα
αποτελούν το C: μονάδα δίσκου για την εκτέλεση των Windows παράδειγμα.
Αυτό είναι το τμήμα που τεκμηριώνεται πιο αραιά στο web και η τεκμηρίωση
που είναι διαθέσιμη είναι συνήθως εκτός αυτού του περιβάλλοντος.

Μερικοί από εσάς μπορεί να αναρωτιούνται γιατί συνεχίζω σημειώνοντας


VHD(X) αντί vhd. VHD ήταν μια καλή πρώτη ανάπτυξη μιας προδιαγραφής
εικονικού σκληρού δίσκου, αλλά είχε ορισμένους περιορισμούς, όπως ένα όριο
χωρητικότητας 2TB. Κατά την ανάπτυξη του Hyper-V, η Microsoft αποφάσισε
να δημιουργήσει μια νέα προδιαγραφή που ξεπέρασε τους περιορισμούς του
VHD. Έτσι, VHDX εξυπηρετεί τον ίδιο σκοπό, αλλά είναι πιο σύγχρονο για να
χειριστεί σωστά τα καθήκοντα εικονικής διαμόρφωσης που απαιτείται / ήθελε.
Ορισμένες από τις δυνατότητες του VHDX είναι χωρητικότητα 64 TB, μέγεθος
λογικού τομέα 4K (για αύξηση των επιδόσεων), προστασία από καταστροφή
και δυνατότητα κοινής χρήσης (για σενάρια συμπλέγματος).

Τα Windows 7 σας επέτρεψαν να εκκινήσετε από VHD, αλλά δεν γνωρίζει


τίποτα για VHDX, η οποία εισήχθη στο χρονικό πλαίσιο των Windows 8 και
Windows Server 2012. Έτσι, σήμερα, αν θέλετε να εκκινήσετε τα Windows 10
από ένα εικονικό αρχείο δίσκου, θα πρέπει να χρησιμοποιήσετε VHDX. Για το
υπόλοιπο αυτού του άρθρου, θα είμαι απλά χρησιμοποιώντας VHDX
δεδομένου ότι τεχνικά, VHD δεν ισχύει.

Ας σκάψουμε στα ζιζάνια...

Για αυτή τη δραστηριότητα θα χρειαστούμε μερικά πράγματα:

Εγκατάσταση πολυμέσων των Windows 10


Μετατροπή-WindowsImage.ps1
EasyBCD (προαιρετικό)

Βήμα 1
Το πρώτο πράγμα που πρέπει να κάνουμε είναι το ισοδύναμο μιας
εγκατάστασης των Windows σε ένα αρχείο VHDX. Για αυτό, ρίξτε μια ματιά στο
Convert-WindowsImage.ps1 από Pronichkin, που βρίσκεται στη συλλογή
Microsoft TechNet. Αυτή η δέσμη ενεργειών λαμβάνει τα Windows για να
εγκαταστήσετε τα μέσα αποθήκευσης ως είσοδο και εξάγει ένα αρχείο VHDX
που περιέχει το ισοδύναμο του τι το πρόγραμμα εγκατάστασης θα είχε κάνει.
Μόλις ολοκληρωθεί θα έχετε ένα αρχείο VHDX που είναι έτοιμο για την πρώτη
εκκίνηση.

Πριν το εκτελέσετε, υπάρχει μια τροποποίηση ζευγάρι που πρέπει να κάνετε. Η


τελευταία έκδοση των Windows 10 έχει μερικές αλλαγές που σπάνε τη δέσμη
ενεργειών (από τις 28/8/2018). Αν θέλετε να διαβάσετε σχετικά με τις
λεπτομέρειες, μπορείτε να δείτε την καρτέλα Q και A της ίδιας σελίδας. Κάντε
λήψη της δέσμης ενεργειών, εκκινήστε το PowerShell ISE *AS
ADMINISTRATOR*και ανοίξτε τη δέσμη ενεργειών για επεξεργασία. Κάντε τις
ακόλουθες αλλαγές:

γραμμή 4207:

από: $drive = $(Get-Partition -Disk $disk). AccessPaths[0]


σε: $drive = $(Get-Partition -Disk $disk)[0]. AccessPaths[0]

γραμμή 4216:

από: $driveSystem = $(Get-Partition -Disk $disk). AccessPaths[1]


σε: $driveSystem = $(Get-Partition -Disk $disk)[1]. Διαδρομές
πρόσβασης[0]

γραμμή 4220:

από: $drive = $(Get-Partition -Disk $disk). AccessPaths[2]


σε: $drive = $(Get-Partition -Disk $disk)[2]. Διαδρομές πρόσβασης[0]

γραμμή 4229:

από: $drive = $(Get-Partition -Disk $disk). AccessPaths[1]


σε: $drive = $(Get-Partition -Disk $disk)[1]. Διαδρομές πρόσβασης[0]

Αποθηκεύστε το αρχείο. Στη συνέχεια, στο παράθυρο κελύφους του IE


εκτελέστε τα εξής:

PS C:\Windows\system32> cd <διαδρομή προς δέσμη ενεργειών>


PS C:\Users\jordahl\Downloads> Set-ExecutionPolicy Χωρίς περιορισμούς
-Εμβέλεια Τοπικής ασφάλειας
PS C:\Users\jordahl\Downloads> . .\Μετατροπή-WindowsImage.ps1

(Αυτό είναι dot-space-dot-backslash στην αρχή εκεί)

Αυτές οι εντολές άλλαξαν τον κατάλογο εργασίας στον κατάλογο όπου


βρίσκεται το σενάριο, χαλάρωσε τους περιορισμούς δέσμης ενεργειών ώστε
να μπορούμε πραγματικά να εκτελέσετε το σενάριο, και φορτώνονται η
λειτουργία Μετατροπή-WindowsImage στη μνήμη. Τώρα πρέπει να τρέξουμε τη
λειτουργία, και οι παράμετροι να ποικίλουν ανάλογα με ποιο δίσκο
παραθύρων installer χρησιμοποιείτε. Μια γρήγορη σημείωση σχετικά με τη
δέσμη ενεργειών – δεν φαίνεται να της αρέσει η χρήση μη τοπικών
διαδρομών.

Εάν χρησιμοποιείτε ένα κανονικό, μία έκδοση εγκατάσταση δίσκου, στη


συνέχεια, χρησιμοποιήστε την ακόλουθη εντολή:

PS C:\Users\jordahl\Downloads> Convert-WindowsImage -VHDFormat VHDX -


SizeBytes 100GB -BCDinVHD NativeBoot -ExpandOnNativeBoot:$false -
SourcePath <διαδρομή προς iso>\<iso Όνομα>.iso -VHDPath <διαδρομή για
αποθήκευση vhdx>\<vxhd&name;gthdx

Εάν χρησιμοποιείτε δίσκο εγκατάστασης πολλών εκδόσεων, προσθέστε την


παράμετρο Edition:

PS C:\Χρήστες\jordahl\Λήψεις> Μετατροπή-WindowsImage -VHDFormat


VHDX -SizeBytes 100GB -BCDinVHD NativeBoot -ExpandOnNativeBoot:$false
-SourcePath <διαδρομή προς το iso>\<iso Όνομα>.iso -Έκδοση <έκδοση> -
VHDPath <διαδρομή για να αποθηκεύσετε το όνομα vhdx>\<vhdx όνομα>

Αυτή η διαδικασία θα διαρκέσει λίγο και θα πρέπει να δείτε κάτι παρόμοιο με


το ακόλουθο αποτέλεσμα:

Windows(R) Εικόνα σε εικονικό μετατροπέα σκληρού δίσκου


για Windows(R) 10 Πνευματικά δικαιώματα (C) Microsoft Corporation. Όλα
τα δικαιώματα διατηρούνται.
Έκδοση 10.0.9000.0.amd64fre.fbl_core1_hyp_dev(mikekol).141224-3000
BetaINFO : Άνοιγμα ISO en_windows_10_ent.iso ...
ΠΛΗΡΟΦΟΡΙΕΣ: Ψάχνετε για D:\sources\install.wim... ΠΛΗΡΟΦΟΡΙΕΣ :
Επιλεγμένη εικόνα 3 (Επιχείρηση)...
ΠΛΗΡΟΦΟΡΙΕΣ : Δημιουργία αραιού δίσκου...
ΠΛΗΡΟΦΟΡΙΕΣ : Επισύναψη VHDX ...
ΠΛΗΡΟΦΟΡΙΕΣ : Δίσκος που προετοιμάσατε με GPT...
ΠΛΗΡΟΦΟΡΙΕΣ: Δίσκος διαμερισμένο

ΠΛΗΡΟΦΟΡΙΕΣ: Διαμέρισμα συστήματος που δημιουργήθηκε


ΠΛΗΡΟΦΟΡΙΕΣ : Boot Partition δημιουργήθηκε
ΠΛΗΡΟΦΟΡΙΕΣ: Τόμος συστήματος μορφοποιημένος (με DiskPart)...
ΠΛΗΡΟΦΟΡΙΕΣ : Ένταση εκκίνησης μορφοποιημένος (με μορφοποίηση
τόμου)...
ΠΛΗΡΟΦΟΡΙΕΣ : Η διαδρομή πρόσβασης (E:\) έχει αντιστοιχιστεί στον
τόμο συστήματος...
ΠΛΗΡΟΦΟΡΙΕΣ : Η διαδρομή της Access (F:\) έχει αντιστοιχιστεί στον τόμο
εκκίνησης...
ΠΛΗΡΟΦΟΡΙΕΣ : Εφαρμογή της εικόνας σε VHDX. Αυτό μπορεί να πάρει
λίγο χρόνο...
ΠΛΗΡΟΦΟΡΙΕΣ : Υπογραφή δίσκου...
ΠΛΗΡΟΦΟΡΙΕΣ : Η εικόνα εφαρμόστηκε. Κάνοντας την εικόνα με
δυνατότητα εκκίνησης...
ΠΛΗΡΟΦΟΡΙΕΣ: Η μονάδα δίσκου είναι με δυνατότητα εκκίνησης.
Καθαρίζω...
ΠΛΗΡΟΦΟΡΙΕΣ : Κλείσιμο VHDX ... ΠΛΗΡΟΦΟΡΙΕΣ : Κλείσιμο εικόνας των
Windows...
ΠΛΗΡΟΦΟΡΙΕΣ: Κλείσιμο ISO ...
ΠΛΗΡΟΦΟΡΙΕΣ: Τέλος.

Step 2
The VHDX le now contains Windows in a state that’s similar to when the Windows
installer is about to reboot into the newly installed OS. So we’re at the pre- rst-
boot stage. In this state, the newly installed Windows has not yet discovered
hardware or installed speci c drivers. If your plan is to be able to use this VHDX on
multiple, heterogeneous platforms, now’s the time to copy it to an archive location
where you can pull it from later.

Step 3
Let’s now move the VHDX le that you’ll use to boot your machine to a more
dedicated place. In my case, I created a folder at C:\VHDs and use that as the home
for the master VHDX as well as any children I create.

Step 4
Almost time for rst boot. At this point, I’m believing that you’ve created a backup
copy of the VHDX le somewhere else so that you can use the same master for
multiple physical machines. Now it’s time to boot the local VHDX and make it
machine speci c. To do this we need to modify the boot con guration of the
physical machine; speci cally, we need to modify the BCD which stands for Boot
Con guration Data. For this process, I use EasyBCD and the following process will
document it. If you’d prefer to drop to the CLI and modify the BCD manually, you
can nd some good info on a similar process here.

After installing EasyBCD, launch it. If you’re on a newer machine, the rst thing
you’re greeted with is the following:

There are two modes that a machine can use to boot, Legacy BIOS and UEFI. New
machines use UEFI and when in use that message will pop up. It doesn’t affect
what we’re doing here, so we can click OK. If you’re curious, the Help button will
give you all the details on the differences between the two modes with respect to
con guring the BCD. After clicking OK you’re presented with the main window:

You’ll note that there’s a single entry in the BCD. Anytime I’m dealing with the
booting process for a machine I want to be careful and create backups along the
way. So the rst thing we’ll do is to backup the current BCD. Click the BCD
Backup/Repair button which presents this:
Enter a le path into the rst File eld under Backup and Restore Bootloader
Settings and click Backup Settings. In the future, if you want to restore back to
defaults, use the second File eld and the Restore Backup button. One thing to
note, AFTER CLICKING A BUTTON IN EasyBCD, WAIT FOR THE RESULT MESSAGE IN
THE STATUS BAR OF THE WINDOW BEFORE MOVING ON!

Now we need to create the new entry for our parent VHDX le. Click the Add New
Entry button:

EasyBCD can be used to con gure boot for a lot of possibilities. We’re just going to
use the bottom pane, speci cally the Disk Image tab. Enter whatever name you
want to be in the BCD, nd the VHDX le you created and moved to its permanent
home (C:\VHDs maybe?) and click Add Entry. After seeing the success message in
the status bar, click on View Settings:
We now have two entries in our BCD. But wait! Our second entry is named correctly
but it looks like it’s going to boot the same Windows instance as entry one.
EasyBCD doesn’t show enough info here to be clear when it comes to booting from
virtual disks. If you click on the Detailed (Debug Mode) radio button under Display
Mode we’ll get a better view:

This view gives us the full path to our VHDX le, so it really IS different than entry
one.

Step 5
Now’s the moment of truth! Time to boot into our new OS. During the reboot
process you’ll see a new screen similar to the following before anything actually
boots:
Click the entry for your VHDX. This will start the rst boot process with the new
Windows instance in the VHDX. Please note that THE FIRST BOOT PROCESS
REQUIRES A REBOOT, AT WHICH POINT YOU NEED TO CLICK THE SAME ENTRY
AGAIN so you don’t boot into your main Windows install. If you missed it, just
reboot again and select your VHDX entry. Windows will take you through the
normal post-install steps.

Once you’re up and running and at the desktop you’ll want to do a few things. At
this point, you want to make any changes to the install that you want to persist
with the parent OS. This could/should include some or all of the following:

Change the machine name


Install Windows updates
Install any applications that you would want in all your child VHDX instances

Basically, you want to make all permanent changes at this point. Changing things
in this VHDX le later is problematic, so try to be thorough. Once complete, reboot
back into your main, native Windows install.

Step 6
Now we’re going to create our VHDX chain. To do this we need to be at AN
ADMINISTRATIVE COMMAND PROMPT. I’m going to use PowerShell. Once open,
run disk part. Now here’s the trick. Using the following command we’ll be creating
a child VHDX le that’s linked to the VHDX parent we just created:

create vdisk le=”c:\vhds\Windows 10 Child.vhdx” type=expandable


parent=”c:\vhds\Windows 10 Parent.vhdx”

As a safeguard, let’s make our parent VHDX read-only. In Windows Explorer get the
properties of your parent VHDX and check the Read-Only box and click OK.
Step 7
Now that we’ve got our chain created, we need to go tweak the BCD again. Go back
into EasyBCD and this time we’re going to remove the parent VHDX entry and add
an entry for our child VHDX.

This time when we look, the Overview mode properly shows the path to our Parent
VHDX – odd! Moving along… Click the Edit Boot Menu button, highlight your
Windows 10 Parent entry and click the Delete button:
Now click the Add New Entry button, enter whatever name you want to be in the
BCD, nd the child VHDX le you created (C:\VHDs maybe?) and click Add Entry.

Now we’ll go back to the Detailed view mode of View Settings and validate that
our child is in the BCD:
Step 8
And we’re golden! Now you can restart into your new child VHDX le.

Anything you install from this point will be stored in your child VHDX. If you want
to roll back to default, delete the child VHDX and create a new one. To avoid
repeatedly going into diskpart, I’ve created an empty child that I just copy
whenever I want a new environment.

Something to note that bit me. By default, when Windows boots a VHD(X) le
natively, it tries to “expand” or allocate the entire size of the virtual disk on the
physical disk. You’ll clearly notice it if you try to boot the VHDX and it blue screens
saying there’s not enough disk space. In the Convert-WindowsImage script, there’s
an ExpandOnNativeBoot parameter that I’ve used in the commands above so that
you can run, essentially in thin provisioned mode. If that wasn’t set, or Microsoft
changes code and things stop working after an update, that’s a good rst place to
start looking.

One more thing to note is the use of the BCDinVHD parameter that removes the
BCD element from the VHDX. This will cause problems if you were to try to use this
image with Hyper-V.

Please let me know how this works for you!

TOP COMMENTS
texas.ex
Hello:
I attempted to complete this process, changed the Function Convert-WindowsImage as
directed, but there was still an error. I think perhaps Windows 10 Version 1909 must have
“broken” the function again. Has anyone been successful in performing this process with this
version of Windows 10? If so, were additional changes made?
Thanks in advance for any help you can provide.
Louis M. Ayers
Texas.Ex@btinternet.com

Participants:

Continue the discussion:

Let's Innovate Together C O N TA CT U S

Just ask us how we can make a difference for you today.

Technology with a Human Touch

HEADQUARTERS LOCATIONS

770 The City Drive S. Orange, CA


Suite 5300
Orange, CA 92868 Houston, TX

CONTACT

CBTinfo@cbtechinc.com

888-241-7585

PRACTICE AREAS ABOUT US

Industrial IoT About CBT

HPC and Analytics Achievements

Hybrid IT Our Founder – Kelly Ireland

IT Supply Chain Optimization Blog

CBT Events
INNOVATIONS
Industry Trends
Asset Integrity Management
Careers with CBT
Condition Monitoring & Predictive Maintenance
Quality Requirements & Certi cations
Connected Worker
Connected Worker Glossary
Video as a Sensor

PARTNERS
Key Partners

CONTRACTS

Contracts

Copyright © 2021 CBT, Inc. Privacy Policy

You might also like