How to Clean-up Space on Juniper SRX Devices - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Tuesday, January 29, 2013

How to Clean-up Space on Juniper SRX Devices


I have a pair of Juniper SRX 240 H running in company network environment. Recently it has to be upgraded to JunOS 11.4R5.5 which is latest recommended version. First thing I checked is the available space on those two devices. It seems node0 used 130m more space to storage files based on following command:




show system storage 
node0:
--------------------------------------------------------------------------
Filesystem              Size       Used      Avail  Capacity   Mounted on
/dev/da0s2a             293M       214M        56M       79%  /
devfs                   1.0K       1.0K         0B      100%  /dev
/dev/md0                599M       599M         0B      100%  /junos
/cf                     293M       214M        56M       79%  /junos/cf
devfs                   1.0K       1.0K         0B      100%  /junos/dev/
procfs                  4.0K       4.0K         0B      100%  /proc
/dev/bo0s3e              24M        88K        22M        0%  /config
/dev/bo0s3f             342M       215M       100M       68%  /cf/var
/dev/md1                168M        16M       139M       10%  /mfs
/cf/var/jail            342M       215M       100M       68%  /jail/var
/cf/var/log             342M       215M       100M       68%  /jail/var/log
devfs                   1.0K       1.0K         0B      100%  /jail/dev
/dev/md2                 39M       4.0K        36M        0%  /mfs/var/run/utm
/dev/md3                1.8M       196K       1.5M       11%  /jail/mfs

node1:
--------------------------------------------------------------------------
Filesystem              Size       Used      Avail  Capacity   Mounted on
/dev/da0s2a             293M       214M        56M       79%  /
devfs                   1.0K       1.0K         0B      100%  /dev
/dev/md0                599M       599M         0B      100%  /junos
/cf                     293M       214M        56M       79%  /junos/cf
devfs                   1.0K       1.0K         0B      100%  /junos/dev/
procfs                  4.0K       4.0K         0B      100%  /proc
/dev/bo0s3e              24M        86K        22M        0%  /config
/dev/bo0s3f             342M        84M       231M       27%  /cf/var
/dev/md1                168M        16M       139M       10%  /mfs
/cf/var/jail            342M        84M       231M       27%  /jail/var
/cf/var/log             342M        84M       231M       27%  /jail/var/log
devfs                   1.0K       1.0K         0B      100%  /jail/dev
/dev/md2                 39M       4.0K        36M        0%  /mfs/var/run/utm
/dev/md3                1.8M       4.0K       1.7M        0%  /jail/mfs




test@test> request system storage cleanup  

List of files to delete:

         Size Date         Name
  13.5K Jan 24 19:28 /cf/var/log/default-log-messages.0.gz
  33.7K Jan 24 19:27 /cf/var/log/default-log-messages.1.gz
   147B Jan 24 19:28 /cf/var/log/interactive-commands.0.gz
   358B Jan 24 19:28 /cf/var/log/messages.0.gz
  36.7K Jan 24 19:27 /cf/var/log/rtlogd.0.gz
  34.9K Jan 24 19:26 /cf/var/log/rtlogd.1.gz
  19.5K Jan 24 19:28 /cf/var/log/traffic-create.0.gz
  12.2K Jan 24 19:28 /cf/var/log/traffic-deny.0.gz
  20.8K Jan 24 19:24 /cf/var/log/traffic-deny.1.gz
   152B Jan 24 19:16 /cf/var/log/wtmp.0.gz
    27B Jan 24 18:38 /cf/var/log/wtmp.1.gz
Delete these files ? [yes,no] (no)

But still not too much space freed up.
Followed these steps from

"
After the cleanup, if there is still not enough space for the upgrade, perform the following procedure:

  1. Start  the shell by using start shell command on the CLI.

  2. Issue the following command on the shell:
    find -x /cf/var -type f -exec du -k {} \; | sort –n

  3. Delete the files at the end of the above generated output.  Here is an example:
        18256   /cf/var/lost+found/#11136/flowd_octeon.core.1.gz
        19600   /cf/var/lost+found/#11136/flowd_octeon.core.0.gz
    
    The first column displays the file size in kilobytes and the second column displays the file location.

  4. You can also find files, which are greater in than the specific value. For example, the following command will show files whose size will be more than 10MB:
          sh -c 'find / -size +10485760c 2> /dev/null' | xargs du -h | sort -nr

"

% sh -c 'find / -size +10485760c 2> /dev/null' | xargs du -h | sort -nr
210M    /cf/packages/junos-10.4R8.5-domestic
 32M    /cf/var/db/idpd/db/secdb.d02
 27M    /usr/sbin/flowd_octeon_hm
 24M    /usr/sbin/flowd_octeon
 20M    /cf/var/db/idpd/nsm-download/SignatureUpdate.xml
 16M    /usr/sbin/rpd
 12M    /cf/var/db/ai_cache/dfa_group_cache.d02
 11M    /mfs/var/run/db/schema.db
 10M    /usr/sbin/authd





Another interesting thing is software backup can not be deleted for somehow even we requested to do system software delete-backup.
# run show system software backup  
Backup JUNOS package information:
File name: /altroot/cf/packages/junos-11.2R2.4-domestic
File size: 145507179



> request system software delete-backup 
Delete backup system software package [yes,no] (no) yes



4 comments:

  1. Well the topic you have choose is really unique and information is ultimate you gave us. I completely enjoyed the post and hoping more post from you soon.
    juniper srx

    ReplyDelete
  2. I was searching on Google with the Keywords "How to Clean-up Space on Juniper SRX Devices" and found your blog. Its providing complete information. Much thanks to Admin.

    ReplyDelete
  3. very very helpful information!!! you're awesome!!!

    ReplyDelete