This article provides steps on how to troubleshoot what is taking up the disk space in a Juniper Networks EX Series switch.
When a switch is out of space, several issues may arise, such as the inability to log into the switch or to register new logs. Running the command ‘show chassis alarms’ on an EX switch, returns the following message:
‘show chassis alarms’
Minor Host 0 /var partition usage is high.
What could be consuming the disk space?Example:When checking the device utilization, the following output is returned:
{master:0}pwdlab@EX> show system storage/dev/da0s3e 123M 82M 31M 72% /var
This output does not reveal what could be consuming the disk space.Running the command, ’file list /var/’ does not provide enough information:
’file list /var/’
.snap/BSD.var.distaccount/at /backups/bin/crash/cron/db /empty/etc/etcroot/heimdal/home/jail/log/logical-systems/mail/mfs/msgs/named/preserve/root/run/rundb/rwho/spool/sw /tmp/transfer/validate/yp /
Important Notes:
The following example uses UNIX shell commands to display ways to find out what is taking up space in an EX switch and remove them:
start shell user root'
{master:0} lab@EX> start shell user root %
By default, Junos will go to the user's home directory. Confirm this by typing pwd .% pwd /var/home/lab
pwd
% pwd /var/home/lab
% cd /var/ % pwd /var
% du -cks * | sort -rn du: cron/tabs: Permission denied du: db/entropy: Permission denied du: db/certs/common: Permission denied du: db/certs/system-key-pair: Permission denied du: db/certs/system-cert: Permission denied du: db/dhcp_snoop: Permission denied du: heimdal: Permission denied du: root/.ssh: Permission denied du: run/ppp: Permission denied du: spool/opielocks: Permission denied 407216 total 293838 tmp 53964 home 30430 rundb 20698 root 6888 log 378 db 332 mfs 204 run 204 etc 120 jail 100 etcroot 12 spool 6 at 4 transfer 4 sw 4 crash 4 BSD.var.dist 2 yp 2 validate 2 rwho 2 preserve 2 named 2 msgs 2 mail 2 logical-systems 2 empty 2 cron 2 bin 2 backups 2 account
% file home home: directory
% ls -l | grep home d rwxr-xr-x 37 root wheel 1024 Sep 5 18:22 home
% cd home/ % pwd /var/home % du -cks * | sort -rn 53962 total 53802 lab 46 daltamirano 16 remote 14 wheaslip 12 jrojas 4 wmoreira drwxr-xr-x 3 lab 20 512 Dec 17 09:30 lab
% cd lab/ % du -cks * | sort -rn 53796 total 28000 foo 25760 bar 14 DHCP-CONFIGURATION-MEMO 8 et inte 8 JORGE-TEST 4 h 2 DHCPclient.PCAP 0 LC-DHCP-LAB 0 DHCP.PCAP % ls -l | grep foo -rw-r--r-- 1 lab field 28655162 Dec 17 09:13 foo % ls -l | grep bar -rw-r--r-- 1 lab field 26361809 Dec 17 09:13 bar
% file foo foo: gzip compressed data, from UNIX, max compression % file bar bar: gzip compressed data, from UNIX, max compression
% file DHCPclient.PCAP DHCPclient.PCAP: tcpdump capture file (little-endian) - version 2.4, capture length 96)
% rm foo % rm bar % ls DHCP-CONFIGURATION-MEMO DHCPclient.PCAP LC-DHCP-LAB h DHCP.PCAP JORGE-TEST et inte
/dev/da0s3e 123M 29M 84M 26% /var
request system storage cleanup dry-run’
user@host> request system storage cleanup dry-run Currently rotating log files, please wait. This operation can take up to a minute. List of files to delete: Size Date Name 11.4K Mar 8 15:00 /var/log/messages.1.gz 7245B Feb 5 15:00 /var/log/messages.3.gz 11.8K Feb 22 13:00 /var/log/messages.2.gz 3926B Mar 16 13:57 /var/log/messages.0.gz 3962B Feb 22 12:47 /var/log/sampled.1.gz 4146B Mar 8 12:20 /var/log/sampled.0.gz 4708B Dec 21 11:39 /var/log/sampled.2.gz 7068B Jan 16 18:00 /var/log/messages.4.gz 13.7K Dec 27 22:00 /var/log/messages.5.gz 890B Feb 22 17:22 /var/tmp/sampled.pkts 65.8M Oct 26 09:10 /var/sw/pkg/jinstall-7.4R1.7-export-signed.tgz 63.1M Oct 26 09:13 /var/sw/pkg/jbundle-7.4R1.7.tgz
lab@EX> show versionModel: ex2300-48tJunos: 20.4R3-S1.3
lab@EX> show version
{master:0}lab@EX> start shell user rootlab@EX:RE:0% cd /varlab@EX:RE:0% cd /packages/dblab@EX:RE:0% pwd --------------> shows the path in which you are located/packages/dblab@EX:RE:0% ls -ltotal 288drwxr-xr-x 4 root wheel 512 Feb 22 2022 fips-mode-arm-32-20211120.090111_builder_junos_204_r3_s1drwxr-xr-x 2 root wheel 512 Feb 22 2022 jail-runtime-arm-32-20210909.a3fd70d_builder_stable_11-204abdrwxr-xr-x 3 root wheel 512 Feb 22 2022 jpfe-EX34XX-arm-32-20211120.090111_builder_junos_204_r3_s1drwxr-xr-x 4 root wheel 512 Feb 22 2022 jphone-home-arm-32-20211120.090111_builder_junos_204_r3_s1drwxr-xr-x 3 root wheel 512 Feb 22 2022 jsd-arm-32-20.4R3-S1.3-jet-1drwxr-xr-x 4 root wheel 512 Feb 22 2022 jsdn-arm-32-20.4R3-S1.3drwxrwxrwx 5 root wheel 512 May 12 2010 junos-arm-32-15.1X53-D590.1 --------> 15.1 file that's consuming spacedrwxr-xr-x 4 root wheel 512 Feb 22 2022 junos-arm-32-20.4R3-S1.3lab@EX:RE:0% rm -R junos-arm-32-15.1X53-D590.1/ --------------> Remove old file lab@EX:RE:0%In the above example, we see that the switch is currently running version 20.4R3-S1.3, and we still have a file for version 15 that's consuming space, therefore, it was removed to free up space. Also, you could issue the following commands within the shell:
lab@EX> start shell user rootlab@EX:RE:0% pkg setop rm previouslab@EX:RE:0% pkg delete oldlab@EX:RE:0% exitOr you could issue the following commands:lab@EX> request system snapshot delete * all-memberslab@EX> request system snapshot delete previous all-membersNOTE:
In case there is an OAM snapshot, you need to mount the OAM partition in order to delete it with the following commands in shell mode:
mkdir /var/tmp/oam <<< Create the new directory where the partition will be mountedmount /dev/gpt/oam /var/tmp/oam <<< Mount the partitioncd /var/tmp/oam/snapshot/ <<< Change the path where the snapshot isls <<< Check the snapshotsrm recovery.ufs.uzip <<< Remove the first snapshot filerm VERSION <<< Remove the second snapshot file
mkdir /var/tmp/oam
mount /dev/gpt/oam /var/tmp/oam
cd /var/tmp/oam/snapshot/
ls
rm recovery.ufs.uzip
rm VERSION
2025-05-14: Added steps to delete the OAM snapshot
2020-03-19: Moved important notes to the top of the solution field.2019-03-05: Minor edit. Non-technical