How to clean up old images on IOS XE


Problem

If you ever run into the following error messages:

%Error copying usbflash0:cat3k_caa-universalk9.SPA.03.06.04.E.152-2.E4.bin (Not enough space on device)

or

% flash: requires 295884 KB of free space, but only 167160 KB is available. Operation aborted.

You’ve run out of disk space on your flash!
If you did a dir, you may notice that you may have too many old images on the flash of your switch or router.

Directory of flash:/

 7746  -rw-    79110340  Nov 16 2014 17:22:17 -08:00  cat3k_caa-base.SPA.03.03.04SE.pkg
 7747  -rw-     6521532  Nov 16 2014 17:22:18 -08:00  cat3k_caa-drivers.SPA.03.03.04SE.pkg
 7748  -rw-    34530288  Nov 16 2014 17:22:17 -08:00  cat3k_caa-infra.SPA.03.03.04SE.pkg
 7749  -rw-    34856268  Nov 16 2014 17:22:18 -08:00  cat3k_caa-iosd-universalk9.SPA.150-1.EZ4.pkg
 7750  -rw-    25172880  Nov 16 2014 17:22:18 -08:00  cat3k_caa-platform.SPA.03.03.04SE.pkg
 7751  -rw-    77445952  Nov 16 2014 17:22:18 -08:00  cat3k_caa-wcm.SPA.10.1.140.0.pkg
 7755  -rw-        1247   Mar 1 2016 16:42:57 -08:00  packages.conf
 7753  -rw-     2097152  May 19 2016 09:38:51 -07:00  nvram_config
38723  -rw-        1247  Nov 16 2014 17:22:29 -08:00  packages.conf.02-
38724  -rw-        1236  Dec 10 2015 11:41:26 -08:00  packages.conf.01-
 7754  -rw-        1236  Jan 29 2016 10:45:59 -08:00  packages.conf.00-
 7752  -rw-         676  May 19 2016 09:38:45 -07:00  vlan.dat
 7757  -rw-    82657092  Dec 10 2015 11:41:21 -08:00  cat3k_caa-base.SPA.03.06.03E.pkg
 7758  -rw-     4922044  Dec 10 2015 11:41:21 -08:00  cat3k_caa-drivers.SPA.03.06.03E.pkg
 7759  -rw-    33782764  Dec 10 2015 11:41:21 -08:00  cat3k_caa-infra.SPA.03.06.03E.pkg
 7760  -rw-    42984768  Dec 10 2015 11:41:21 -08:00  cat3k_caa-iosd-universalk9.SPA.152-2.E3.pkg
 7761  -rw-    27382668  Dec 10 2015 11:41:21 -08:00  cat3k_caa-platform.SPA.03.06.03E.pkg
 7762  -rw-   111156032  Dec 10 2015 11:41:22 -08:00  cat3k_caa-wcm.SPA.10.2.131.0.pkg
54209  drwx        4096  Feb 12 2016 15:10:16 -08:00  dc_profile_dir
 7763  -rw-       14652  Jan 19 2016 11:24:43 -08:00  c3650-atong-jan19-16.cfg
 7764  -rw-       15938  Jan 19 2016 15:58:34 -08:00  C3650-RSAT2-4-jan19-16.cfg
 7765  -rw-   302988468  May 19 2016 09:58:43 -07:00  cat3k_caa-universalk9.SPA.03.06.04.E.152-2.E4.bin
15489  drwx        4096  Jan 29 2016 10:52:22 -08:00  vman_fdb
 7768  -rw-    82022500  Jan 29 2016 10:45:54 -08:00  cat3k_caa-base.SPA.03.07.03E.pkg
 7769  -rw-     5653180  Jan 29 2016 10:45:54 -08:00  cat3k_caa-drivers.SPA.03.07.03E.pkg
 7770  -rw-    36953096  Jan 29 2016 10:45:54 -08:00  cat3k_caa-infra.SPA.03.07.03E.pkg
 7771  -rw-    46236992  Jan 29 2016 10:45:54 -08:00  cat3k_caa-iosd-universalk9.SPA.152-3.E3.pkg
 7772  -rw-    28883852  Jan 29 2016 10:45:55 -08:00  cat3k_caa-platform.SPA.03.07.03E.pkg
 7773  -rw-   123237184  Jan 29 2016 10:45:55 -08:00  cat3k_caa-wcm.SPA.10.3.130.0.pkg
 7756  drwx        4096  Jan 29 2016 10:52:22 -08:00  virtual-instance
