Cisco IOS Filesystem

Cisco IOS has a filesystem, just like your own computer. For large files, like the Cisco IOS operating system, it uses flash memory. The advantage of flash memory is that it’s less prone to failure than hard disks. The startup configuration is stored on NVRAM. It also uses some special prefixes to give the filesystem access to internal functions or external servers.

In this lesson, we’ll take a look how we can work with the filesystem and do things like copying files or creating folders.


In my example, I will use a Cisco 2811 router. Depending on your router or switch, your output might differ.


Let’s take a look at the Cisco IOS filesystem:

R1#show file systems 
File Systems:

       Size(b)       Free(b)      Type  Flags  Prefixes
             -             -    opaque     rw   archive:
             -             -    opaque     rw   system:
             -             -    opaque     rw   tmpsys:
             -             -    opaque     rw   null:
             -             -   network     rw   tftp:
*   3999793152    3794403328      disk     rw   flash:#
        245752        240580     nvram     rw   nvram:
             -             -    opaque     wo   syslog:
             -             -    opaque     rw   xmodem:
             -             -    opaque     rw   ymodem:
             -             -   network     rw   rcp:
             -             -   network     rw   pram:
             -             -   network     rw   http:
             -             -   network     rw   ftp:
             -             -   network     rw   scp:
             -             -    opaque     ro   tar:
             -             -   network     rw   https:
             -             -    opaque     ro   cns:

We do this with the show command. There’s a big list with items. Below the type column we see four different types:

  • opaque: these are used for some internal functions. For example, if you use the show running-config command it internally links to the system:running-config file.
  • network: this is used to give the filesystem access to external systems like TFTP, FTP or HTTP servers. We can use this to copy files from these external sources to our filesystem.
  • disk: this is used for storage devices like our flash memory or USB sticks.
  • nvram: this is the internal NVRAM where the startup-config file is saved.

The flags describe the permission for the filesystem:

  • ro: read only
  • rw: read and write
  • wo: write only

Here is an explanation of some of the prefixes we see above:

  • system: this is the system memory where the running-configuration is located.
  • null: if you copy a file here, it won’t be saved anywhere. This is useful if you want to figure out what the size is of a remote file (like on a TFTP server). In labs, it can be useful to copy a remote file to generate some bandwidth.
  • tftp: a remote TFTP server.
  • flash: the flash memory.
  • nvram: the internal NVRAM that stores the startup-configuration.
  • xmodem / ymodem: these are older protocols that can be used to copy files through the console.
  • rcp: used for external RCP (Remote Copy Protocol) servers.
  • http: to copy files from remote HTTP web servers.
  • ftp: to copy files from or to remote FTP servers.
  • scp: to copy files from or to remote SCP servers.
  • tar: to create TAR files, I will show this in this lesson.
  • https: to copy from remote HTTPS web servers.

Let’s take a closer look at the flash memory…

Display folders and files

Most files are stored on the flash memory. We can see the default folder that we are in with the pwd command:


As you can see, this is the flash folder. Let’s take a look at its contents with the dir command:

