MSYS2-packages: `checking available disk space` is slowest operation

  • on doing pacman -Syu, the checking available disk space is almost always the slowest step
  • and i always wonder why? like what makes it take sooo much time? and if it can be improved
  • it’s performing nothing like downloading, extracting, copying, searching etc…
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (63) ...

Total Download Size:   138.77 MiB
Total Installed Size:  886.21 MiB
Net Upgrade Size:       -1.71 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
...
 Total (63/63) ...
(63/63) checking keys in keyring ...
(63/63) checking package integrity ...
(63/63) loading package files ...
(63/63) checking for file conflicts ...
(63/63) checking available disk space ...
:: Processing package changes...

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Years ago when I had checked it on very old HDD it was caused by Microsoft Defender. Even though I had added MSYS2 directory to the exceptions. Temporarily disabling the Defender made it much faster. I think Pacman might be doing something that is normal on Unix but slow when emulated by Cygwin on Windows/NTFS and also causes AV software to do a lot of unnecessary work.

I’ve posted very short tests results at https://github.com/msys2/msys2-pacman/issues/32#issuecomment-1973629270 TL;DR I recommend installing MSYS2 inside Dev Drives.

PS. Pressing Alt-Enter for this directory in the Explorer exhibits calculation times around 26 seconds:

image

This timing is more similar to Midipix (which uses NTAPI to get the metadata) than to MSYS2 (or Cygwin for that matter).

@goyalyashpal, here goes my results – one minute and a half:

$ time du --human-readable --max-depth=1 --threshold=500MiB "$LOCALAPPDATA" -b
1263105728      C:\Users\saukrs\AppData\Local/0install.net
3674538443      C:\Users\saukrs\AppData\Local/Autodesk
du: cannot read directory 'C:\Users\saukrs\AppData\Local/ElevatedDiagnostics': Permission denied
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Google/Chrome/User Data/CertificateRevocation/8365': Permission denied
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Google/Chrome/User Data/CertificateRevocation/8367': Permission denied
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Google/Chrome/User Data/OptimizationHints/421': Permission denied
6783482254      C:\Users\saukrs\AppData\Local/Google
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Microsoft/Windows/INetCache/Low/Content.IE5': Permission denied
2406862526      C:\Users\saukrs\AppData\Local/Microsoft
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Programs/Opera/.opera/1DCCC0B63140': Permission denied
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Temp/WinSAT': Permission denied
15325201831     C:\Users\saukrs\AppData\Local

real    1m34.078s
user    0m3.968s
sys     0m31.968s

Note that rerunning the command instantly didn’t change timing:

$ time du --human-readable --max-depth=1 --threshold=500MiB "$LOCALAPPDATA" -b
  ...
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Programs/Opera/.opera/1DCCC0B63140': Permission denied
du: cannot read directory 'C:\Users\saukrs\AppData\Local/Temp/WinSAT': Permission denied
15327079606     C:\Users\saukrs\AppData\Local

real    1m32.405s
user    0m4.640s
sys     0m37.343s

Maybe that’s due to MP Realtime Protection being off here at the moment:

$ powershell '$prefs = Get-MpPreference; $prefs.DisableRealtimeMonitoring'
True

Maybe you should check that and disable it if it’s enabled:

$ sudo powershell 'Set-MpPreference -DisableRealtimeMonitoring $true'

Note also, that run of an eleveated du is a bit shorter:

$ time sudo du --human-readable --max-depth=1 --threshold=500MiB "$LOCALAPPDATA" -b
1263105728      C:\Users\saukrs\AppData\Local/0install.net
3674538443      C:\Users\saukrs\AppData\Local/Autodesk
6785324008      C:\Users\saukrs\AppData\Local/Google
2406862776      C:\Users\saukrs\AppData\Local/Microsoft
15326500357     C:\Users\saukrs\AppData\Local

real    1m12.072s
user    0m0.015s
sys     0m0.015s

I used gsudo for that.

We have had these reports before, but the problem is that it is only slow for some users. Here it is instant for example.

We need to find a way to reproduce.