How to Clean Up Disk Space on a Juniper Switch

The Juniper EX4300 series features a compact 316 MB root (/) partition. Over time, accumulated log files, crash dumps, and old software packages can cause disk space warnings, preventing OS upgrades or configuration saves. This guide walks you through safely freeing up disk space using built-in Junos CLI and FreeBSD shell tools.

Prerequisites & Requirements

ADVERTISEMENT
  • Terminal or SSH access to the switch with administrative privileges
  • Basic familiarity with Junos operational mode (>) and FreeBSD shell (%).

Step 1: Run the Automated Junos Storage Cleanup

Junos provides an automated cleanup command that scans /var/log and /var/tmp to delete old, compressed system log files and temporary installation artifacts.

  1. Log in to the switch CLI and run:request system storage cleanup
  2. For a Virtual Chassis setup, clean up all member switches at once:request system storage cleanup all-members
  3. When prompted (Do you want to proceed ? [yes,no]), type yes to delete the identified candidates.

Step 2: Remove Inactive Software Packages

If an automated cleanup does not free up enough space, previous Junos OS release packages stored in the backup partition might still be present.

  1. View active packages to confirm what is installed:show system software
  2. Remove old, inactive Junos software packages:request system software delete
  3. On a Virtual Chassis, execute the removal across all nodes:request system software delete all-members

Note: This command safely removes unused backup files without affecting the currently running Junos version.

Step 3: Manually Clear Large Files in /var/tmp and /var/crash

Temporary files, failed firmware uploads (.tgz), and kernel crash dumps stored in /var can consume significant space.

  1. Check for old firmware images or .gz archives in /var/tmp:file list /var/tmp/*.tgz file list /var/tmp/*.gz
  2. Delete unwanted archive files:file delete /var/tmp/<filename>.tgz
  3. Clear system core dumps and crash reports:file delete /var/crash/*

Step 4: Advanced Shell Cleanup (Root Mode)

For persistent storage issues where root (/) remains above 90% utilization, drop into the FreeBSD shell to locate hidden system files.

  1. Start the shell and elevate to root:start shell su root
  2. Check top-level directory disk usage on the root filesystem:du -cksh /* | sort -rh
  3. Clean out old log archives directly from /var/log:rm -f /var/log/*.gz rm -f /var/log/*.[0-9].gz
  4. Return to the Junos CLI:
exit
exit

Step 5: Verify Free Space

Check the storage status across all mounted filesystems:

show system storage

Key Areas to Monitor:

  • / (Root Partition): Ideal available space should be >50 MB for general operations (though ~90% capacity is normal for EX4300 architecture).
  • /var/tmp: Ensure at least 300 MB–500 MB of free space is available prior to staging a Junos OS firmware upgrade.

Scroll to Top