CCNA 200-301

CCNP Enterprise

CCNP Security

CCIE Enterprise Lab

CCIE Security Lab

CCNP Service Provider

CCNP Data Center

CCNP Collaboration

CCIE DC Lab

Running out of space on a Cisco switch can halt a scheduled firmware upgrade, prevent configuration backups, or trigger packet drops during peak traffic. Because Cisco operating systems divide device capacity across multiple storage tiers and memory pools, checking available space requires targeting the right subsystem for your task. Whether you are auditing persistent flash storage before copying a new IOS image, inspecting operational RAM during a high-utilization alert, verifying capacity across every member of a Catalyst switch stack, or automating pre-upgrade checks across hundreds of devices, the commands and workflows below cover every platform.

Flash Storage vs. NVRAM vs. DRAM: Understanding Cisco Switch Memory Types

Before running storage commands, it is essential to distinguish between persistent file storage (flash: or bootflash:), non-volatile configuration memory (nvram:), and volatile operational memory (DRAM). Network administrators troubleshooting performance issues need to check volatile DRAM pools, whereas engineers preparing for a software upgrade need to check persistent flash storage.

Memory / Storage TypeVolatilityPrimary ContentsTypical CapacityPrimary CLI Verification CommandsKey Output Metric to Check
Flash Storage (flash: / bootflash:)Non-volatile (Persistent across reboots)IOS/IOS-XE/NX-OS images (.bin, .pkg), packages.conf, vlan.dat, crashinfo logs, backup configs64 MB (legacy IOS) to 16 GB–120+ GB (Catalyst 9000 / Nexus 9000)dir flash:
show flash:
dir bootflash: (NX-OS)
bytes free (at the bottom of the directory listing)
NVRAM (nvram:)Non-volatile (Persistent across reboots)startup-config file, private-config, cryptographic persistent keys512 KB to 32 MBdir nvram:
show file systems
bytes free or Free(b) row next to nvram:
DRAM / Operational RAM (system:)Volatile (Cleared on power cycle/reload)running-config, routing/MAC/ARP tables, packet buffers, active OS processes128 MB (legacy) to 8 GB–32 GB (modern Catalyst/Nexus)show memory statistics
show processes memory sorted
show platform resources (IOS-XE)
Free(b) column (IOS) or Free MB/percentage under Control Processor (IOS-XE)

Checking Free Operational RAM (DRAM)

To inspect volatile operational memory rather than file storage, use the memory diagnostic commands in privileged EXEC mode:

  1. Check overall memory pools (show memory statistics):
    text
    Switch# show memory statistics
    Head Total(b) Used(b) Free(b) Lowest(b) Largest(b)
    Processor 7F8A1000 814572800 312451200 502121600 489102400 498120100
    I/O F000000 67108864 31457280 35651584 34102000 35120000
  2. Processor Pool: Memory used by IOS processes, routing protocols, and the running configuration.
  3. I/O Pool: Memory reserved for packet buffers and interface queues.
  4. Free(b) and Largest(b): Free(b) shows total unallocated DRAM in bytes, while Largest(b) indicates the largest contiguous block of free RAM (critical for diagnosing memory fragmentation).

  5. Identify top memory-consuming processes (show processes memory sorted):
    text
    Switch# show processes memory sorted
    Processor Pool Total: 2147483648 Used: 842105600 Free: 1305378048
    PID TTY Allocated Freed Holding Getbufs Retbufs Process
    312 0 412054120 12041200 398412000 0 0 linux_iosd-imag

    On modern Cisco IOS-XE switches (such as the Catalyst 9000 series), you can also run show platform resources or show platform software status control-processor brief to view Linux-level DRAM utilization in megabytes and percentages.

Takeaway: Always verify whether your task requires operational DRAM (show memory statistics) or persistent disk capacity (dir flash:) before troubleshooting capacity warnings.


How to Check Free Flash Space on Cisco IOS and IOS-XE Switches

Once you confirm that you need to inspect persistent storage—such as before uploading a new .bin image—you can check available flash capacity using standard Cisco CLI commands.

Step 1: Run dir flash: or show flash: in Privileged EXEC Mode

Log into the switch, enter privileged EXEC mode (enable), and execute either dir flash: or show flash:. On modern Cisco IOS and IOS-XE Catalyst switches, both commands produce the directory listing of the default internal flash memory and report remaining space at the bottom.

Switch# dir flash:
Directory of flash:/

43009  -rw-        4096   Nov 10 2026 08:14:22 +00:00  vlan.dat
43010  -rw-  1084221540   Nov 10 2026 08:20:11 +00:00  cat9k_iosxe.17.09.04a.SPA.bin
43011  -rw-        1245   Nov 10 2026 08:21:05 +00:00  packages.conf

11353194496 bytes total (6428192768 bytes free)

(Note: On legacy Cisco IOS platforms, show flash: displays additional hardware sector/chip details while dir flash: shows a standard file listing; on modern IOS-XE platforms, show flash: is an alias for dir flash:).

Step 2: Interpret the bytes free Output

Look at the final summary line of the output:
11353194496 bytes total (6428192768 bytes free)

Cisco IOS reports storage strictly in raw bytes. To quickly convert the bytes free number into human-readable units before copying a file:
* Convert to Megabytes (MB, decimal): Move the decimal point 6 places to the left (or divide by 1,000,000). In the example above, 6,428,192,768 bytes free is approximately 6,428 MB.
* Convert to Mebibytes (MiB, binary): Divide by 1,048,576 (1024 × 1024), which equals 6,130.4 MiB.
* Convert to Gigabytes (GB, decimal): Move the decimal point 9 places to the left (6.42 GB).

When upgrading a switch in Install Mode, ensure your bytes free exceeds the size of the new .bin image plus enough room to extract the .pkg files (typically at least 2 to 2.5 times the size of the .bin file).

Step 3: View All Storage Partitions at a Glance

If you want a high-level summary of free and total space across all local partitions (including USB drives and NVRAM) without listing individual files, run show file systems:

Switch# show file systems
File Systems:

       Size(b)       Free(b)      Type  Flags  Prefixes
*  11353194496    6428192768      disk     rw  flash: bootflash:
    1651507200    1612185600      disk     rw  crashinfo:
       2097152       2074624     nvram     rw  nvram:
    7811891200    7104215040      disk     rw  usbflash0:

The asterisk (*) designates the current default file system (flash:), and the Size(b) and Free(b) columns allow you to compare available bytes across internal flash, crashinfo:, and any attached USB drives (usbflash0:) immediately.

Takeaway: Use dir flash: to inspect both large files and remaining bytes free, or show file systems for an instant table of total and free bytes across all mounted partitions.


Checking Available Storage on Cisco Switch Stacks and Nexus (NX-OS) Switches

While checking flash: works for a standalone Catalyst switch, multi-switch Catalyst stacks and data center Cisco Nexus switches use distinct storage architectures that require checking specific member or supervisor prefixes.

Checking All Member Switches in a Cisco Catalyst Stack

In a Cisco StackWise or StackWise Virtual deployment, running dir flash: only displays the flash storage of the Active switch (Switch 1 in most stacks). However, an IOS-XE software upgrade installs packages onto every stack member simultaneously. If Switch 1 has 5 GB free but Switch 3 only has 400 MB free, the upgrade will fail.

  1. Identify active stack members (show switch):
    “`text
    Switch# show switch
    Switch/Stack Mac Address : 00a2.8912.3400 – Local Mac Address
    H/W Current
    Switch# Role Mac Address Priority Version State

*1 Active 00a2.8912.3400 15 V02 Ready
2 Standby 00a2.8912.3480 14 V02 Ready
3 Member 00a2.8912.3500 10 V02 Ready
“`

  1. List the exact flash prefixes for your stack (show file systems):
    Depending on your Catalyst model and IOS-XE version, member switches use either flash-1:, flash-2:, flash-3: (common on Catalyst 9200/9300 and 3850/3650 stacks) or flash1:, flash2: (common on older 2960-X/3750-X stacks), as well as stby-flash: for the standby supervisor.

  2. Check free space on each stack member individually:
    “`text
    Switch# dir flash-1: | include bytes total
    11353194496 bytes total (6428192768 bytes free)

Switch# dir flash-2: | include bytes total
11353194496 bytes total (6419804160 bytes free)

Switch# dir flash-3: | include bytes total
11353194496 bytes total (1120401408 bytes free)
``
Piping the command to
| include bytes total` skips the long file list and prints only the capacity summary for each switch member.

