Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue calculating temp space #37

Open
rawiriblundell opened this issue Nov 19, 2024 · 0 comments
Open

Issue calculating temp space #37

rawiriblundell opened this issue Nov 19, 2024 · 0 comments

Comments

@rawiriblundell
Copy link

On first run of wslcompact, I encountered:

 WARNING: there isn't enough free space in temp drive C to process Ubuntu-20.04.
          There are only 10259 MB available.

 Please, change the TEMP folder to a drive with at least 0 MB of free space.
 You cand do it by typing $env:TEMP="Z:/your/new/temp/folder" before using wslcompact.

So I followed the instructions:

$env:TEMP="d:\wsltmp"

Then I started getting:

 Current size:   36260 MB
 Estimated size: 15537 +/- 379 MB
 The estimated process time using an SSD is about 4 minutes.
Method invocation failed because [System.Object[]] does not contain a method named 'op_Division'.
At C:\Users\Rawiri.Blundell\[redacted]\WindowsPowerShell\Modules\WslCompact\WslCompact.psm1:85 char:17
+             if (($estimated * $sf) -lt ($freedisk / 1MB)) {
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (op_Division:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Following the code, we have this line:

$freedisk = (Get-PSDrive $env:TEMP[0]).free

If I follow that manually, I get two results:

Get-PSDrive $env:TEMP[0]

Name           Used (GB)     Free (GB) Provider      Root                                                            CurrentLocation
----           ---------     --------- --------      ----                                                            ---------------
D                  16.44         41.28 FileSystem    D:\
d                  16.44         41.28 FileSystem    d:\

(Get-PSDrive $env:TEMP[0]).free
44320555008
44320555008

I don't know if this is normal behaviour for PowerShell.

Setting the $freedisk assignment to this:

$freedisk = (Get-PSDrive $env:TEMP[0] | Select-Object -First 1).free

Allows the process to continue, but I'm not sure if that's necessarily the best solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant