Storing Configuration Files Larger Than NVRAM

Storing Configuration Files Larger Than NVRAM

Problem

Your configuration file has become larger than the router's available NVRAM.

Solution

You can compress your router's configuration file before saving it to NVRAM to allow you to save more configuration information. The command service compress-config will compress the configuration information when the router saves the file, and uncompress it when it is required:

Router1#configure terminal 
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#service compress-config
Router1(config)#end
Router1#

Discussion

Cisco generally ships its routers with more than enough NVRAM to store an average configuration file. However, there are times when configuration files exceed the available NVRAM. For instance, some routers contain large access-lists that could be hundreds of lines in length. Eventually, some configuration files will grow beyond the finite amount of NVRAM and you will begin to have problems.

The first sign of serious problems with an overly large configuration file is usually when the router refuses to save its configuration because of size. This is a dangerous problem because the router can no longer keep a copy of the whole running-configuration file in its NVRAM storage, and it is difficult to predict how much of your configuration will be lost if you were to reload the router.

Turning on compression roughly doubles the size of the configuration file you can store. You have to put the command service compress-config into the configuration with a configure terminal. Then, for this command to take effect, you need to copy the running configuration file to NVRAM as follows:

Router1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
Compressed configuration from 9664 bytes to 4903 bytes[OK]
Router1#

In this case, you can see that the compression reduced the configuration file to less than half of its original size. This compression algorithm will not attempt to compress a file that is three times larger than the available NVRAM space. Although this limit exists, we have never seen a router approach a 3-to-1 ratio in practice anyway.

The actual amount of available NVRAM storage varies between different router models. You can see how much total NVRAM storage is available on a particular router with the show version command:

Router1#show version
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IK9O3S-M), Version 12.2(12a), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Tue 24-Sep-02 02:05 by pwade
Image text-base: 0x8000808C, data-base: 0x8127FF40

ROM: System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)

Router1 uptime is 12 hours, 15 minutes
System returned to ROM by reload
System restarted at 23:18:45 EST Fri Jan 10 2003
System image file is "flash:c2600-ik9o3s-mz.122-12a.bin"

cisco 2621 (MPC860) processor (revision 0x102) with 45056K/4096K bytes of memory.
Processor board ID JAB04130B2Q (1293133440)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
2 FastEthernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
32K bytes of nonvolatile configuration memory.
16384K bytes of processor board System flash (Read/Write)

Configuration register is 0x2102

Router1#

This router contains 32 Kb of NVRAM to store configuration files. The top of the output from the show startup-config command shows how much NVRAM storage is available, and how much this particular configuration file requires. Iif you enable compression, it will also show the compressed and uncompressed sizes:

Router1#show startup-config 
Using 5068 out of 29688 bytes, uncompressed size = 9969 bytes
Uncompressed configuration from 5068 bytes to 9969 bytes
!
! Last configuration change at 12:36:22 EST Sat Jan 11 2003 by ijbrown
! NVRAM config last updated at 13:34:57 EST Sat Jan 11 2003 by ijbrown
!
version 12.2

In this case, we have used about 5Kb of the available 29Kb for this router's configuration file. But the show version output said that there was 32Kb of NVRAM in total, which leaves 3Kb unaccounted for. The router's NVRAM used to contain the startup configuration file only, but this is no longer strictly the case. Recent IOS releases also use the same NVRAM space to store information such as private keys for SSH or IPSec, and interface numbers for SNMP. You can see information about all of these files with the dir nvram: command:

Router1#dir nvram: 
Directory of nvram:/

20 -rw- 5068 startup-config
21 ---- 2302 private-config
1 ---- 0 persistent-data
2 -rw- 133 ifIndex-table

29688 bytes total (20218 bytes free)
Router1#

Note that the second column from the left in this output contains file attributes similar to those used by the Unix ls command. In this case, both the startup-config and ifIndex-table files are readable and writeable. For example, you could look at your router's startup-config file by using the following command:

Router1#more nvram:/startup-config

You can view any file that has an "r" and modify any file that has a "w". But the two files in this router's NVRAM that have neither "r" nor "w" can't be displayed, modified, or deleted. Note that the file ifIndex-table in particular is in a binary format that isn't very meaningful when you display it with the more command like this.

See Also