Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...

 
alt

Daniel Nashed

 

Cleaning up your disks -- WSL and Docker

Daniel Nashed  23 January 2023 11:24:43

I need some space on disk c:\ to install the latest Visual Studio 2022 compiler.

And the challenge was to find out what might not be needed any more and takes most of the space.


Finding large disk allocations


A very convenient way to find large diskspace allocations is "ncdu" in my WSL Ubuntu instance.
I just ran (needs to be installed on Ubuntu / your Linux distribution running in WSL)


ncdu /mnt/c


It turned out that the biggest allocation was my Ubuntu virtual hard disk.
WSL adds space automatically, but does not release storage.
But if you have hyper-v tools installed, you can down


/mnt/c/Users/daniel.nashed/AppData/Local/Packages


46.8 GiB [##########] /CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc



There is a simple Powershell command you can use to optimize the virtual hard disk file.


First shut down WSL:


wsl --shutdown


Then run the following Powershell command (you have to change the user name and see if you have the same file).

Taking a backup before compacting would be also a good idea.


Optimize-VHD -Path  C:\Users\daniel.nashed\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx  -Mode Full



In my case the VHDX file was less than half the size afterwards.



Removing old Docker Desktop files


I had installed Docker Desktop a while ago. The uninstaller does not remove all the data left over.
You have to remove the data manually.

But the permission to the data is even not granted to an administrator account.


I found the following commands, that helped to adjust the permissions and let me delete the files:



takeown.exe /F "C:\ProgramData\Docker" /R /A /D Y

icacls "C:\ProgramData\Docker" /T /C /grant Administrators:F

rmdir /s /q "C:\ProgramData\Docker"



Both operations in combination took me from 28 GB free to 69 GB free on disk C:


Maybe this helps someone else cleaning up disk drive C: ...




Links

    Archives


    • [IBM Lotus Domino]
    • [Domino on Linux]
    • [Nash!Com]
    • [Daniel Nashed]