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

As shipped, a typical 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 8 already contains the necessary tools to shrink partitions (you did back up all your data, right?). The not-so-good news is that Windows 8 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 8's Disk Footprint
Boot your target machine into Windows 8 as normal, and login to your account (which must have administrator rights - the first user created on a new Windows 8 install has these by default). Next, perform the following steps (these also work with Windows 8.1):


 * 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  to get back to the main Windows 8 'tiles' view (aka "Start screen"), and type  Click on the 'Settings' icon (underneath the search box on the right of the screen). On the left side of the screen, click on the 'Create a restore point' entry that then appears. (Note - on Windows 8.1, this item appears directly below the search bar when you type.) You drop to the desktop, in 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  to get back to the main Windows 8 'tiles' view, and type  As before, click on the 'Settings' icon on the right side of the search screen. Then click on the 'Adjust the appearance and performance of Windows' item that appears on the left (on Windows 8.1, this item appears directly below the search bar when you type). You drop to the desktop, with a dialog selected; 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  to get back to the main Windows 8 'tiles' view, and type  Now right-click on the 'Command Prompt' icon that appears on the left side of the screen, then click on 'Run as administrator' icon at the bottom of the screen (in Windows 8.1, this option is in a context menu, and the 'Command Prompt' item itself appears directly below the search bar). If asked whether you wish to proceed, click 'Yes'. You drop to the desktop 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  to get back to the main Windows 8 'tiles' view, and type  As before, click on the 'Settings' icon on the right side of the search screen. Then click on the 'Defragment and optimize your drives' item that appears on the left (under Windows 8.1, this will appear directly below the search bar as you type). You drop to the desktop. 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  to get back to the main Windows 8 'tiles' view, and type  As before, click on the 'Settings' icon on the right side of the search screen. Then click on the 'Create and format hard disk partitions' item that appears on the left (under Windows 8.1, this item appears directly below the search bar as you type). You drop to the desktop. 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  to get back to the main Windows 8 'tiles' view, and type  Now right-click on the 'Command Prompt' icon that appears on the left side of the screen, then click on 'Run as administrator' icon at the bottom of the screen (in Windows 8.1, this option is in a context menu, and the 'Command Prompt' item itself appears directly below the search bar). If asked whether you wish to proceed, click 'Yes'. You drop to the desktop 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  to get back to the main Windows 8 'tiles' view, and type  As before, click on the 'Settings' icon on the right side of the search screen. Then click on the 'Adjust the appearance and performance of Windows' item that appears on the left (on Windows 8.1, this item appears directly below the search bar when you type). You drop to the desktop, with a dialog selected; 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  to get back to the main Windows 8 'tiles' view, and type  Click on the 'Settings' icon (underneath the search box on the right of the screen). On the left side of the screen, click on the 'Create a restore point' entry that then appears. (Note - on Windows 8.1, this item appears directly below the search bar when you type.) You drop to the desktop, in 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 8 power menu. Hit  to get back to the main Windows 8 'tiles' view, and type  As before, click on the 'Settings' icon on the right side of the search screen. Then click on the 'Change what the power buttons do' item that appears on the left (on Windows 8.1, this will appear directly below the search bar as you type). You drop to the desktop. Click on the 'Change settings that are currently unavailable' link in the 'System Settings' dialog that appears. In response, the dialog will display some 'Power options settings'. Ensure 'Show Hibernate' 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.

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