Memorise

JunOS: Cleanup Storage Space

Sometimes you will want to install a switch or router update, and you will find that there is not enough space:

root@Switch01> request system software add /var/tmp/ex-2300-18.3R1.9.tgz reboot
ERROR: estimate of space required: 115 Mbytes, available: 89 Mbytes

One option is to request a ‘cleanup’. The dry-run option below lists the files that are candidates to be removed. If you’re happy with the list, run the command again without ‘dry-run’ to do the actual cleanup.

root@Switch01> request system storage cleanup dry-run
fpc0:
--------------------------------------------------------------------------

List of files to delete:

         Size Date         Name
     6B Jan  1 13:07 /var/jail/tmp/alarmd.ts
  7416B Jan  1 14:01 /var/log/interactive-commands.0.gz
  25.1K Jan  1 14:01 /var/log/messages.0.gz
    27B Jan  1 10:03 /var/log/wtmp.0.gz
    27B Jan  1 10:06 /var/log/wtmp.1.gz
    45B Jan  1 10:05 /var/preserve/jdhcp_client_data
    45B Jan  1 10:05 /var/preserve/jdhcp_client_data_bkp
    50B Jan  1 10:36 /var/tmp/bcast.bdisp.log
    73B Jan  1 10:36 /var/tmp/bcast.disp.log
    57B Jan  1 10:36 /var/tmp/bcast.rstdisp.log
    64B Jan  1 10:36 /var/tmp/bcast.undisp.log
 321.4M Jan  1 13:44 /var/tmp/ex-2300-18.3R1.9.tgz
  4740B Jan  1 10:04 /var/tmp/ex_autod_config
  3701B Jan  1 10:03 /var/tmp/ex_autod_rollback_cfg
6298.8K Jan  1 13:44 /var/tmp/jweb-ex-app-x86-32-18.3A1.tgz
    57B Jan  1 10:03 /var/tmp/krt_rpf_filter.txt
    72B Jan  1 13:53 /var/tmp/package.log
    42B Jan  1 10:05 /var/tmp/pfe_debug_commands
     0B Jan  1 10:06 /var/tmp/pkg_cleanup.log.err
     0B Jan  1 10:03 /var/tmp/rtsdb/if-rtsdb
     0B Jan  1 10:04 /var/tmp/stable

WARNING: This cleanup cleans out the /var/tmp directory, which may contain the image that you’re trying to install.

Cleaning up Packages

Sometimes a regular cleanup will not free up enough space, especially after the system has been updated.

In this case, we can look at cleaning up unused packages:

User@Switch01> start shell user root
root@Switch01:RE:0% pkg setop rm previous
root@Switch01:RE:0% pkg delete old

If you run df -h before and after these commands, you can see how much was cleaned up.

Further Cleanup

There may be packages installed that you don’t need. For example, you may not need jweb and phone-home. If you don’t need these, you can uninstall them:

request system software delete jweb-ex
request system software delete jweb-ex-app 
request system software delete jphone-home

If you still don’t have enough space, it’s time to look for bigger files:

User@Switch01> start shell user root
root@Switch01:RE:0% find / -size +100000
/var/rundb/render.db
/packages/db/junos-runtime-arm-32-20180920.185504_builder_junos_183_r1/contents/contents.izo
/packages/mnt/jpfe-EX34XX32-cc3f6403/usr/sbin/fxpc

In the case above, we found three large files. If you know what you’re doing, you can delete some of these files.

If you’re not sure, contact J-TAC for assistance.

root@AWABA-NET-SW-AM01:RE:0% cli
User@Switch01> file delete /packages/db/junos-runtime-arm-32-20180920.185504_builder_junos_183_r1/contents/contents.izo

Categorised as: EX, Firewall, Juniper, SRX


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.