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 NetScaler. You can follow the steps when the GUI is not accessible.

When the amount of disk space is low in the /var directory of NetScaler, 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.

Important

Make sure to back up the files before deleting them from NetScaler.

Free up disk space in the /var directory on NetScaler

To free space in the /var directory of NetScaler, 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 shell command.
  3. Check the space available on NetScaler by running the df -h command.
  4. If the memory capacity of the /var directory reaches 90%, you must delete some files to free up space.

    Note:

    Before performing an upgrade, make sure that there is enough available space in the /var directory. The /var directory requires 7 GB of free space: 1 GB for the upgrade bundle, 2 GB for extraction, and 4 GB for the upgrade process.

  5. View the contents of the /var directory by running the ls -l /var command.

    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 NetScaler. This is due to a nstrace being left running for an indefinite amount of time. Delete all traces that are not required. To stop an nstrace, run stop nstrace command from the CLI.
    • /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.
  6. Check the memory usage of different files and directories within the /var directory by running the du -hs /var/* command.

        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
    
  7. Delete or compress any unnecessary files or those using excessive memory.

    • In the preceding example, nstrace directory is taking up more space. If it is not required, delete the files in this directory by running the following command: rm -r nstrace/*.

      For more help on deleting files, see the FreeBSD documentation.

    • If the log or nslog directory is using more space.
      • View the contents of the log or nslog directories by running the following commands:

          cd /var/log
          ls -l
          cd /var/nslog
          ls -l
          <!--NeedCopy-->
        
      • Compress all the files. The .tar.gz file name extension indicates that the file is both archived and compressed.

        If the file is not already compressed, you must compress them.

        To compress the file to .gz format:

         cd /var/log
         gzip <filename>
         <!--NeedCopy-->
        

        The compressed file is placed at the /var/log directory.

        To compress the file to .tar.gz format:

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

        The compressed file is placed at the /var/nslog directory.

    • If you are using NetScaler Console, 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 Linux commands.

How to free space on the /var directory