User:Sakaki/Sakaki's EFI Install Guide/Preparing Windows for Dual-Booting

As shipped, a typical Windows 10 (or Windows 8) installation spans its host machine's entire drive.

Accordingly, our first order of business is to shrink the size of the Windows C: partition, thereby freeing up some space on which to install our new Gentoo system.

The good news is that Windows already contains the necessary tools to shrink partitions. The not-so-good news is that Windows also sprinkles various files around the drive (for hibernation, paging and system restore), such that even if you have just started using the machine, without some additional work you can only reclaim about half of your C: drive for Linux.

But, fear not: the instructions below will show you how to get around this restriction.

Shrinking Windows' Disk Footprint
Boot your target machine into Windows as normal, and login to your account (which must have administrator rights - the first user created on a new Windows install has these by default). Next, perform the following steps (I have noted where things differ between Windows 10, 8.1 and 8):


 * 1) Ensure you have backups of everything important. Last chance ^-^
 * 2) Done that? OK then, to begin with, we'll turn off system protection (restore points). Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Create a restore point' item which appears (in Windows 10 and 8.1; Windows 8 users will need to click the 'Settings' icon to see this result). You will now be presented with a dialog box with 'System Protection' as the selected tab. Choose the relevant drive (generally, C:). Click the 'Configure...' button. Another dialog pops up - click on the 'Disable system protection' radio button, and click 'OK'. When asked if you are sure, click 'Yes'. (N.B., this will remove existing restore points from the drive, if any; if they are important to you, do not perform this step.) Close out the other dialogs by clicking on 'OK'.
 * 3) Next, we'll turn off the virtual memory paging file. Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Adjust the appearance and performance of Windows' item that appears (in Windows 10 and 8.1; Windows 8 users will again need to click the 'Settings' icon to see this result). You will now be presented with a 'Performance Options' dialog; select the 'Advanced' tab in it. In the virtual memory area, click on 'Change...', and, in the dialog that next appears, untick 'Automatically manage paging file size for all drives', then choose the relevant drive (generally, C:), select the 'No paging file' radio button and click 'Set'. You'll get warnings about the problems this can cause; if happy to proceed select 'Yes', then choose 'OK' again to close out the Virtual Memory dialog itself. If you get a warning about needing to reboot, accept this (but don't reboot yet). Then close out any remaining dialogs.
 * 4) Now to turn off hibernation. This is most easily done from the Windows command line. Hit the , which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Now right-click on the 'Command Prompt' icon that appears, then click on 'Run as administrator' item in the context menu (in Windows 10 and 8.1; it appears at the bottom of the screen in Windows 8). If asked whether you wish to proceed, click 'Yes'. You will be presented with an open command window. Now enter  . After this, hit , then click on the power icon at the bottom right of the screen, and choose 'Restart' from the pop-up menu.
 * 5) Allow the machine to reboot back into Windows, and log in again.
 * 6) Now we will defragment the drive. Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Defragment and Optimize Drives' item that appears (in Windows 10; in Windows 8.1 and 8 the required item is named 'Defragment and optimize your drives'). Select the C: drive in the dialog box that appears, and select 'Optimize' (this will defragment the drive). When it has completed, click the 'Close' button to dismiss the dialog.
 * 7) Follow the process described earlier to reboot and log in again to Windows. (Without this reboot, the shrink step below may fail.)
 * 8) Finally, we are ready to shrink the Windows partition . Hit, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Create and format hard disk partitions' item that appears (in Windows 10 and 8.1; Windows 8 users will again need to click the 'Settings' icon to see this result). Right click on the C: partition in the display for Disk0 at the bottom of the 'Disk Management' dialog that appears, and select 'Shrink Volume...' from the context menu. Another dialog entitled 'Shrink C:' appears. If all has gone according to plan with the changes above, you should now be able to enter quite a large amount of shrink space: enter (as you wish) anything up to the maximum amount allowed as shown on the dialog:Win8PartitionShrink.png To proceed, click on 'Shrink'. When the process completes, you should now see an additional 'Unallocated' partition at the end of Disk 0 on the 'Disk Management' dialog, and it should be a meaningful percentage of the drive (note that the partition graphical display is not proportional). Note: as an indication, I was able to create a 195.86GB unallocated partition using this method (on a 238.35GB drive, with the C: partition shrunk to 42.10GB from 237.96GB). YMMV.
 * 9) For safety, follow the process described earlier to reboot and log in again to Windows. This ensures that all system processes take note of the new partition boundaries.
 * 10) Now we'll revert the changes we made to Windows (other than the partition shrink!), prior to installing Gentoo Linux on our newly reclaimed disk space. First, we'll turn on hibernation again. Hit the , which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Now right-click on the 'Command Prompt' icon that appears, then click on 'Run as administrator' item in the context menu (in Windows 10 and 8.1; it appears at the bottom of the screen in Windows 8). If asked whether you wish to proceed, click 'Yes'. You will be presented with an open command window. Now enter  . Note that although this enables hibernation, the option to trigger it may still be hidden in the power menu, even after you reboot. We'll fix this shortly.
 * 11) Next, let's activate the virtual memory paging file again. Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Adjust the appearance and performance of Windows' item that appears (in Windows 10 and 8.1; Windows 8 users will again need to click the 'Settings' icon to see this result). You will now be presented with a 'Performance Options' dialog; select the 'Advanced' tab in it. In the virtual memory area, click on 'Change...', and, in the dialog that next appears, tick 'Automatically manage paging file size for all drives', then choose 'OK' to close out the Virtual Memory dialog. If you get a warning about needing to reboot, accept this (but don't reboot yet). Close out all the remaining dialogs.
 * 12) Now we'll turn on system protection (restore points) again. Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type  . Then click on the 'Create a restore point' item which appears (in Windows 10 and 8.1; Windows 8 users will again need to click the 'Settings' icon to see this result). You will now be presented with a dialog box with 'System Protection' as the selected tab. Choose the relevant drive (generally, C:). Click the 'Configure...' button. Another dialog pops up - click on the 'Turn on system protection' radio button, and click 'OK'. Close out the other dialogs by clicking on 'OK'.
 * 13) Follow the process described earlier to reboot and log in one last time to Windows. Check that everything still works as expected.
 * 14) The final step is to ensure that hibernation shows up on the Windows power menu.  Hit the, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8). What you need to do next depends on your Windows version. In Windows 10, type  , and click on the 'Power Options' item which appears; then, click 'Choose what the power button does' in the presented dialog box. In Windows 8.1 or 8, type  , then click on the 'Change what the power buttons do' item that appears (Windows 8 users will again need to click the 'Settings' icon to see this result). For all version of Windows, next click on the 'Change settings that are currently unavailable' link in the 'System Settings' dialog. In response, the dialog will display some 'Shut-down settings' (Windows 10) or 'Power options settings' (Windows 8.1 and 8). Ensure 'Hibernate' (in Windows 10) or 'Show Hibernate' (in Windows 8.1 and 8) is checked. You should also ensure that the entry 'Turn on fast startup (recommended)' is unchecked (this entry might be called 'Hybrid Boot', depending on your system version), and then click the 'Save Changes' button (if you had to make any modifications). Hibernation should now be an option on the power menu. Hit , then click on the power icon at the bottom right of the screen, to make sure. Don't actually hibernate the machine though, simply cancel back out to the main screen, once you've verified that the item is now present.

Next Steps
Although we're done with our Windows prep work for now, leave the target machine running Windows for the moment. Click here to go to the next chapter, "Creating and Booting the Minimal-Install Image on USB".