Backing Up an SD Card or Hard Drive to A VHD File (Virtual Hard Disk)


The Microsoft Virtual Hard Disk – An Ideal Backup Image Format

Microsoft’s Virtual Hard Disks (VHD) are files that look like hard drives to a computer’s operating system. They are typically used for installing file systems on when working with virtual machines (including Microsoft’s own Hyper-V or Oracle’s Virtualbox) but can also be attached and used on a physical Windows 10 box so the Windows machine treats the file as a hard drive. As such, they are ideal to clone physical hard drives to as a method of backup. They work particularly well with multi-partitioned drives or SD cards, such as those used with Raspberry Pis. A full clone image works well over just copying files as it preserves the partitions and bootable formatting.

Backing Up A Raspberry Pi Drive to A VHD Image – Step By Step

If you have a Windows 10 computer, here’s a relatively simple way you can backup SD cards to a browserable VHD disk image that is not proprietary to your backup software.

  1. Attach the hard drive you are duplicating to your Windows computer. In my case I have a 150 GB external USB hard drive which serves as my Pi’s bootable drive. I detach that from the PI and insert the USB connection to my Windows computer.

    If you have an SD card you would need to attach the SD Card to you Windows computer using an SD Card reader.

  2. Open up Disk Management (right click on the Windows Icon in lower left corner->Disk Management). Alternatively press Windows Key-R, then type “diskmgmt.msc” and press enter.

  4. Select “Action” in the menu, then “Create VHD”. If the Action menu items are grey, click first on something in the Disk Management window and then try again.

  5. When the “Create and Attach Virtual Hard Disk” window opens, click “Browse” to name your Virtual Hard Drive file and select the folder where it will be located. In addition, select the options shown below (VHD hard disk format, Dynamic/Expanding). The Dynamic disk option will save space on your physical hard drive . Fill in the “Virtual Hard Disk Size” with the size of the drive you are duplicating. Below I am duplicating my Raspberry PI’s 149.05 GB external USB drive that has a 256 MB bootable Fat 32 partition along with a 148.80 GB linux partition. If you are duplicating your PI’s SD card it will look similar but will be sized differently – it will have a FAT32 partition, as well as “Healthy (Primary Partition”) that is your Linux partition. Below is my example – the drive on the left is the source drive. The new Virtual Hard Disk we are creating will be the target cloned drive.

  6. When done select “OK”. You will see new drive in your Disk Management showing an “Unallocated” partition. On my system it shows up as Disk 8:

  7. Now open up your drive cloning software. I use the free MiniTool ShadowMaker Free 3.5. It is an excellent free backup tool for windows and includes a cloning tool.
  8. In Shadowmaker, I open the program and select Tools->Clone.

  9. I then select the Source (USB drive) and the target Destination (the unallocated Virtual Disk):

  10. Then Press “Ok” and confirm that the target Disk will be destroyed:

  11. ShadowMaker will then start cloning the disk (my clone took about an hour and a half):

  12. When done, ShadowMaker will ask if you want to shutdown, say “NO”:

  13. Now open up Disk Management again and confirm that the Virtual Drive is now correctly formatted and shows the partitions:

  14. Now, right click on the disk number (i.e., in the example, “Disk 7”) and select “Detach Virtual Drive”.

  15. You are done. The virtual drive file is now on your backup media having the extension “VHD”.

Restoring Entire Drive or Retrieving Backed Up Files

Anytime you need to restore it you just need to re-attach it and repeat the process, but reverse the cloning so the VHD is cloned to the physical hard disk. If you just need to copy some files off the VHD image, you can attach it and use it like any other hard drive, copying files off using Explorer. As an additional bonus, you can also attach the virtual drive to most virtual machines, including Oracle’s Virtual Box. You can also attach to a WSL session (at least WSL2) by attaching the disk in Disk Manager, assigning a letter to the Linux partition using Ext2 Filesystem Driver for Windows, and then opening WSL and typing “cd /mnt/[drive letter]”.

Ultimate Ad-Free Browsing

geoff-brooks unsplash - Advertisement Clutter

Browser getting cluttered with Ads ? Want to achieve a nearly total ad-free browsing experience (at least on your desktop) ?

Use Pi-Hole To Block All Network Devices

Install Pi-Hole . Will work for all devices in your home except those using cellular data.

Block Google Ads in Search Results Using Violent Monkey Scripts

Pi-Hole will cause ads appearing in your google search results to have deadlinks. Although they are blocked, they still appear and one tends to click on them as they appear on the top of the results. To remove them entirely you need to have the web page modified on the fly which is what the Violent Monkey extension (available for Firefox and Chrome) allows you to do by installation of customized javascript. Install the Violent Monkey extension, then install the user script Hide Ads in Google Search Results.

Block Twitter Ads

Install the following Violent Monkey User Scripts to block Twitter Ads:

Also Hide Ads on Facebook

There are other similar scripts on Greasy Fork and

Keep in mind security concerns – ready the warning on the sitie.

Use Firefox, a Privacy Focused Browser – Firefox

Firefox is much better than it used to be and in my opinion better than Chrome in many ways. Google is never going to give up on Ads so will never allow a user to totally block ads while Firefox has become more privacy focused.

Install the Firefox Add On Ublock Origin

Ublock Origin is one of the best ad-blockers out there.

Now go browse the web!

Easily Remove GPS Location from Photographs

GPS Mobile Phone

Your GPS Data is Stamped on Your Mobile Photos

Most cell phones nowadays stamp each digital photograph with the GPS coordinates of where the photo was taken. If you upload this to Google Photos, google will happily pinpoint the location on Google Maps with a click or two (and some applications may show this information when you view the photo). In addition the photograph will have other metadata such as camera make and model, etc. If you are going to share the photo with others or post it publicly, many times you don’t want this information, particularly, your location information, posted to the web.

Exiftool offers an easy and straightforward method of stripping metadata and is available for Windows, Mac, and Linux.

Backup Your Photos Before Stripping Meta Data

Make sure you have a backup of all of your original photos with all metadata before you start and only strip information from a copy of the photo (although by default it also makes a backup of the photo, adding “_original” to the extension).

Using Exiftool To Strip Meta-Data

  1. View All Meta Data in Photo

  2. On command line (in windows use CMD):

    This produces output like this:

  3. Remove Only the Location Information from Photo

  4. Remove Location Plus (caution, will strip other useful information)

  5. Adding an extra flag makes sure other xmp information that may contain gps location is also stripped. Unfortunately, this will also remove other information you may want to keep:

  6. Remove All Metadata from Photo

  7. Type the following

    Same photo as above, but with ll exif metadata information stripped, leaving only file and technical information:

    For the full set of features and documentation see the Exiftool website.