Removal of Old Windows Installation From a Secondary HDD/SSD

Removal of Old Windows Installation From a Secondary HDD/SSD
You buy a new SSD (or HDD), install it as the primary disk in your system (desktop or laptop -- check laptop specs as not all laptops contain a second hard drive bay) - [the new disk is] known as disk 0; install Windows onto the new SSD/HDD; then are left with the old Windows installation on the secondary (or old) SSD/HDD (known as disk 1).

What do you do with it (the old drive/ the information/data on the old drive - now called the secondary disk) considering that you would like to use the 100+ GB of storage space that the old Windows installation is taking up? i.e., you want to remove the old Windows installation from the secondary drive (the old disk).

First off, if you do purchase a new SSD/HDD and plan to install Windows onto it, do not install the secondary drive yet (the old Windows boot drive) until after the installation of Windows is done on the new disk.

I recommend this so that Windows does not place any boot data/files onto the now second, old disk during Windows installation. If you have both disks installed during a new Windows installation and the old disk fails and needs to be replaced, you could be left with a real mess on your hands that could involve having to reinstall Windows again, thus losing all of your installed programs and other important folders and files that you need and/or want.

If there are files on the now old SSD/HDD disk that you want to keep, the easiest way is to copy such folders and files to an external USB drive or USB stick (or just make sure not to delete them until they have been copied to your new Windows installation disk after Windows installation). If you go the external USB route - Just make sure that the USB device is large enough to hold all of the files that you want saved. External USB drives and sticks are relatively cheap today, even compared to the same sized USB storage device of just 2-3 years ago.

Once that you have copied all of the folders and files over to the USB device that you want saved or if you decide that there is nothing from the old drive that you want to save, you can use Windows Disk Management (diskmgmt.msc - Create and format a hard disk partition) to format the drive (erase/delete ALL files - and create a single partition so that the old disk is then ready to accept new files written to it from your USB backup(s)) or use a 3rd party app like KillDisk - How to erase hard drive by Active@ KillDisk? Disk Eraser, Disk Wiper, Disk Format & Disk Sanitizer., which will perform a low-level format on the drive deleting every folder and file on the secondary drive by writing 0s and 1s over every byte of the old disk. It often performs this procedure several times to assure that the data on the disk is in fact not readable ever again - or recoverable.

After you have installed Windows onto your new SSD/HDD, plug the old drive back in (desktop computer) or install it in the secondary hard drive bay on your laptop. Go into Windows Disk Management (diskmgmt.msc) and assign a drive letter to it -
- Change a drive letter
- Assigning a Drive Letter to a Volume - Win32 apps

If the now-secondary drive/basic volume is too large and you want to create two or more smaller drives from it, use Windows' Disk Management's disk shrink utility - Shrink a basic volume

It is very easy to use and the documentation in the above link is very helpful. Be sure of your calculations, i.e., the number of drives and sizes of each that you want to end up with because reversing shrinking is much more difficult than shrinking the original disk is and in some cases does not always work.

For info, I have a 1 TB HDD that I shrank into two (2) 500 GB drives, assigning the letters a: and b: to them so that they appear first on a regular Windows/Files Explorer screen. I like having the two (2) smaller drives as it makes it easier for me to locate folders and files.

The other options that you have to remove an old Windows installation from a secondary disk is to install the drive after installing Windows and then delete unnecessary folders and files from it.

You can do this three (3) basic ways -
1. Windows/File Explorer
2. CMD Prompt Screen using folder and file deletion commands
3. A 3rd party app like Tree-Size Free - TreeSize Free | JAM Software

Starting with a basic listing of directories (folders) located in the root of the newly created secondary drive can help immensely as there are directories that have no personal files in them so you can start by deleting these immediately.

If using Windows/File Explorer, hold down the left SHIFT key while clicking on the folder or file that you wish to delete. You want to use this method because it bypasses the Recycle Bin and therefore permanently deletes the folder or file in question. Typically when you delete a folder or file, Windows simply moved it into the Recycle Bin in case you change your mind and want to restore it. You can use this method if you want to, but I find it easier and faster to just delete the files permanently. It is your call.

Here is a directory listing of my current c: drive, which will become a different drive letter at some point soon (as so far described in this tutorial) because this HP laptop is running Windows 8.1 x64 and I have purchased a new 1 TB SSD and plan to install Windows 10 x64 on to the SSD, then move the 1 TB HDD to the secondary drive bay (again - as so far described in this tutorial).


The folders and files that I plan to delete from the secondary hard drive (AFTER it becomes the secondary drive and the drive letter has been changed) -

NOTE: The drive letter listed is c:. The actual drive letter will be whatever drive letter that you have assigned to the old secondary drive via Disk Management.

Rich (BB code):
Volume in drive C is Windows 8.1 x64
Volume Serial Number is C8D9-F1EF

Directory of C:\

07/31/2014 11:40 PM $Recycle.Bin
11/23/2019 01:37 PM _jcgriff2_
07/25/2017 12:18 AM boot
08/22/2013 12:31 AM 427,680 bootmgr
06/18/2013 07:18 AM 1 BOOTNXT
03/02/2010 02:29 AM 65,549 BSOD_BATCH_BACKUP__03-02-2010--.zip
11/26/2019 11:59 AM GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
10/25/2019 12:33 PM 10,250,895,360 hiberfil.sys
03/15/2014 04:02 PM HP
08/26/2013 01:13 AM inetpub
11/07/2007 07:00 AM 843 install.ini
07/05/2019 03:33 PM Intel
11/24/2019 10:11 AM junctions
11/23/2019 01:36 PM MSDN - TechNet ISOs
06/06/2015 01:10 AM MSOCache
11/03/2017 09:30 PM 1,642 n.csv
12/03/2019 11:41 AM 10,194,604,032 pagefile.sys
03/16/2018 07:24 PM passwords
06/26/2014 09:19 PM PerfLogs
06/25/2019 03:40 PM Program Files
11/26/2019 11:55 AM Program Files (x86)
06/26/2019 01:43 PM ProgramData
12/20/2013 01:41 PM Recovery
07/11/2017 12:04 AM 20,892 services.htm
03/17/2019 02:43 PM 152,924 SIGVERIF.TXT
10/25/2019 12:33 PM 268,435,456 swapfile.sys
08/11/2019 01:04 PM SWSetup
12/07/2019 07:42 AM symbols
09/17/2019 09:32 AM SysInternals
12/20/2018 08:02 PM 1,024 SYSTAG.BIN
12/08/2019 07:34 AM System Volume Information
07/23/2017 11:46 PM SYSTEM.SAV
08/16/2019 12:24 PM 7,696 timezones_tzutil_slash_L1.txt
08/14/2019 02:03 PM 30,705,559 tree_c__08-14-2019x.log
04/15/2019 11:17 AM Users
11/07/2007 07:50 AM 1,927,956 VC_RED.cab
11/07/2007 07:00 AM 5,686 vcredist.bmp
12/06/2019 02:08 PM Windows
04/09/2019 04:06 PM wmi - tutorial
12/28/2018 05:31 PM ZeroReplyThreads

The yellow highlighted directories and files I plan to delete using CMD Prompt Screen line commands will be rolled up into a batch command file. I prefer it over Windows/File Explorer or the TreeSize app.

The easiest way to use CMD is to create a batch file rather than having to enter each and every DEL (delete) file command or RD (Remove Directory (folder)) command for every folder/file. A batch file is nothing more than a collection of CMD line commands which can be created using Notepad or your favorite text editor, thus saving time creating your batch file. Furthermore, you can of course use copy/paste, which will assure that you don't end up with spelling errors for folders and files.

An easy way to obtain a listing of just the names of the folders and files in the root directory is to use the /b switch with the DIR command.

Try this command from an
elevated Administrative CMD Prompt -

Rich (BB code):
dir c:\ /a /b /o:n >c:\0 & start notepad c:\0


Remember to change the drive letter c: to the new drive letter that you have assigned to the old secondary drive.

Be sure to run it from an Admin CMD prompt or not all of the files will be displayed in the output Notepad. Then you can add DEL or RD commands to each line that you wish to process.

This is the normal directory listing that we are used to seeing (print a copy out so that you'll know if you're dealing with a folder or file in the other, shorter Notepad file output) and have to use the DEL or RD command to process each line. You simply place either DEL or RD /s /q in front of each line to create the CMD batch file. If you end up using the wrong command, Windows will let you know it by giving off an error message in the CMD screen and the folder/file will not be deleted. For these errors, you can fix the batch file and run it again and again until all of the folders and files are gone.


Rich (BB code):
dir c:\ /a /o:n >c:\0 & start notepad c:\0

Remember to change the drive letter c: to the new drive letter that you have assigned to the old secondary drive.

You can of course use Windows/File Explorer as described above or an app like TreeSize (free edition) as well for folder and file deletion.

The Users folder is discussed below.



DELETION OF FOLDERS AND FILES ON THE SECONDARY DRIVE
One of the first things to do is to delete your secondary drive's Windows System Restore Points (if any exist).

Configure the System Restore space on your new secondary drive to zero bytes, which will result in the deletion of any remaining system restore points for the secondary drive.

Windows System Restore - Configure Restore Point Space (Windows 10,8.1, 8, 7 & Vista)

