DevOps
How to Create and Back Up a VHD on Microsoft Windows 11 for Cross-Platform Virtual Machine Development
Nnamdi Okpala Dev.to (EN Zone)
2 views
By Nnamdi Michael Okpala
Cross-Platform Development on Microsoft Windows using VHD
Introduction
In today's world, virtual environments (e.g., Oracle VirtualBox, Microsoft Hyper-V) are vital for developers. They allow resource sharing and simultaneous data storage allocation to host and guest machines. To ensure the progress of work is secure, periodic backups are crucial.
This guide systematically explores methods to back up and share data between Kubuntu on Oracle VirtualBox (Guest OS) and Microsoft Windows 11 (Host OS). These steps are useful for cross-platform tool and app development for Windows, macOS, and Linux.
Although focused on Windows 11 and Kubuntu, these methods apply to Windows 10+ with Debian/Ubuntu systems using Winget (winget) and APT (apt).
First Steps (Download and Install Software)
Install the following utilities to simplify the backup process:
NSSM: The Non-Sucking Service Manager enables easy management of Windows services.
Oracle VirtualBox (Optional): An open-source virtual machine emulator.
Winget: Microsoft’s command-line package manager for Windows.
Commands:
winget install -e --id NSSM.NSSM
winget install -e --id Oracle.VirtualBox
Run these in PowerShell, accepting terms during installation.
Creating a Virtual Hard Disk (VHD)
Open Windows Disk Management.
Create a new Virtual Hard Disk (VHD or VHDX).
Assign a drive letter (e.g., B for Backup).
Save the file in a dedicated directory.
Mount the VHD using Disk Management.
Periodically copy the VHD file to a separate location for redundancy.
Using VSS for VHD Backups
Volume Shadow Copy Service (VSS) allows you to create and manage snapshots of your volumes, including those containing VHDs.
Key Commands
1. List Existing Shadows:
vssadmin list shadows
2. Create a Shadow Copy:
vssadmin create shadow /for=C:
Replace C: with the drive containing the VHD.
3. Delete Old Shadows:
vssadmin delete shadows /for=C: /oldest
4. Resize Shadow Storage:
vssadmin resize shadowstorage /for=C: /on=C: /maxsize=10GB
Adjust the maxsize parameter based on your storage needs.
Automating Snapshots
Use Task Scheduler to periodically run the vssadmin create shadow command.
Restoring from a Snapshot
Mount the shadow copy as a backup source:
mklink /d <Mount_Point> \?\GLOBALROOT\Device\HarddiskVolumeShadowCopy<Shadow_ID>\
Copy data from the mounted snapshot to your backup directory.
Setting Up NSSM for Automated Backup
Download NSSM and place it in a directory accessible from the command line.
Create a PowerShell script (BackupServiceScript.ps1) for backing up your VHD.
Register the script as a service using NSSM:
nssm install BackupService
Configure the parameters as follows:
Path: powershell.exe
Arguments: -ExecutionPolicy Bypass -File "C:\path\to\BackupServiceScript.ps1"
Read original: https://dev.to/okpalan/how-to-create-and-back-up-a-vhd-on-microsoft-windows-11-for-cross-platform-virtual-machine-3olj
← Previous
Agentic RAG vs Traditional RAG in .NET (2026) — When Each Wins, Semantic Kernel Code, Production Metrics
Next →
The Three Parallel Workstreams: How Design, Build, and Test Start on Day One Without Colliding
Related
Linux is the operating system for building AI agents
DevOps
4
DEV Community
Sogou Input Method CVE-2026-51990: One-Click RCE Deploys GRAYRABBIT
DevOps
6
DEV Community
People who have actually shipped an MCP server: what was the hardest part about it?
DevOps
1
Reddit r/webdev
More JFrog Artifactory Bugs Are Under Attack, and All Three Have Patches
DevOps
5
DevOps.com
Comments0
No comments yet — be the first