Directory of flash:/

    1  -rw-        1119  Sep 29 2015 11:11:52 +00:00  first-test-config.cfg
    2  -rw-        1184   Dec 3 2014 15:14:06 +00:00  R1-R2-ASA1-ASA2.cfg
    3  -rw-        1125  Dec 23 2014 13:41:32 +00:00  ASA1-first-test-config.cfg
    6  -rw-        1060  Aug 11 2015 12:53:50 +00:00  mpls-pe-ce-basic-addressing.cfg
    7  -rw-        1213  Sep 30 2015 15:05:02 +00:00  router-on-a-stick.cfg
    8  -rw-    67926080   Apr 2 2015 14:21:46 +00:00  c2800nm-adventerprisek9-mz.151-4.M10.bin
    9  -rw-        1199  Aug 27 2015 14:38:20 +00:00  mpls-vpn-pe-ce-rip.cfg
   10  -rw-        1235  Aug 27 2015 09:18:06 +00:00  mpls-vpn-pe-ce-bgp.cfg
   11  -rw-        1184   Sep 1 2015 12:10:44 +00:00  mpls-vpn-pe-ce-eigrp.cfg
   12  -rw-        1060   Sep 1 2015 16:00:28 +00:00  mpls-vpn-pe-ce.cfg
   13  -rw-        1205   Sep 2 2015 12:05:30 +00:00  mpls-vpn-pe-ce-ospf.cfg
   14  -rw-        1051   Sep 3 2015 10:56:26 +00:00  ipv6-nat64-v6v4.cfg
   15  -rw-        1185  Sep 28 2015 19:44:52 +00:00  asa1-asa2-active-standby-failover.cfg
   16  -rw-        1675   Oct 2 2015 15:13:18 +00:00  bgp-extended-acl-filtering.cfg
   17  -rw-        1346  Oct 18 2015 12:18:02 +00:00  second-test-config.cfg
   18  -rw-        1115   Dec 8 2015 21:32:14 +00:00  multicast-pim-dense-r1-to-r5.cfg
   19  -rw-        1115   Dec 8 2015 21:37:08 +00:00  multicast-pim-sparse-r1-to-r5.cfg
   20  -rw-        1048  Jan 18 2016 10:36:24 +00:00  frame-relay-hub-spoke.cfg
   21  -rw-        1041   Jun 4 2016 14:10:58 +00:00  router-backup-Jun--4-14-10-59.035-0
   22  -rw-        1100   Jun 4 2016 14:11:26 +00:00  router-backup-Jun--4-14-11-27.743-1
   23  -rw-        1156   Jun 4 2016 14:12:04 +00:00  router-backup-Jun--4-14-12-04.619-2
   24  -rw-        1156   Jun 4 2016 14:12:38 +00:00  router-backup-Jun--4-14-12-39.179-3
   25  -rw-    67929600   Nov 4 2016 12:11:22 +00:00  c2800nm-adventerprisek9-mz.151-4.M12a.bin

3999793152 bytes total (3794337792 bytes free)

Above you can see there is a bunch of stuff on my flash drive. There are some cfg (config) files and two IOS images, you can recognize those because of their size and they end with .bin.

Creating folders

Let’s see if we can create a new folder on our flash drive. I will create a folder called configs with the mkdir command:

R1#mkdir configs
Create directory filename [configs]? 
Created dir flash:configs

Let’s see if it’s there:

Directory of flash:/

    1  -rw-        1119  Sep 29 2015 11:11:52 +00:00  first-test-config.cfg
   26  drw-           0  Jan 31 2017 10:31:58 +00:00  configs
    2  -rw-        1184   Dec 3 2014 15:14:06 +00:00  R1-R2-ASA1-ASA2.cfg
[output omitted]

Above we can see our new configs folder. With the cd command, you can enter it:

R1#cd configs

Right now it’s empty:

Directory of flash:/configs/

No files in directory

3999793152 bytes total (3794337792 bytes free)

If you want to exit this folder, use the cd .. command:

R1#cd ..

Our current folder is now the root of the flash again:


Copy files and folders

Let’s see if we can copy some files into our new folder. We do this with the copy command:

R1#copy ?
  /erase          Erase destination file system.
  /error          Allow to copy error file.
  /noverify       Don't verify image signature before reload.
  /verify         Verify image signature before reload.
  archive:        Copy from archive: file system
  cns:            Copy from cns: file system
  flash:          Copy from flash: file system
  ftp:            Copy from ftp: file system
  http:           Copy from http: file system
  https:          Copy from https: file system
  null:           Copy from null: file system
  nvram:          Copy from nvram: file system
  pram:           Copy from pram: file system
  rcp:            Copy from rcp: file system
  running-config  Copy from current system configuration
  scp:            Copy from scp: file system
  startup-config  Copy from startup configuration
  system:         Copy from system: file system
  tar:            Copy from tar: file system
  tftp:           Copy from tftp: file system
  tmpsys:         Copy from tmpsys: file system
  xmodem:         Copy from xmodem: file system
  ymodem:         Copy from ymodem: file system

Above you can see there are a lot of options. The copy command can be used to copy files locally but also between external systems like a FTP server, HTTP server, and more. For now, let’s see if we can copy a file in the root of our flash drive to our new configs folder:

R1#copy flash:second-test-config.cfg flash:configs
Destination filename [/configs/second-test-config.cfg]? 
Copy in progress...C
1346 bytes copied in 0.492 secs (2736 bytes/sec)

The command above copies the second-test-config.cfg file in the root of the flash to the configs folder on the flash drive. Cisco IOS asks for the destination file name (which I already supplied) so you only have to hit enter for these questions.

Let’s take a look at the contents of the configs folder:

R1#dir flash:configs
Directory of flash:/configs/

   27  -rw-        1346  Jan 31 2017 10:34:00 +00:00  second-test-config.cfg

