I am experiencing an issue where the recovery partition is visible in “This PC” after restoring my PC from a disk image, which should not be the case. Before restoring the PC, I used DISKPART to remove the drive letter from the recovery partition. I want to prevent Windows from reassigning a letter to the recovery partition after restoring the PC from the disk image.
I am using Windows 10 (64-bit) version 1903 (May 2019 Update) and have a MBR disk with a Standard BIOS that does not support GPT disks. I have tried using the GUID method, but it does not work because I have an MBR disk. I have also tried using the “attributes volume set nodefaultdriveletter” command, but it does not have the desired effect as Windows continues to assign a drive letter to the recovery partition after the system restore.
I used the Windows 10 built-in “Backup and Restore (Windows 7)” utility to create an image of the “C” partition and used the Windows 10 version 1903 (May 2019 Update) installation CD to restore the system. I am unsure if this procedure changes the attributes of the recovery partition, but I have verified that the “nodefaultdriveletter” attribute remains even after the system is restored. However, the drive letter is still being reassigned to the recovery partition by Windows.
I have tested that both a logical recovery partition located within an extended partition and a primary recovery partition have the same behavior on my MBR disk. I have also determined that the startup task method may not always work as the volume number of the recovery partition can change depending on the devices connected at the time of the restore, and it is also not useful to identify a volume based on certain features as there can be multiple volumes with the same characteristics and volumes can have the same label even within a single disk. Since I have an MBR disk, the partitions cannot be uniquely identified using the GUID. The latest BIOS version supported by my motherboard does not have GPT disk support implemented.
3 Answers
Introduction
When restoring a Windows PC from a disk image, it is not uncommon for the recovery partition to reappear in “This PC” even after being removed using DISKPART. This can be frustrating as it takes up space and can cause confusion. In this blog post, we will explore different methods to prevent Windows from assigning a drive letter to the recovery partition after restoring the PC from a disk image.
Method 1: Using Disk Management
The first method to prevent Windows from assigning a drive letter to the recovery partition is by using Disk Management. Follow the steps below to remove the drive letter from the recovery partition:
1. Press the Windows key + X and select “Disk Management” from the menu.
2. Locate the recovery partition in the list of volumes. It will be labeled as “Recovery Partition” and may have a drive letter assigned to it.
3. Right-click on the recovery partition and select “Change Drive Letter and Paths.”
4. Select the drive letter assigned to the recovery partition and click “Remove.”
5. Click “Yes” to confirm the action.
6. The drive letter should now be removed, and the recovery partition should no longer be visible in “This PC.”
Method 2: Using Command Prompt
Another method to prevent Windows from assigning a drive letter to the recovery partition is by using Command Prompt. Follow the steps below to remove the drive letter from the recovery partition:
1. Press the Windows key + X and select “Command Prompt (Admin)” from the menu.
2. Type the following command and press Enter: “diskpart”
3. Type the following command and press Enter: “list volume”
4. Locate the recovery partition in the list of volumes. It will be labeled as “Recovery Partition” and may have a drive letter assigned to it.
5. Type the following command and press Enter: “select volume X” (replace X with the volume number of the recovery partition)
6. Type the following command and press Enter: “remove letter=X” (replace X with the drive letter assigned to the recovery partition)
7. The drive letter should now be removed, and the recovery partition should no longer be visible in “This PC.”
Method 3: Using DISM
DISM (Deployment Image Servicing and Management) is a command-line tool that can be used to service Windows images, including removing drive letters from recovery partitions. Follow the steps below to remove the drive letter from the recovery partition using DISM:
1. Press the Windows key + X and select “Command Prompt (Admin)” from the menu.
2. Type the following command and press Enter: “dism /get-wiminfo /wimfile:X:sourcesinstall.wim” (replace X with the drive letter of the Windows installation media)
3. Locate the index number of the Windows edition you are using. It will be listed under the “Index” column.
4. Type the following command and press Enter: “dism /mount-wim /wimfile:X:sourcesinstall.wim /index:X /mountdir:C:mount” (replace X with the index number and C:mount with the path to the mount directory)
5. Type the following command and press Enter: “dism /image:C:mount /get-packages”
6. Locate the package that contains the recovery partition driver. It will be labeled as “Microsoft-Windows-Deployment.”
7. Type the following command and press Enter: “dism /image:C:mount /remove-package /PackageName:PACKAGE_NAME” (replace PACKAGE_NAME with the name of the package that contains the recovery partition driver)
8. Type the following command and press Enter: “dism /unmount-wim /mountdir:C:mount /commit”
9. The drive letter should now be removed, and the recovery partition should no longer be visible in “This PC.”
Method 4: Using Registry Editor
The Registry Editor can be used to prevent Windows from assigning a drive letter to the recovery partition. Follow the steps below to remove the drive letter from the recovery partition using Registry Editor:
1. Press the Windows key + R and type “regedit” in the Run dialog box. Press Enter.
2. Navigate to the following key: “HKEY_LOCAL_MACHINESYSTEMMountedDevices”
3. Locate the entry that corresponds to the recovery partition. It will be labeled as “DosDevicesDRIVE_LETTER:” (replace DRIVE_LETTER with the drive letter assigned to the recovery partition)
4. Right-click on the entry and select “Delete.”
5. Click “Yes” to confirm the action.
6. The drive letter should now be removed, and the recovery partition should no longer be visible in “This PC.”
Method 5: Using PowerShell
PowerShell is a powerful command-line tool that can be used to automate tasks in Windows. Follow the steps below to remove the drive letter from the recovery partition using PowerShell:
1. Press the Windows key + X and select “Windows PowerShell (Admin)” from the menu.
2. Type the following command and press Enter: “$drive = Get-Partition -DriveLetter DRIVE_LETTER” (replace DRIVE_LETTER with the drive letter assigned to the recovery partition)
3. Type the following command and press Enter: “$drive | Set-Partition -NoDefaultDriveLetter”
4. The drive letter should now be removed, and the recovery partition should no longer be visible in “This PC.”
Conclusion
In this blog post, we have explored different methods to prevent Windows from assigning a drive letter to the recovery partition after restoring the PC from a disk image. These methods include using Disk Management, Command Prompt, DISM, Registry Editor, and PowerShell. By following these steps, you can ensure that the recovery partition remains hidden and does not take up unnecessary space in “This PC.”
To prevent Windows from restoring a letter to the recovery partition after restoring your PC from a disk image, you can try the following steps:
- Open the command prompt with administrative privileges.
- Type the following command and press Enter:
diskpart
- Type the following command and press Enter:
list volume
- Identify the volume number of the recovery partition by looking at the “Ltr” column.
- Type the following command and press Enter:
select volume <volume number>
- Type the following command and press Enter:
remove letter=<drive letter>
This should remove the drive letter from the recovery partition and prevent Windows from assigning it again after a system restore. If the drive letter is still being reassigned, you may need to check for any startup tasks or services that may be causing this behavior. You can try disabling any unnecessary startup tasks or services to see if this resolves the issue.
Additionally, if you are using the “Backup and Restore (Windows 7)” utility to create an image of your system, you may want to consider using a different backup and restore utility that allows you to customize the settings and options during the restore process. This may give you more control over how the recovery partition is handled during the restore process.
To ensure that the Windows 10 utility “Backup and Restore (Windows 7)” could detect my recovery partition, I assigned a letter to it before creating a backup. After creating the backup, I removed the letter from the recovery partition and moved the backup to a different partition. Then, I reassigned a letter to the recovery partition and restored the backup.
I found that after restoring the backup, the letter was not reassigned to the recovery partition. I also discovered that if I made changes to the number of partitions or the letter assignments on the C drive after creating the backup, the restore would not work.
Based on these observations, I concluded that even when creating a single partition backup, the backup retains information about the number of partitions and the letter assignments of those partitions, even if it does not restore the labels on all the volumes.
Additionally, if I had not removed the letter from the recovery partition after the restore, Windows 10 would have removed it. This method also works for GPT disks.
It is a good idea to use DISKPART to set the recovery partition with id=27 to identify it and prevent inexperienced users from formatting it or deleting it through Disk Management.