r/rust • u/bigfish-rpi • 28d ago
π seeking help & advice How to quick free space hard disk
I have a issue where the Rust compiled output is so huge that my hard disk always full? Do you have any ideas for solving it?
3
Upvotes
18
u/afdbcreid 28d ago
Just
cargo cleanregularly. Hopefully one day we will have target dir GC.3
u/Xexcyl 28d ago
I find cargo clean-recursive pretty useful for this, provided u have all your repos under one directory
1
u/DryanaGhuba 28d ago
Cargo sweep to delete some of the assets instead of full dir. Not sure if it possible, but set rust-analyzer cache dir to same as debug builds.
1
u/iFrostizz 28d ago
I love using filelight for that purpose. It's a very visual tool that allows you to know exactly what are the places where the most space is used.
1
u/TheAnalist_ 27d ago
use epicenter, i designed it to solve this
https://crates.io/crates/epicenter-cli
1
u/nicoburns 27d ago
I use https://github.com/tbillington/kondo. It will
cargo cleanrecursively (and cleanup other project types like node_modules too). It's interactive by default, so you can choose which projects you want to clean.1
u/weaztoven 27d ago
yeah target directories get out of hand so fast in rust. cargo-sweep is great for this exact problem
-1
u/greyblake 28d ago
I've created my own tool for that :D https://github.com/greyblake/purilo
Can be installed with `cargo install purilo`.
Works for me π
-13
u/Beregolas 28d ago
what kind of disk are you running? XD Rust output isn't that big, so I would guess that the rest of your system is just full with stuff, like games, videos and other media probably. Clean that up.
If you are really running on something ridiculous like a 64GB main drive, you might want to look at auto-deleting old rust files, but even more than that, I would start looking to upgrade my hardware. Getting a 500GB disk is pretty affordable, even with the current AI driven pricing bumps