The following (3) files are a little different to work with and require special instructions (because they are considered to be "in use" and you cannot delete a file if it is "in use". They must be (should be) deleted as well because their total size can be massive. Their size is dependent on the amount of physical installed RAM that your system has. In general, the size of the page file can be equal to the amount of RAM that you have + a few hundred MB; the Hibernation File will generally be equal to 75% of the amount of physical RAM that you have installed. The Swapfile is usually < 500 MB.

The following "How To Geek" tutorials cover the deletion of these 3 files very well.

Delete the Swapfile (a:\swapfile.sys) - What is Swapfile.sys and How Do You Delete It?

Delete the Pagefile (a:\pagefile.sys) - What Is the Windows Page File, and Should You Disable It?

Delete the Hibernation File (a:\hiberfil.sys) - What Is hiberfil.sys and How Do I Delete It?

I would recommend that you not get hung up on the rhetoric about [the need for] these files because you simply do not need any of them on a secondary hard drive.

Your new Windows installation will manage all 3 on your c: drive just fine.


Here is the batch file for use if you chose to use the CMD option to delete the folders and files that are no longer needed on a secondary drive.

BATCH FILE - Copy the contents, to a Notepad, then change the folder names, file names and the drive letter. Save the file on your Desktop or Documents as a.bat or whatever name you choose to use.

After editing it and saving it, to run it - RIGHT-click on a.bat, select "Run as Administrator". You will see the CMD screen appear and scroll. BE SURE THAT YOU HAVE CHANGED THE DRIVE LETTER ON ALL FILES!!


Rich (BB code):
@echo off

:: batch file to delete folders and files from new secondary drive

:: Author J. C. Griffith - jcgriff2 - Microsoft MVP
:: Sysnative Forums - https://www.sysnative.com/forums
:: December 2019

:: DEL (DELETE) will be the command used to delete single files

:: RD (Remove Directory) will be the command used to delete 
:: folders and ALL of the files that they contain

:: For info - The use of a double colon (as is located in 
:: columns 1 and 2 of this and other lines)
:: simply tells CMD that it is a line containing a comment 
:: and is not a command

:: Another way to leave a comment line is to write 
:: REM (Remark) in the 1st three positions of a line

:: Onto the business at hand. . . (I'm just going to 
:: list a few folders and files from my DIR listing above
:: -- not all of them


rd /s /q a:\$Recycle.Bin
rd /s /q a:\boot
del a:\bootmgr
del a:\bootnxt
rd /s /q a:\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
rd /s /q a:\HP
rd /s /q a:\inetpub
del a:\install.ini

This batch file will delete folders and files from our DIR listing above. I am only showing you this as an example a few of the folders and files and not the entire listing.


*** VERY IMPORTANT ***
Note that I am using drive letter a:. You'll need to change a: to whatever drive letter that you have assigned to your new secondary drive.



The \USERS Folder
The contents of the \users folder is where you'll find your Documents, Pictures, Videos, Music and Downloads. You can copy these folders to the new user profile folder in your new Windows installation (c:\users\). Do not try to copy the JUNCTIONS.

Rich (BB code):
Volume in drive C is Windows 8.1 x64
Volume Serial Number is C8D9-F1EF

Directory of C:\Users\Administrator

11/23/2019 08:53 AM .
11/23/2019 08:53 AM ..
04/26/2015 06:11 PM AppData
03/18/2014 03:10 PM Application Data [C:\Users\Administrator\AppData\Roaming]
10/25/2019 12:48 PM Contacts
03/18/2014 03:10 PM Cookies [C:\Users\Administrator\AppData\Local\Microsoft\Windows\INetCookies]
11/24/2019 10:49 AM Desktop
11/24/2019 10:51 AM Documents
10/25/2019 01:18 PM Downloads
11/24/2019 11:05 AM Favorites
10/25/2019 12:48 PM Links
03/18/2014 03:10 PM Local Settings [C:\Users\Administrator\AppData\Local]
10/25/2019 12:48 PM Music
03/18/2014 03:10 PM My Documents [C:\Users\Administrator\Documents]
03/18/2014 03:10 PM NetHood [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Network Shortcuts]
03/25/2019 12:48 PM Pictures
03/18/2014 03:10 PM PrintHood [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Printer Shortcuts]
03/18/2014 03:10 PM Recent [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Recent]
12/20/2013 12:21 PM Roaming
10/25/2019 12:48 PM Saved Games
10/25/2019 12:48 PM Searches
03/18/2014 03:10 PM SendTo [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\SendTo]
03/18/2014 03:10 PM Start Menu [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu]
11/23/2019 08:53 AM SysnativeBSODApps [C:\Users\PalmDesert\SysnativeBSODApps]
03/18/2014 03:10 PM Templates [C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Templates]
10/25/2019 12:48 PM Videos


Clean installation of Windows 10 - Doing a Completely Clean Install or Reinstall of Windows 10


Good Luck to you!

Regards. . .

jcgriff2

p.s. If you have any questions, please submit a reply post. Thank you.


Please join us at Sysnative - Register for Free Tech Help at Sysntive Forums






`
 
Last edited:

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top