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

Reduce disk space #2244

Closed
flip111 opened this issue Jun 5, 2016 · 8 comments
Closed

Reduce disk space #2244

flip111 opened this issue Jun 5, 2016 · 8 comments
Milestone

Comments

@flip111
Copy link
Contributor

flip111 commented Jun 5, 2016

My 64GB laptop SSD is getting rather full and i saw that stack takes up a lot of diskspace. I tried putting all my projects on the same LTS version and clear out the snapshot folder. Also i delete a tar.xz file in the programs folder. Is there anything else that can be done?

@mgsloan
Copy link
Contributor

mgsloan commented Jun 6, 2016

stack clean --full in your different projects to remove all build files.

NOTE: only do that on >= 1.0.4.3, see #2000

@mgsloan mgsloan closed this as completed Jun 6, 2016
@mgsloan mgsloan added this to the Support milestone Jun 6, 2016
@sid-kap
Copy link
Contributor

sid-kap commented Jul 19, 2016

@flip111, in your experience is it safe to delete the ~/.stack/snapshots/x86_64-linux/lts-XXX folder if lts-XXX is a snapshot that I no longer care about?

I tried this once, and it caused me ghc-pkg errors related to missing alex/happy files in the deleted directory later on. (The errors happened when I was building a stack project using a different snapshot.) I had to symlink the files to lts-XXX to fix this.

@sid-kap
Copy link
Contributor

sid-kap commented Jul 19, 2016

Actually, it looks like this was discussed at #1847 and #133. I'll just read the discussion there.

Sorry for the noise.

@flip111
Copy link
Contributor Author

flip111 commented Nov 11, 2017

indices is now 1.3G .. perhaps anyone knows a list of directories/files that are safe to remove? Could just store that as a shell script and run that once in a while ...

@flip111
Copy link
Contributor Author

flip111 commented Jan 4, 2018

stack clean --full in your different projects to remove all build files.

Then i have to go into all those projects. But i mainly want to clean out lts versions which i'm no longer using and also tar.xz archives if they are not needed. Why are those tar.xz files kept actually?

@flip111
Copy link
Contributor Author

flip111 commented Jan 4, 2018

104M	build-plan
14M	build-plan-cache
12K	config.yaml
1,5M	global-project
1,3G	indices
26M	loaded-snapshot-cache
22M	precompiled
5,4G	programs
45M	setup-exe-cache
108K	setup-exe-src
3,9G	snapshots
52K	templates

11G total .. it's quite a lot

@flip111
Copy link
Contributor Author

flip111 commented Jan 4, 2018

The binaries in ~/.stack/snapshots/x86_64-linux/*/*/bin also take a lot of space. Are they still needed after being copied to ~/.local/bin ?

@flip111
Copy link
Contributor Author

flip111 commented Feb 10, 2019

What about when running this function

stack/src/Stack/Setup.hs

Lines 938 to 956 in 6ec4ac4

downloadAndInstallTool :: HasTerm env
=> Path Abs Dir
-> SetupInfo
-> DownloadInfo
-> Tool
-> (SetupInfo -> Path Abs File -> ArchiveType -> Path Abs Dir -> Path Abs Dir -> RIO env ())
-> RIO env Tool
downloadAndInstallTool programsDir si downloadInfo tool installer = do
ensureDir programsDir
(file, at) <- downloadFromInfo programsDir downloadInfo tool
dir <- installDir programsDir tool
tempDir <- tempInstallDir programsDir tool
liftIO $ ignoringAbsence (removeDirRecur tempDir)
ensureDir tempDir
unmarkInstalled programsDir tool
installer si file at tempDir dir
markInstalled programsDir tool
liftIO $ ignoringAbsence (removeDirRecur tempDir)
return tool
the archive gets removed from disk ?

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

3 participants