Checking Free Space on Cisco Nexus (NX-OS) Switches

Cisco Nexus switches running NX-OS use bootflash: instead of flash: as their primary internal solid-state storage.

  1. Check the active supervisor (dir bootflash:):
    “`text
    N9K-Switch# dir bootflash:
    4096 Jun 06 03:30:14 2026 .rpmstore/
    4096 Jun 06 03:30:35 2026 .swtam/
    1964521472 Aug 14 01:12:40 2026 nxos64-cs.10.3.4a.M.bin
    4132 Nov 02 06:17:33 2026 vlan.dat

Usage for bootflash://sup-local
4148449280 bytes used
112038109184 bytes free
116186558464 bytes total
``
Unlike IOS, NX-OS prints a three-line summary block under
Usage for bootflash://sup-localexplicitly breaking downbytes used,bytes free, andbytes total`.

  1. Check the standby supervisor on dual-supervisor Nexus chassis:
    On modular Nexus switches (such as Nexus 7000 or 9500 series) with dual supervisors, verify the standby supervisor’s storage before running install all:
    text
    N9K-Switch# dir bootflash://sup-standby/

    (Note: You can also use dir bootflash://sup-remote/ as an alias for the standby supervisor, or inspect temporary RAM disk usage with dir volatile: and log storage with dir log:).

Takeaway: On Catalyst stacks, always inspect every member switch (dir flash-1:, dir flash-2:, etc.) prior to upgrading; on Nexus switches, check dir bootflash: and dir bootflash://sup-standby/.


How to Safely Free Up Flash Space for an IOS Upgrade

If your storage check reveals insufficient free space to copy or extract a new firmware image, you must clean up obsolete files without deleting the active boot files. Follow the sequential steps below based on whether your switch runs in Install Mode (standard on Catalyst 9000, 3850, and 3650 series) or Bundle Mode (monolithic .bin boot).

Step 1: Verify the Active Image and Boot Variables First

Before removing any file from flash, confirm which image or package file the switch is currently running and configured to boot on the next reload:

Switch# show version | include System image file
System image file is "flash:packages.conf"

Switch# show boot
BOOT variable = flash:packages.conf;
  • If System image file points to flash:packages.conf, the switch is running in Install Mode. Never delete packages.conf or the .pkg files referenced inside it (you can view them using more flash:packages.conf).
  • If System image file points directly to a .bin file, the switch is running in Bundle Mode. Never delete that specific .bin file.

Step 2: Clean Up Inactive Packages in Install Mode (Catalyst 9000 / 3850 / 3650)

On modern IOS-XE switches running in Install Mode, Cisco provides a built-in cleanup command that automatically inspects packages.conf across all stack members, identifies all .bin files and uncommitted/inactive .pkg files not currently in use, and prompts you before deleting them:

  1. For Cisco IOS-XE 16.10.1 and all 17.x+ releases:
    “`text
    Switch# install remove inactive
    install_remove: START Sun Nov 15 04:12:09 UTC 2026
    Cleaning up unnecessary package files
    Scanning boot directory for packages … done.
    Preparing packages list to delete …
    cat9k-cc_srdriver.17.06.05.SPA.pkg
    File is in use, will not delete.
    …
    cat9k_iosxe.17.06.05.SPA.bin
    File is not in use, will delete.

The following files will be deleted:

Do you want to remove the above files? [y/n] y
``
Review the list of files slated for deletion, then type
y` and press Enter to reclaim the space across all switches in the stack.

  1. For older Cisco IOS-XE 16.x releases (prior to 16.10.1) or 3.x releases:
    If install remove inactive is not supported on your software version, use the platform software clean command instead:
    text
    Switch# request platform software package clean switch all file flash:

Step 3: Manually Delete Old .bin Files, Core Dumps, and Crashinfo Logs

If your switch runs in Bundle Mode, or if leftover archive files, packet captures (.pcap), or core dumps are filling up flash storage, remove them manually:

  1. Delete an obsolete .bin image without confirmation prompts:
    text
    Switch# delete /force flash:c2960x-universalk9-mz.152-4.E7.bin
  2. Delete an old HTML archive directory (common on legacy Catalyst switches):
    text
    Switch# delete /force /recursive flash:c2960x-universalk9-mz.152-4.E7
  3. Clear old core dumps and crashinfo files:
    Check dir flash:core/ and dir crashinfo: for large diagnostic dump files generated during past crashes. Once you have offloaded any needed troubleshooting logs to an external server, remove them:
    text
    Switch# delete /force flash:core/*.core.gz
    Switch# delete /force crashinfo:crashinfo_20250412-091522-UTC

    (Note: On very old Class A Flash file systems where deleted files are merely marked as “deleted” rather than erased, run squeeze flash: to permanently reclaim the space).

Takeaway: Always use install remove inactive on modern IOS-XE Install Mode switches to safely purge unused .bin and .pkg files across all stack members, and always verify show boot before running manual delete commands.


Automating Flash Space Checks with Ansible and Python

When preparing for a network-wide maintenance window, manually logging into dozens or hundreds of switches to check bytes free is slow and error-prone. You can use the following Ansible playbook or Python Netmiko script to audit free flash storage across your entire inventory automatically.

Option 1: Ansible Playbook Using cisco.ios.ios_facts

The cisco.ios.ios_facts module (with gather_subset: hardware) populates the ansible_net_filesystems_info dictionary, which reports spacefree_kb and spacetotal_kb for every mounted file system:

---
- name: Audit Free Flash Space on Cisco IOS/IOS-XE Switches
  hosts: cisco_switches
  gather_facts: false
  vars:
    # Minimum required free space in Kilobytes (e.g., 1,500,000 KB = ~1.5 GB)
    min_free_space_kb: 1500000

  tasks:
    - name: Gather hardware and filesystem facts from switches
      cisco.ios.ios_facts:
        gather_subset:
          - hardware

    - name: Display current free flash space in MB
      ansible.builtin.debug:
        msg: >-
          Switch {{ ansible_net_hostname }} has
          {{ (ansible_net_filesystems_info['flash:']['spacefree_kb'] / 1024) | round(1) }} MB free
          out of {{ (ansible_net_filesystems_info['flash:']['spacetotal_kb'] / 1024) | round(1) }} MB total.
      when: "'flash:' in ansible_net_filesystems_info"

    - name: Assert sufficient free flash space for IOS upgrade
      ansible.builtin.assert:
        that:
          - ansible_net_filesystems_info['flash:']['spacefree_kb'] | int >= min_free_space_kb
        fail_msg: >-
          INSUFFICIENT SPACE on {{ inventory_hostname }}:
          Only {{ (ansible_net_filesystems_info['flash:']['spacefree_kb'] / 1024) | round(1) }} MB free.
          Run 'install remove inactive' before upgrading.
        success_msg: >-
          PASS: {{ inventory_hostname }} meets the minimum storage threshold.
      when: "'flash:' in ansible_net_filesystems_info"

Option 2: Python Script Using Netmiko (Supports Stack Members)

To check all member switches in a Catalyst stack (flash:, flash-1:, flash-2:, etc.) using Python and Netmiko:

import re
from netmiko import ConnectHandler

SWITCHES = [
    {"device_type": "cisco_ios", "host": "10.10.1.10", "username": "admin", "password": "YourPassword"},
    {"device_type": "cisco_ios", "host": "10.10.1.11", "username": "admin", "password": "YourPassword"},
]

MIN_FREE_BYTES = 1_500_000_000  # 1.5 GB threshold

def check_switch_storage(device):
    with ConnectHandler(**device) as conn:
        fs_output = conn.send_command("show file systems")
        # Match flash:, flash-1:, flash-2:, or bootflash: lines with Size(b) and Free(b)
        pattern = re.compile(r"^\*?\s*(\d+)\s+(\d+)\s+disk\s+\S+\s+(flash(?:-\d+)?:|bootflash:)", re.MULTILINE)
        matches = pattern.findall(fs_output)

        for total_b, free_b, prefix in matches:
            free_bytes = int(free_b)
            free_mb = free_bytes / (1024 * 1024)
            status = "PASS" if free_bytes >= MIN_FREE_BYTES else "FAIL (LOW SPACE)"
            print(f"[{device['host']}] {prefix:<12} Free: {free_mb:>8.2f} MB  --> {status}")

if __name__ == "__main__":
    for sw in SWITCHES:
        check_switch_storage(sw)

Takeaway: Integrating cisco.ios.ios_facts or a Netmiko pre-check into your upgrade workflow catches low-storage devices before file transfers fail mid-maintenance.


Cisco IOS File System (IFS) Reference and Official Documentation

For engineers requiring exact syntax specifications and command references, the Cisco IOS File System (IFS) provides a standardized Uniform Resource Locator (URL) interface to manage internal flash memory, NVRAM, and remote network file servers across all Cisco platforms.

IFS URL Syntax Specification

All file system operations in Cisco IOS and IOS-XE adhere to the following URL structure:

[prefix:][directory/][filename]

Standard Local and Network IFS Prefixes

  • flash: — Default internal flash storage on standalone switches and active stack masters.
  • bootflash: — Internal solid-state boot storage on Cisco IOS-XE modular switches/routers and Cisco Nexus (NX-OS) platforms.
  • flash-n: / flashn: — Member-specific internal flash storage for switch number n in a Catalyst StackWise stack (for example, flash-1:, flash-2:).
  • stby-flash: / slavebootflash: — Internal flash storage located on the standby supervisor or standby stack member.
  • usbflash0: / usbflash1: (or usb1: on NX-OS) — External USB flash storage drives inserted into the switch chassis.
  • nvram: — Non-volatile RAM storing startup-config and private-config.
  • system: — Volatile system memory containing the active running-config.
  • crashinfo: — Dedicated partition storing diagnostic stack traces and exception logs.
  • tftp: / ftp: / scp: / sftp: / http: / https: — Network file system prefixes for transferring images and configuration files to or from remote servers.

Core IFS Management Commands

  • show file systems — Lists all supported file system prefixes on the hardware platform along with Size(b), Free(b), media Type, and read/write Flags.
  • dir [/all] [filesystem:] — Lists visible files (or all undeleted/hidden files with /all) and displays total and free bytes.
  • pwd — Prints the active working file system directory (defaults to flash:).
  • cd [filesystem:][directory] — Changes the default working file system or subdirectory.
  • show file information <file-url> — Displays file type and structural metadata for a specific file.
  • show file descriptors — Displays currently open file descriptors to determine if another session or process has locked a file in flash.
  • verify [/md5] <file-url> — Computes and verifies the MD5 checksum or embedded digital signature of an image file in flash.

Official Cisco Documentation References

  • Cisco IOS Configuration Fundamentals Command Reference: Contains complete syntax definitions for show file systems, dir, show flash:, delete, squeeze, show memory, and show processes memory.
  • System Management Configuration Guide, Cisco IOS XE (Catalyst 9200 / 9300 / 9400 / 9500 Switches): Chapter Performing Setup and Configuration / Managing Configuration Files and Software Images details Install Mode package management (install remove inactive) and stack file system prefixes.
  • Cisco Nexus 9000 Series NX-OS Fundamentals Configuration Guide: Chapter Using the Device File Systems, Directories, and Files defines bootflash:, volatile:, and supervisor module file operations.

Takeaway: Refer to the Cisco IFS prefix list (show file systems) and the platform-specific System Management Configuration Guide whenever working across unfamiliar Cisco hardware series.


Conclusion

Checking free space on a Cisco switch starts with targeting the right resource: use show memory statistics and show processes memory sorted when diagnosing operational DRAM utilization, and use dir flash: or show file systems when verifying persistent storage capacity. Before initiating any firmware upgrade, remember to check every member in a Catalyst switch stack (dir flash-1:, dir flash-2:) or both supervisors on a Nexus chassis (dir bootflash:), and run install remove inactive to safely clear out obsolete software packages.

Please follow and like us:
Last modified: November 17, 2026

Author

Comments

Write a Reply or Comment

Your email address will not be published.