Open In App

What is Cisco iOS Filesystem?

Last Updated : 29 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

IOS software images and other files are typically stored in embedded flash memory in Cisco equipment (e.g., backup configuration files). In NVRAM, the startup configuration is kept. IOS file system (IFS) is a file system that is built for each memory device that is accessible on the device. In other words, like your own computer, Cisco IOS has a filesystem. It employs flash memory for huge files like the Cisco IOS operating system. Flash memory has the benefit of being less prone to failure than hard discs. On NVRAM, the startup configuration is kept. Additionally, it makes use of a few unique prefixes to grant the filesystem access to internal processes or outside services. The display file systems EXEC mode command is used to list the file systems that are available on your device:

R1#show file systems
File Systems:
      Size(b)       Free(b)      Type  Flags  Prefixes
*    255744000     221896413      disk     rw  flash0: flash:#
       262136        255005     nvram     rw  nvram:

We can see that there are two file systems available on the device in the command above. Each field is described below:

  • Size(b) represents the file system’s total RAM (in bytes)
  • Free memory in the file system with free(b) (in bytes)
  • The file system’s type is called type. 
  • NVRAM memory is represented by nvram, while flash memory is represented by disc.
  • Flags – filesystem permissions 
  • The file system is read/write, or rw.
  • File system aliases are prefixes.

When the device boots, a single file called the IOS image is loaded into RAM. Since flash memory retains the stored files even when the router is turned off or restarted, this file is typically saved there. The show flash: command is utilized to display the information stored in the flash memory.

R2#show flash:
System flash directory:
File  Length   Name/status
 3   33591768 c1900-universalk9-mz.SPA.151-4.M4.bin
 2   28282    sigdef-category.xml
 1   227537   sigdef-default.xml
[33847587 bytes used, 221896413 available, 255744000 total]
249856K bytes of processor board System flash (Read/Write)

The 1900 Integrated Services Router series’ IOS image is in the file c1900-universalk9-me.SPA.151-4. M4.bin. The two additional XML files are utilized for encryption.

Configuration:

Filesystems:

The following is 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:

The show command is used to accomplish this. There is a lengthy list of things.  Four different types can be seen below the type column:

  • opaque: these serve a few internal purposes. For instance, the system:running-config file is linked internally by the display running-config command.
  • network: This is used to connect the filesystem to outside platforms like TFTP, FTP, or HTTP servers. To copy files from these external sources to our filesystem, we can use this.
  • Storage tools like our flash memory or USB sticks are stored on a disc.
  • NVRAM: The startup-config file is stored in the internal NVRAM, or nvram.

The flags provide information about the filesystem’s permissions:

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

Some of the prefixes we saw above are explained as follows:

  • system: The running configuration is stored in the system memory.
  • If you copy a file here, it won’t be saved anywhere; this value is null. If you want to determine the size of a distant file, this is helpful (like on a TFTP server). To create some bandwidth in labs, it may be good to replicate a remote file.
  • TFTP server at a distance
  • The flash memory, or flash.
  • The internal NVRAM that holds the startup configuration is called nvram.
  • Older protocols that can be used to copy files through the console are xmodem and ymodem.
  • RCP (Remote Copy Protocol) servers are located outside.
  • To copy files from distant HTTP web servers using http. 
  • To copy files from or to distant FTP sites, use ftp.
  • To copy files from or to distant SCP servers, use scp.
  • Create TAR files with tar.
  • For copying from distant HTTPS web servers.

Let’s examine the flash memory in more detail.

Display Folders and Files:

The flash memory is where most files are kept. The pwd command allows us to view the default folder we are currently in:

R1#pwd
flash:

The flash folder is visible here. We can use the dir command to examine its contents:

Creating Folders:

Step 1: Use the mkdir command to create a folder called configs:

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

Step 2: You can type it using the cd command:

R1#cd configs

Step 3: It is currently empty:

R1#dir
Directory of flash:/configs/
No files in directory
3999793152 bytes total (3794337792 bytes free)

Step 4: Use the cd. command to leave this folder:

R1#cd ..

Step 5: Now the root of the flash is our current folder once more:

R1#pwd
flash:/

Copy Files and Folders:

Let’s try copying some files into our new folder. Making use of the copy command, we can:

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

The copy command can be used to transfer files between internal systems, such as an FTP server or HTTP server, as well as external systems.

Delete Files and Folders:

The delete command serves the purpose of deleting files and folders. For deleting a folder, rmdir command is used.

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

For the two questions that Cisco IOS asks, simply press enter, then the specific file will get deleted.

Tar Files:

To create a tar archive (also known as a tarball) on a Cisco IOS system, you can use the archive tar command. The basic syntax of the archive tar command is as follows:

archive tar {create | flash:filename 
| tftp:filename} [exclude-dir dir]

Step 1: To create a tar archive of the entire file system, you can use the following command:

archive tar create flash:backup.tar

Step 2: This command will create a tar archive of the entire file system and save it to the flash memory of the Cisco device with the filename “backup.tar”. You can also use the exclude-dir option to exclude certain directories from the tar archive. For example, to create a tar archive of the entire file system except for the “log” directory, you can use the following command:

archive tar create flash:
backup.tar exclude-dir log

Step 3: You can also use the archive tar command to restore a tar archive to the file system. To do this, you would use the following syntax:

archive tar {flash:filename |
 tftp:filename}

For example, to restore a tar archive named “backup.tar” from the flash memory of the Cisco device, you would use the following command:

archive tar flash:
backup.tar

Keep in mind that these examples are just a basic overview of the archive tar command, and the specific options and syntax may vary depending on the version of the Cisco IOS system you are using.

Display File Contents:

To display the contents of a file on a Cisco IOS system, you can use the more command. For example, to display the contents of a file named “config.txt”, you would enter the following command:

more flash:config.txt

The more command displays the contents of the file one screen at a time and allows you to navigate through the file using the space bar to move to the next page or the enter key to move to the next line. You can also use the type command to display the contents of a file. This command displays the entire contents of the file on a single screen and does not allow you to navigate through the file. For example, to display the contents of a file named “config.txt” using the type command, you would enter the following command:

type flash:config.txt

Keep in mind that these commands assume that the file you are trying to display is located in the flash memory of the Cisco device. If the file is located elsewhere, you will need to specify the correct path to the file.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads