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

From Gentoo Wiki
Jump to:navigation Jump to:search


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.[1]

Note
A similar process may be used to free up space in a Windows 7 system too.[2]

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):

Note
For Windows 10 users, the following assumes you are logged in with a local account and have options like "Search online and include web results" and Cortana turned off.[3] If you are running Windows 10 with more permissive settings, be sure to choose the correct item from those returned when directed to perform a search in the following instructions. The correct items will generally be tagged as "Control panel" or "Desktop app".
  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).[4] Hit the Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type restore point. 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 Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type adjust the appearance. 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 Windows Key , which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type command. 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 powercfg /H off. After this, hit CtrlAltDelete, 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 Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type defragment. 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.[5] Hit Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type partitions. 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:
    Shrinking the C: Partition in Windows
    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.
    Note
    If you encounter a problem during the shrink operation, for example Windows informing you that there is not enough disk space available to complete the operation, then try performing a shrink of half of the claimed 'available shrink space', and then immediately repeating if successful.
    Note
    With certain versions of Windows, you may find that the very end of the disk contains a recovery partition (and possibly a number of additional "OEM" partitions). That's nothing to worry about, just shrink the C: partition as described — you'll still be able to install Gentoo onto the space you have freed up, even if it does not span completely to the end of the drive.
    Note
    How much space to free up for Gentoo / leave for Windows will obviously depend upon your particular usage pattern. You should probably aim to free up a minimum of 20GB or so for Gentoo, however. If you are running Windows 8 or 8.1, and planning to upgrade to Windows 10 in the future, you should ensure that your Windows C: partition has a minimum of 5GB free space after the shrink.[6] (Incidentally, even once Gentoo is co-installed, you can safely upgrade to Windows 10 without harming the Linux side of things; in this author's experience anyhow.)
  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 Windows Key , which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type command. 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 powercfg /H on. 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 Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type adjust the appearance. 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 Windows Key, which will bring up the start menu in Windows 10 (or the "start screen" in Windows 8.1 and 8), and type restore point. 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.[7][8] Hit the Windows Key, 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 power options, and click on the 'Power Options' item which appears (in newer versions of Windows 10, the item has been renamed; you should click on 'Power & sleep settings' instead); then, click 'Choose what the power button does' in the presented dialog box (in newer versions of Windows 10 you will need to click on 'Additional power settings' to see this dialog; the item you want inside it has been renamed also, to 'Choose what the power buttons do'). In Windows 8.1 or 8, type power buttons, 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),[9] 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 CtrlAltDelete, 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".

Notes

< Previous Home Next >