Google
 
Backing Up and Restoring the Cisco IOS

Before you upgrade or restore a Cisco IOS, you really should copy the existing file to a TFTP host as a backup just in case the new image crashes and burns.


And you can use any TFTP host to accomplish this. By default, the flash memory in a router is used to store the Cisco IOS. In this page describe how to check the amount of flash memory, how to copy the Cisco IOS from flash memory to a TFTP host, and how to copy the IOS from a TFTP host to flash memory.
But before you back up an IOS image to a network server on your intranet, you’ve got to do these three things:

1. Make sure you can access the network server.
2. Ensure that the network server has adequate space for the code image.
3. Verify the file naming and path requirement.
And if you have a laptop Ethernet port directly connected to a router’s Ethernet interface, as shown in Figure as below, you need to verify the following before attempting to copy the image to or from the router:

 

 
- TFTP server software must be running on the administrator’s workstation.
- The Ethernet connection between the router and the workstation must be made with a crossover cable.
- The workstation must be on the same subnet as the router’s Ethernet interface.
- The copy flash tftp command must be supplied the IP address of the workstation if you are copying from the router flash.
- And if you’re copying “into” flash, you need to verify that there’s enough room in flash memory to accommodate the file to be copied.

Verifying Flash Memory
Before you attempt to upgrade the Cisco IOS on your router with a new IOS file, it’s a good idea to verify that your flash memory has enough room to hold the new image. You verify the amount of flash memory and the file or files being stored in flash memory by using the show flash command (sh flash for short):


Router#sh flash
System flash directory:
File Length Name/status
1 8121000 c2500-js-l.112-18.bin
[8121064 bytes used, 8656152 available, 16777216 total]
16384K bytes of processor board System flash (Read ONLY)
Router#


It’s important to understand that there are 16MB of flash memory on this router (16,777,216 total), and that the current IOS is using 8MB (8,121,064 bytes used).

Notice that the filename in this example is c2500-js-l.11.2-18.bin. The name of the file is platform-specific and derived as follows:


- c2500 is the platform.
- j indicates that the file is an enterprise image.
- s indicates that the file contains extended capabilities.
- l indicates that the file can be moved from flash memory if needed and is not compressed.
- 11.2-18 is the revision number.
- .bin indicates that the Cisco IOS is a binary executable file.

The last line in the router output shows that the flash is 16,384KB (or 16MB). So if the new file that you want to use is, say, 10MB in size, you know that there’s plenty of room for it. And once you’ve verified that flash memory can hold the IOS you want to copy, you’re free to continue with your backup operation.
Some of the other features you may find in IOS naming conventions, which include feature capability, hardware product platform, and run location and compression status, are as follows:


- f indicates that the image runs from Flash memory.
- m indicates that the image runs from RAM.
- r indicates that the image runs from ROM.
- l indicates that the image is relocatable.
- z indicates that the image is zip compressed.
- x indicates that the image is mzip compressed.


Backing Up the Cisco IOS
To back up the Cisco IOS to a TFTP server, you use the copy flash tftp command. It’s a straightforward command that requires only the source filename and the IP address of the TFTP server.
The key to success in this backup routine is to make sure that you’ve got good, solid connectivity to the TFTP server. Check this by pinging the device from the router console prompt like this:


Router#ping 192.168.0.120
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.120, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms

After you ping the TFTP server to make sure that IP is working, you can use the copy flash tftp command to copy the IOS to the TFTP server as shown next:


Router#copy flash tftp
System flash directory:
File Length Name/status
1 8121000 c2500-js-l.112-18.bin
[8121064 bytes used, 8656152 available, 16777216 total]
Address or name of remote host [255.255.255.255]? 192.168.0.120
Source file name?c2500-js-l.112-18.bin
Destination file name [c2500-js-l.112-18.bin]?[Enter]
Verifying checksum for 'c2500-js-l.112-18.bin')file #1)
...OK
Copy '/c2500-js-l.112-18' from Flash to server
as '/c2500-js-l.112-18'? [yes/no]y
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[output cut]
Upload to server done
Flash copy took 00:02:30 [hh:mm:ss]
Router#


Restoring or Upgrading the Cisco Router IOS
What happens if you need to restore the Cisco IOS to flash memory to replace an original file that has been damaged, or if you want to upgrade the IOS? You can download the file from a TFTP server to flash memory by using the copy tftp flash command. This command requires the IP address of the TFTP server and the name of the file you want to download.

But before you begin, make sure that the file you want to place in flash memory is in the default TFTP directory on your host. When you issue the command, TFTP won’t ask you where the file is, so if the file you want to restore isn’t in the default directory of the TFTP server, this just won’t work.

After you enter the copy tftp flash command, you’ll see a message informing you that the router must reboot and run a ROM-based IOS image to perform this operation:


Router#copy tftp flash
**** NOTICE ****
Flash load helper v1.0
This process will accept the copy options and then
terminate the current system image to use the ROM based
image for the copy. Routing functionality will not be
available during that time. If you are logged in via
telnet, this connection will terminate. Users with
console access can see the results of the copy operation.
---- ******** ----
Proceed? [confirm][Enter]

After you press Enter to confirm that you truly understand that the router needs to reboot, you’ll be presented with the following router output:


System flash directory:
File Length Name/status
1 8121000 /c2500-js-l.112-18
[8121064 bytes used, 8656152 available, 16777216 total]
Address or name of remote host [192.168.0.120]?[Enter]

Once the router has used the TFTP server, it will remember the address, and just prompt you to press Enter:
The next prompt is for the name of the file you want to copy to flash memory (and remember-- this file must be in your TFTP server’s default directory):


Source file name?c2500-js56i-l.120-9.bin
Destination file name [c2500-js56i-l.120-9.bin]?[Enter]
Accessing file 'c2500-js56i-l.120-9.bin' on 192.168.0.120
...
Loading c2500-js56i-l.120-9.bin from 192.168.0.120
(via Ethernet0): ! [OK]

After you tell the router the filename and where the file is, it will ask you to confirm that you understand that the contents of flash memory will be erased.

You are prompted three times just to make sure that you really want to proceed with erasing flash memory. If you haven’t issued a copy run start command, you’ll be prompted to do so because the router needs to reboot:

Erase flash device before writing? [confirm][Enter]
Flash contains files. Are you sure you want to erase?[confirm][Enter]
System configuration has been modified. Save? [yes/no]: y
Building configuration...
[OK]
Copy 'c2500-js56i-l.120-9.bin' from server
as 'c2500-js56i-l.120-9.bin' into Flash WITH erase?[yes/no] y

After you say yes three times to erasing flash memory, the router must reboot to load a small IOS from ROM memory. (You can’t delete the flash file if it’s in use.) This done, the contents of flash memory are erased, and the file from the TFTP server is accessed and copied to flash memory:


%SYS-5-RELOAD: Reload requested
%FLH: c2500-js56i-l.120-9.bin from 192.168.0.120 to flash
...
System flash directory:
File Length Name/status
1 8121000 /c2500-js-l.112-18
[8121064 bytes used, 8656152 available, 16777216 total]
Accessing file 'c2500-js56i-l.120-9.bin' on 192.168.0.120
...
Loading c2500-js56i-l.120-9.bin .from 192.168.0.120 (via Ethernet0): ! [OK]
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Loading c2500-js56i-l.120-9.bin from 192.168.0.120 (via Ethernet0):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[output cut]

The row of e characters shows the contents of flash memory being erased. Each exclamation point (!) means that one UDP segment has been successfully transferred.
Once the copy is complete, you should receive this message:


[OK - 10935532/16777216 bytes]
Verifying checksum... OK (0x2E3A)
Flash copy took 0:06:14 [hh:mm:ss]
%FLH: Re-booting system after download


After the file is loaded into flash memory and a checksum is performed, the router is rebooted
to run the new IOS file.

ccnaguru.com
<<< Managing Configuration Registers |
Backing Up and Restoring the Cisco Configuration >>>