Use a controlled migration followed by partition consolidation. You can use the following process:
1. Establish the current disk configuration.
Open Disk Management by running diskmgmt.msc. Identify whether C: and D: are partitions on the same physical disk or on separate physical disks. Check the partition layout, available capacity and the presence of any EFI, Recovery or System partitions. This determines whether C: can be extended after removing D:. Do not make any partition changes at this stage.
2. Create an independent backup.
Before moving anything, connect an external drive with sufficient capacity to hold all data currently stored on D:. Create a complete backup of D:, including hidden files and folders. Verify that the backup contains the expected directory structure and that representative files can be opened. Do not treat OneDrive as your only backup because synchronization can propagate accidental deletions and unwanted changes.
3. Inventory the contents of D:.
Identify all personal data, including Documents, Downloads, Pictures, Videos, Desktop and any other folders you maintain. Also identify application-specific directories, virtual machines, development environments, databases and other data repositories. Determine which folders are already synchronized with OneDrive and which exist only locally. Pay particular attention to Windows special folders whose locations may have been redirected to D:.
4. Prepare OneDrive for the migration.
Check the current OneDrive folder location and synchronization status. Ensure that all required files have completed synchronization and that there are no pending uploads or synchronization errors. Files marked as online-only do not need to be downloaded before migration unless you intend to make independent local copies. If OneDrive itself is located on D:, plan to relocate it through OneDrive's own settings rather than manually moving its directory.
5. Move personal data to C:.
Create an appropriate directory structure on C: for your personal data. For example, you could use C:\Users\<username> for standard Windows user folders and C:\Data for other personal repositories. Move data using Windows folder relocation where applicable, rather than simply copying over existing Windows special folders. For Documents, Pictures, Downloads and other redirected folders, use the folder Properties, Location tab and Move option. For ordinary data directories, use File Explorer or Robocopy, preserving timestamps, permissions and directory structure where necessary.
6. Reconfigure application data locations.
Check applications that currently store data on D:. Update their configuration to reference the new locations on C:. This includes development environments, virtual machines, databases, backup applications and any applications with custom working directories. Do not manually relocate installed applications or their Program Files directories. Use application-specific migration or relocation procedures where necessary.
7. Reconfigure OneDrive if necessary.
If OneDrive currently resides on D:, unlink the PC through OneDrive settings, configure the new OneDrive location on C:, and reconnect the account. Carefully follow the relocation process to avoid creating duplicate synchronization directories or overwriting existing cloud content. Verify that OneDrive is synchronizing the intended folders and that Files On-Demand is configured as required.
8. Validate the migration.
Check that all personal folders point to their intended locations on C:. Compare the contents of the original D: directories against their new locations, including file counts and total sizes. Open representative files, test applications and verify OneDrive synchronisation. Check that no applications or scheduled tasks still reference D:. Keep the original D: contents untouched until these checks have been completed successfully.
9. Consolidate the partitions.
Once the migration is verified, and provided C: and D: are partitions on the same physical disk, you can remove the D: partition using Disk Management. Before doing so, confirm that D: does not contain boot, recovery or other system-critical data. Extend C: into the resulting unallocated space. Windows Disk Management requires the unallocated space to be immediately to the right of C: to extend it. If another partition is between C: and the unallocated space, a different partition-management approach may be necessary.
10. Perform final validation and retain the backup.
Restart Windows and verify that the system starts normally. Check your Windows user folders, applications and OneDrive synchronization again. Confirm that C: has the expected capacity and that no references to D: remain in your normal workflows. Retain the external backup until you have operated successfully with the consolidated configuration for a reasonable period.
Do not delete D: simply because its files appear to have been copied or synchronized. The migration should be treated as complete only after verifying the local copies, OneDrive synchronization and application dependencies.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin