Shrinking Windows partitions for installing Linux

From RHLUG Wiki
Revision as of 16:40, 9 October 2021 by AlphaCubed (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Defragmenting the partition

You will need to defragment an SSD to allow Windows to shrink the disk. Windows does do automatic optimization of SSDs, but not defragmenting as it generally decreases lifespan but only by a bit each time. You'll only be defragmenting once in a long while (to install Linux), so it's fine.

  1. Install UltraDefrag (the open source version) here: https://sourceforge.net/projects/ultradefrag/files/stable-release/7.1.4/ (you will want to click on ultradefrag-7.1.4.bin.amd64.exe, as amd64 means a 64-bit system, and the .exe file lets you run the program without any extra steps.)
  2. The best solution I've found is to run it once with "Full Optimization", then once with "Defragment".
  3. You will be able to find these at the top of the UltraDefrag window with these icons:
    Screenshot describing the types of optimization and descriptions in the UltraDefrag window. See Licensing notes below for the license of this image.
  4. It usually takes an hour on a heavily-fragmented 256GB SSD.
  5. You might not be able to shrink all of your free space on Windows, but you will usually be able to shrink about 80-90% of it.
  6. After it's done, follow the steps under "Shrinking the partition" below.

Shrinking the partition

  1. Now shrink your partition within Windows by pressing Windows+R, typing diskmgmt.msc and pressing ENTER.
  2. Then, find the NTFS partition you want to shrink (it's usually a big 250GB chunk you see on the screen) and right click > Shrink.
  3. Now, figure out the amount you need to shrink by. You can shrink anywhere up to 80-90% of your free space after you've defragmented it.
    1. IMPORTANT: If "80-90%" for you is less than 30GiB (see "Why is it GiB and not GB?" below), you will have trouble installing Linux with a low amount of disk space. Try removing some more files or install Linux on a completely different drive.
  4. Shrink the partition by ~30GiB or so for installing Ubuntu or another distro. If the diskmgmt.msc window complains with an error saying "the partition cannot be shrunk" or similar, see "What to do if Windows can't shrink your partition" below.
  5. You should have "Free Space" that's now there. Just leave it be, it will be filled when you install Ubuntu.

What to do if Windows can't shrink your partition

You will need to keep trying to defragment the partition (see "Defragmenting the partition" above), or remove some more files, or just try installing Linux on a completely different drive if you can't get 30GiB of free disk space.

Why is it GiB and not GB?

If Googling to convert "MB to GB", you will actually need to convert from MiB to GiB. WIndows lies and tells you the disk size in MiB, which is not actually MB.

See also: https://www.nextofwindows.com/gb-gigabyte-and-mb-megabyte-is-not-what-you-think-is-in-windows

Licensing notes

The image above is licensed under GNU FDL, and the license was copied from the PDF and put here: GNU FDL-UltraDefrag-Docs

The original source of the image and license is from this PDF: https://sourceforge.net/projects/ultradefrag/files/stable-release/7.1.4/UltraDefrag_Handbook_7.1.4_a4.pdf/download