You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译Substrate node-template执行cargo build --release时出现磁盘空间不足错误求助

Fixing "No space left on device" When Building Substrate Node-Template in Kali

Hey there, sorry you're stuck with this disk space hiccup while compiling the Substrate node-template. Let's work through some practical fixes to get your build back up and running:

1. First, verify your disk is actually full

Run this command to check available space across all your system's partitions:

df -h

Look at the /home row (since your project lives in ~/project/) — if the Use% column is hovering near 100%, that's exactly why you're hitting this error.

2. Clean up Cargo's build artifacts

Cargo piles up tons of intermediate build files in the target directory. Clear your project's local build cache first:

cargo clean

If you want to free up even more space, install the cargo-cache tool to prune global unused dependencies and old build artifacts:

cargo install cargo-cache
cargo cache --autoclean

This will wipe out redundant files you don't need anymore.

3. Clear system-level junk from Kali

Free up space by removing unused packages and cached installation files:

sudo apt autoremove --purge
sudo apt clean

You can also safely delete temporary files in /tmp (these are usually auto-cleaned, but manual cleanup gives an immediate boost):

sudo rm -rf /tmp/*

4. Redirect the target directory to a partition with more space

If your /home partition is permanently low on space, you can point Cargo's build output to another drive/partition using a symlink:

  1. Create a directory on the partition with free space (e.g., /data):
    sudo mkdir -p /data/substrate-target
    sudo chown $USER:$USER /data/substrate-target
    
  2. Delete the existing target folder in your project:
    rm -rf ~/project/substrate-node-template/target
    
  3. Create a symlink linking your project to the new directory:
    ln -s /data/substrate-target ~/project/substrate-node-template/target
    

Now when you run cargo build --release, all build files will go to the space-rich location instead.

5. Hunt down and delete large, unnecessary files

Use the ncdu tool to scan your /home directory and spot big files you can get rid of:

  1. Install it first:
    sudo apt install ncdu
    
  2. Run it on your home directory:
    ncdu ~/
    

Navigate through the results to find old archives, unused projects, or other large files taking up space, then delete them to free up room.


内容的提问来源于stack exchange,提问作者CocDap

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:24:07