Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[NSM] How to reduce the disk space usage on the NSM server

0

0

Article ID: KB25651 KB Last Updated: 26 Aug 2013Version: 2.0
Summary:

This article describes various options available to reduce the disk space on the NSM server.

Option A:  Reduce the number of NSM backups.

Option B:  Reduce the disk space by moving/deleting the logs from the managed devices on NSM.

Option C:  Remove the unnecessary schema files from NSM.

Option D:  Reduce the size of the NSM database.

Option E:   Remove the NSM manual backups and logs.

Option F:   Remove the unrequired device firmware files.


Symptoms:
NSM services may stop when any of the /var partition(s) reach disk utilization near 100%. 

Cause:

Solution:

Login to the NSM CLI as root user and run the command: “df –h” to check the disk space usage on NSM. to determine where you need to free disk space.

Option A: NSM nightly backups. (/var/netscreen/dbbackup)


Step 1: Navigate to the dbbackup partition “cd /var/netscreen/dbbackup” and Check the number of backups on the server with this command: ls -al

Step 2: Check the size of backups using the command: du -hs backup*

Note: By default NSM has seven backups at a time. In this example, having seven backups could take a lot of space on your server unnecessarily. You may choose to either delete or move some of the backups to reduce the space temporarily using the appropriate commands.

Step 3: (Optional) Archive the backup with the command:
tar -czvf backup.tar.gz backup<1-7>
For ex: tar -czvf backup.tar.gz backup1


Move the backup.tar.gz file to your desktop with the winscp software.

Step 4: Check the date when the backup was taken, with the command: " ls -al" so as to decide what to archive or delete first.

Delete the older backup with the command:
rm -rf backup<1-7>
For ex: rm -rf backup1


Step 5: Reduce the number of backups to be taken by making changes to the haSvr.cfg file:

Note: Make a copy of the haSvr.cfg file before making changes to it:

cd /usr/netscreen/HaSvr/var
cp -p haSvr.cfg haSvr.cfg.old


Step 6: Navigate to haSvr.cfg file in the /usr/netscreen/HaSvr/var directory and edit the same using the commands:
cd /usr/netscreen/HaSvr/var
vi haSvr.cfg


Step 7: Navigate to the line that contains highAvail.numOfBackups 7 using the arrow keys. Press i to insert, change the value from 7 to 2 or 3, then Press ESC and type “:wq! “ to save the changes.

In case you have a HA environment, Changes needs to be done on haSvr.cfg file of the secondary server as well, Please follow Steps 6 - 8 on the Standy server as well.

Step 8: Reload haSvr for the changes to take effect

/etc/init.d/haSvr reload

Option B: Device Logs (/var/netscreen/DevSvr/logs)


Preferred Method: KB22026 Managing the Device log volume in NSM via GUI client:
http://kb.juniper.net/InfoCenter/index?page=content&id=KB22026

If you are not able to access the GUI, manually move or delete the unwanted device logs.

NSM stores the logs from all the devices for one day by creating a directory in the pattern <yyyymmdd> in /var/netscreen/DevSvr/logs directory.

Step 1: Navigate to " cd /var/netscreen/DevSvr/logs " and check the number of logs with this command “ls –al

Step 2: Check the size of one log directory to estimate the amount of logs: du -hs <LogDirectoryName>

Note: In case of a HA environment, please check the status of the Database ( Should be in Sync) using the following command before you stop the services:
/usr/netscreen/HaSvr/utils/haStatus

Step 3: Stop the services before deleting or moving the logs:

HA Environment
On Standby server : /etc/init.d/haSvr stop
On Active server : /etc/init.d/haSvr stop


Stand-alone
/etc/init.d/haSvr stop
/etc/init.d/guiSvr stop
/etc/init.d/devSvr stop


Step 4: (Optional) : In order to Archive the logs:

Navigate to “ cd /var/netscreen/DevSvr/logs/” and run the command:
tar -cvzf logs.tar.gz <yyyymmdd>

For example, to archive all the logs for the year 2011: tar -cvzf logs.tar.gz 2011*
For example, to archive the logs for the month of January, 2012: tar -cvzf logs.tar.gz 201201*

