Shrinking Windows partitions for installing Linux
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.
- 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.)
- The best solution I've found is to run it once with "Full Optimization", then once with "Defragment".
- You will be able to find these at the top of the UltraDefrag window with these icons:
- It usually takes an hour on a heavily-fragmented 256GB SSD.
- 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.
- After it's done, follow the steps under "Shrinking the partition" below.
Shrinking the partition
- Now shrink your partition within Windows by pressing
diskmgmt.mscand pressing ENTER.
- 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.
- 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.
- 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.
- 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.
- 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.
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