ADC

How to free space on the /var directory

The following article explains how an administrator can free the space from the /var directory of a NetScaler appliance. You can follow the steps when the GUI is not accessible.

When the amount of disk space is low in the /var directory of the appliance, you might not be able to sign in to the GUI. In this scenario, you can remove the old log files to create free space in the /var directory.

Points to remember

  • Ensure that you back up the files before removing the files from the appliance.

To free space in the /var directory of a NetScaler appliance, complete the following procedure:

  1. Log on to the CLI of NetScaler by using SSH. For more information to complete this task, see the NetScaler Documentation.
  2. After you log on to the NetScaler CLI, switch to the shell prompt using the following command. shell
  3. Run the following command to see the availability of space on the NetScaler appliance. df -h
  4. If the memory capacity of the /var directory is filled up to 90 percent, then you must delete few files from this directory.

    • Run the following commands to view the contents of the /var directory: cd /var ls -l

    The directories that are usually of interest are as follows:

    /var/nstrace - This directory contains trace files.This is the most common reason for HDD being filled on the NetScaler appliance. This is due to an nstrace being left running for indefinite amount of time. All traces that are not of interest can and should be deleted. To stop an nstrace, go back to the CLI and issue stop nstrace command.
    
    /var/log - This directory contains system specific log files.
    
    /var/nslog - This directory contains NetScaler log files.
    
    /var/tmp/support - This directory contains technical support files, also known as, support bundles. All files not of interest should be deleted.
    
    /var/core - Core dumps are stored in this directory. There will be directories within this directory and they will be labeled with numbers starting with 1. These files can be quite large in size. Clear all files unless the core dumps are recent and investigation is required.
    
    /var/crash - Crash files, such as process crashes are stored in this directory. Clear all files unless the crashes are recent and investigation is required.
    
    /var/nsinstall -  Firmware is placed in this directory when upgrading. Clear all files, except the firmware that is currently being used.
    
    • Verify if any of the directories are using more space:

      du -hs *
      44k    cache
      2.0k    clusterd
      2.0k    configdb
      6.0k    core
      989M    crash
      4.0k    cron
      2.0k    dev
      6.0k    download
      2.0k    gui
      2.0k    install
      2.0k    krb
      2.0k    learnt_data
      122M    log
      366M    NetScaler
      14k    ns_gui
      86k    ns_sys_backup
      631M    nsinstall
      883M    nslog
      32k    nsproflog
      2.0k    nssynclog
      16k    nstemplates
      36k    nstmp
      4.5G    nstrace
      8.1M    opt
      6.0k    pubkey
      52k    run
      28M    safenet
      72M    tmp
      2.0k   vmtools
      14k    vpn
      
  • Delete the files which are not required:

     rm -r nstrace/*
    

    For more help on deleting files see FreeBSD Man Pages.

    • Delete the files which are not required. rm -r nstrace/* For more help on deleting files see FreeBSD Man Pages.
    • If the log or nslog directory is using more space, then run the following commands to open the log directory and view its contents:

       cd /var/log
       ls -l
       cd /var/nslog
       ls -l
      
  1. Ensure that all files are compressed. This is indicated by the .tar.gz file name extension.

    If the file is not compressed, perform the following:

    For compressing the file to .gz format:

     cd /var/log
     gzip <filename>
    

    Compressed file is placed at /var/log

    For compressing the file to .tar.gz format:

     cd /var/nslog
     tar -cz <filename>.tar.gz <filename>
    

    Compressed file is placed at /var/nslog

  2. If you are using NetScaler Console, then verify the /var/ns_system_backup directory. Ensure that NetScaler Console clears the backup files it creates.

More resources

For information on any of the commands mentioned in the preceding procedure, see http://ss64.com/bash/.

How to free space on the /var directory