Move the logs.tar.gz file to your desktop with the command winscp software.

Step 5: Delete the older logs with this command:

rm -rf <LogDirectoryName>
For example, to delete all the logs for the month of January, 2011: rm -rf 201101*

Step 6: Re Indexing of the logs has to be done when you move or delete the logs, Please run the following command for the same
rm -rf index*

Step 7:
Start the services:

HA Environment
On Active server : /etc/init.d/haSvr start
On Standby server : /etc/init.d/haSvr start


Stand-alone
/etc/init.d/haSvr start
/etc/init.d/guiSvr start
/etc/init.d/devSvr start

Option C: Remove Unnecessary Schema files from NSM. (/var/netscreen/GuiSvr/dmi_schema_stage)


These files are included in the Nightly Backups, After clearning these files, if it has not been done already, your nightly backup size will be greatly reduced

The following commands can be run in order to remove the unnecessary schema files from the NSM:

IMPORTANT: There must be NO spaces before any of the " * " or you could delete all the files on your system.


rm -rf /usr/netscreen/GuiSvr/var/dmi-schema-stage/nsm/dmi/*/releases/*/.svn/text-base/*
rm -rf /usr/netscreen/GuiSvr/lib/initVar/dmi-schema-stage/nsm/dmi/*/releases/*/.svn/text-base/*

Option D: Reduce the database size. (/var/netscreen/GuiSvr/xdb/data)


Check the size of the database with this command:
du -hs /var/netscreen/GuiSvr/xdb/data

In case you have a database with a size greater than 3GB, you may refer the following Knowledge Base article to decrease the size of the database:
http://kb.juniper.net/KB11731

Option E: NSM manual backups and Logs (/var/netscreen/GuiSvr) (/var/netscreen/DevSvr) (/var/netscreen/GuiSvr/xdb)


dmi_schema_state.old:
dmi_schema_stage.old folder is a backup created when you revert the schema to base version  Keeping it is unnecessary after schema revert 

Login to NSM as root user: 

cd /var/netscreen/GuiSvr

Check for the existance of  "dmi_schema_stage.old"

ls -l

if it exists, remove it:
rm -rf dmi_schema_stage.old

Manual Database Backups:
Check for any Manual Database backups that may be taken by running the tech-support utility.
The File will be in the format "GuiSvrDB*.tar.gz" in the /var/netscreen/GuiSvr directory.

cd /var/netscreen/GuiSvr/

Look at what exists:

ls -l

Delete files: (or selective if you prefer)
rm  GuiSvrDB*.tar.gz 


XDB Export/Import Backups:

Check for the database backup taken by the NSM during the database export import process.
This file will be in format of xdb*.tar.gz in the /var/netscreen/GuiSvr/xdb/ directory.

cd /var/netscreen/GuiSvr/xdb/ 

Look at what exists:
ls -l

Remove all: (or selective if you prefer)
rm xdb*.tar.gz

Log Collections:
Check for the GuiSvr and DevSvr troubleshooting logs taken manually by running tech-support utility.

GuiSvr:
cd /var/netscreen/GuiSv

Look at what exists:
ls -l

Remove all: (or selective if you prefer)
rm GuiSvr*.tar.gz 

DevSvr:
 cd /var/netscreen/DevSvr 

Look at what exists:
ls -l

Remove all: (or selective if you prefer)
rm DevSvr*.tar.gz 

HaSvr:
cd /usr/netscreen/HaSvr/var/ 

Look at what exists:
ls -l

Remove all: (or selective if you prefer)
rm HaSvr*.tar.gz

Option F: Device Firmware Files (/var/netscreen/GuiSvr/firmware) (/var/netscreen/DevSvr/firmware)


You may also delete the device firmware files by following the commands as below:

Login to NSM Cli as root user and Navigate to the directory:
cd /var/netscreen/GuiSvr/firmware

Look at what exists:
ls -l

Remove The files: (or selective if you prefer)
rm *.0
rm *.gz

Do the same for the DevSvr:  navigate to 

cd /var/netscreen/DevSvr/firmware

Look at what exists:
ls -l

Remove The files: (or selective if you prefer)
rm *.0
rm *.gz

Related Links

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search