3999793152 bytes total (3794272256 bytes free)

As you can see, the file is there.

Delete files and folders

You also might want to delete some of your files and/or folders. We can do this with the delete command:

R1#delete flash:configs/second-test-config.cfg
Delete filename [/configs/second-test-config.cfg]? 
Delete flash:/configs/second-test-config.cfg? [confirm]

Just hit enter for the two questions that Cisco IOS prompts. Let’s see if it’s gone:

R1#dir flash:configs                     
Directory of flash:/configs/

No files in directory

3999793152 bytes total (3794337792 bytes free)

Our file is gone. We can also remove a folder with the rmdir command:

R1#rmdir configs
Remove directory filename [configs]? 
Delete flash:/configs? [confirm]
Removed dir flash:/configs

Our folder is now gone.

Tar files

Cisco IOS supports tar files. A tar file bundles multiple files, it’s similar to a ZIP or RAR file without the compression. To demonstrate this, I will create a new folder called “backup” and will copy some files to it:

R1#mkdir backup
Create directory filename [backup]? 
Created dir flash:/backup
R1#copy flash:first-test-config.cfg flash:backup
Destination filename [/backup/first-test-config.cfg]? 
Copy in progress...C
1119 bytes copied in 0.504 secs (2220 bytes/sec)
R1#copy flash:second-test-config.cfg flash:backup
Destination filename [/backup/second-test-config.cfg]? 
Copy in progress...C
1346 bytes copied in 0.408 secs (3299 bytes/sec)

Let’s take a look at the contents of the backup folder:

R1#dir flash:backup
Directory of flash:/backup/

   28  -rw-        1119  Jan 31 2017 10:45:20 +00:00  first-test-config.cfg
   29  -rw-        1346  Jan 31 2017 10:45:26 +00:00  second-test-config.cfg

3999793152 bytes total (3794206720 bytes free)

Let’s create an archive of these two files with the archive tar command. I will store the tar file in the root of the flash drive:

R1#archive tar /create flash:backup-configs.tar flash:/backup
archiving first-test-config.cfg (1119 bytes)
archiving second-test-config.cfg (1346 bytes)

That’s all there is to it. If you want to see what files are in the TAR file, you can do it like this:

R1#archive tar /table flash:backup-configs.tar 
first-test-config.cfg (1119 bytes)
second-test-config.cfg (1346 bytes)

What if we want to extract a TAR file? Let’s create a new folder for this:

R1#mkdir new-configs
Create directory filename [new-configs]? 
Created dir flash:/new-configs

Here’s how to extract the tar file to the new folder:

R1#archive tar /xtract flash:backup-configs.tar flash:/new-configs
extracting first-test-config.cfg (1119 bytes)
extracting second-test-config.cfg (1346 bytes)

Let’s verify our work:

R1#dir flash:new-configs
Directory of flash:/new-configs/

   32  -rw-        1119  Jan 31 2017 10:48:00 +00:00  first-test-config.cfg
   33  -rw-        1346  Jan 31 2017 10:48:00 +00:00  second-test-config.cfg

3999793152 bytes total (3793944576 bytes free)

Above we find our extracted files.

Display file contents

What if you want to look at the contents of a text file like a configuration? This is possible on Cisco IOS with the more command:

R1#more flash:/first-test-config.cfg
! Last configuration change at 11:11:41 UTC Tue Sep 29 2015
version 15.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
hostname R1
[output omitteded]

The router will print the file contents on the console.


You have now seen how to move around the Cisco IOS filesystem, how to create folders, copy files and create/extract TAR files. If you want to know how to copy files between your local router / switch and an external server like a TFTP server, take a look at the following lesson: How to upgrade the Cisco IOS image.


Forum Replies

  1. Hi All,

    What is/are the file system type(s) used by Cisco IOS (for example the flash: file system)? Similar to Linux file system types - ext2, ext3, etc.



  2. Hello Rohan

    In most cases, the file system used is fat32. This can be seen from the fact that most cisco IOS platforms have the fsck utility which is a FAT filesystem check. Also, most USB flash drives that are used as external storage ports on cisco devices are recommended to be formated as fat32.

    Some cisco platforms have the ability to change file systems as well. Depending on the platform, using the IOS command filesystem filesystem-type you are able to format any file system (flash, nvram or usb flash drive) on a Cisco device to fat16, fat32 or qnx4.

    I hope this has been helpful!


Ask a question or join the discussion by visiting our Community Forum