23233  drwx        4096  Jan 29 2016 10:53:48 -08:00  wnweb_store
15491  -rw-    79122052   Mar 1 2016 16:42:52 -08:00  cat3k_caa-base.SPA.03.03.05SE.pkg
15492  -rw-     6521532   Mar 1 2016 16:42:52 -08:00  cat3k_caa-drivers.SPA.03.03.05SE.pkg
15493  -rw-    34530288   Mar 1 2016 16:42:52 -08:00  cat3k_caa-infra.SPA.03.03.05SE.pkg
15494  -rw-    34846028   Mar 1 2016 16:42:53 -08:00  cat3k_caa-iosd-universalk9.SPA.150-1.EZ5.pkg
15495  -rw-    25170832   Mar 1 2016 16:42:53 -08:00  cat3k_caa-platform.SPA.03.03.05SE.pkg
15496  -rw-    77456192   Mar 1 2016 16:42:53 -08:00  cat3k_caa-wcm.SPA.10.1.150.0.pkg

How do you free up your flash without deleting the unused image files one by one?

Solution

Run the command:

switch# software clean

The operation will automatically find all the old images files that are not in use and deletes them all at once with a prompt.

Preparing clean operation ...
[1]: Cleaning up unnecessary package files
[1]: No path specified, will use booted path flash:packages.conf
[1]: Cleaning flash:
[1]: Preparing packages list to delete ...
     In use files, will not delete:
       cat3k_caa-base.SPA.03.03.05SE.pkg
       cat3k_caa-drivers.SPA.03.03.05SE.pkg
       cat3k_caa-infra.SPA.03.03.05SE.pkg
       cat3k_caa-iosd-universalk9.SPA.150-1.EZ5.pkg
       cat3k_caa-platform.SPA.03.03.05SE.pkg
       cat3k_caa-wcm.SPA.10.1.150.0.pkg
       packages.conf
[1]: Files that will be deleted:
    cat3k_caa-base.SPA.03.03.04SE.pkg
    cat3k_caa-base.SPA.03.06.03E.pkg
    cat3k_caa-base.SPA.03.07.03E.pkg
    cat3k_caa-drivers.SPA.03.03.04SE.pkg
    cat3k_caa-drivers.SPA.03.06.03E.pkg
    cat3k_caa-drivers.SPA.03.07.03E.pkg
    cat3k_caa-infra.SPA.03.03.04SE.pkg
    cat3k_caa-infra.SPA.03.06.03E.pkg
    cat3k_caa-infra.SPA.03.07.03E.pkg
    cat3k_caa-iosd-universalk9.SPA.150-1.EZ4.pkg
    cat3k_caa-iosd-universalk9.SPA.152-2.E3.pkg
    cat3k_caa-iosd-universalk9.SPA.152-3.E3.pkg
    cat3k_caa-platform.SPA.03.03.04SE.pkg
    cat3k_caa-platform.SPA.03.06.03E.pkg
    cat3k_caa-platform.SPA.03.07.03E.pkg
    cat3k_caa-universalk9.SPA.03.06.04.E.152-2.E4.bin
    cat3k_caa-wcm.SPA.10.1.140.0.pkg
    cat3k_caa-wcm.SPA.10.2.131.0.pkg
    cat3k_caa-wcm.SPA.10.3.130.0.pkg
    packages.conf.00-
    packages.conf.01-
    packages.conf.02-

[1]: Do you want to proceed with the deletion? [yes/no]: yes
Related Posts with Thumbnails

About the Author

Alfred Tong
Author and owner of this blog. A Networking enthusiast, full time networking and systems Engineer. Generally curious about all things IT.Certifications: GIAC GSEC, CCNP-S, CCNP, CCSP, CCDP, CCNA, RHCE, JNCIA - FWV