IOS files typically are stored in Flash memory. Flash memory is rewriteable, permanent storage, which is ideal for storing files that need to be retained when the router loses power. Also, because there are no moving parts, there is a smaller chance of failure as compared with disk drives, which provides better availability. As you will read soon, IOS can be placed on an external TFTP server, but using an external server typically is done for testing—in production, practically every Cisco router loads an IOS stored in the only type of large, permanent memory in a Cisco router and that is Flash memory.
As Figure 7-8 illustrates, to upgrade an IOS image into Flash memory, you first must obtain the IOS image from Cisco. Then you must place the IOS image into the default directory of a TFTP server. Finally, you must issue the copy command from the router, copying the file into Flash memory. You also can use an FTP server, but the TFTP feature has been around a long time and is a more likely topic for the exam.
Figure 7-8 Complete Cisco IOS Software Upgrade Process
Example 7-6 provides an example of the final step, copying the IOS image into Flash memory.
Example 7-6 copy tftp flash Command Copies the IOS Image to Flash Memory
R1#copy tftp flash
System flash directory: File Length Name/status
1 7530760 c4500-d-mz.120-2.bin [7530824 bytes used, 857784 available, 8388608 total] Address or name of remote host [255.255.255.255]? 220.127.116.11 Source file name? c4500-d-mz.120-5.bin Destination file name [c4500-d-mz.120-5.bin]? Accessing file c4500-d-mz.120-5.bin 1 on 18.104.22.168... Loading c4500-d-mz.120-5.bin from 22.214.171.124 (via TokenRing0): ! [OK]
Erase flash device before writing? [confirm]
Flash contains files. Are you sure you want to erase? [confirm]
Example 7-6 copy tftp flash Command Copies the IOS Image to Flash Memory (Continued)
Copy 'c4500-d-mz.120-5.bin 1 from server as 'c4500-d-mz.120-5.bin 1 into Flash WITH erase? [yes/no]y
Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Loading c4500-d-mz.120-5.bin from 126.96.36.199 (via TokenRing0) iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (leaving out lots of exclamation points...)
[OK 7530760/8388608 bytes]
Verifying checksum... OK (0xA93E) Flash copy took 0:04:26 [hh:mm:ss] R1#
During this process of copying the IOS image into Flash memory, the router needs to discover several important facts:
1. What is the IP address or host name of the TFTP server?
2. What is the name of the file?
3. Is space available for this file in Flash memory?
4. Does the server actually have a file by that name?
5. Do you want the router to erase the old files?
The router will prompt you for answers, as necessary. Afterward, the router erases Flash memory as needed, copies the file, and then verifies that the checksum for the file shows that no errors occurred in transmission. The show flash command then can be used to verify the contents of Flash memory (see Example 7-7). (The show flash output can vary among router families.) Before the new IOS image is used, however, the router must be reloaded.
Example 7-7 Verifying Flash Memory Contents with the show flash Command fred#show flash
System flash directory: File Length Name/status
1 13305352 c2500-ds-l.122-1.bin [13305416 bytes used, 3471800 available, 16777216 total] 16384K bytes of processor board System flash (Read ONLY)
In some cases, Flash memory can be in read-only mode. That is the case when a router loads only part of the IOS into RAM, to conserve RAM. Other parts of the IOS file are kept in Flash memory (Flash memory access time is much slower than RAM's). In this case, if Flash memory must be erased to make room for a new image, the IOS could not continue to run.
So, if the router is running from a portion of IOS in Flash memory, the router must must be booted using IOS in ROM. Then the Flash memory is in read/write mode and the erase and copy processes can be accomplished. The copy tftp flash command in later releases of the IOS actually performs the entire process for you. In earlier releases, you had to boot the router from ROM and then issue the copy tftp flash command.
When using the limited-function IOS in ROM, the router is in a mode called Rxboot mode. Routers cannot route packets while in Rxboot mode, but it can send and receive IP packets like an IP host. So, one of two things must be true for the router to be capable of sending packets to the TFTP server. First, the TFTP server could reside on the same subnet as one of the interfaces on the router. Alternately, you could configure a default route on the router, pointing to another router that is on one of the same subnets as the router in Rxboot mode.
The name of the IOS file identifies some basic information about that IOS image, so it is a good idea to keep the same filename when copying the file into flash. In particular, the first part of the name implies the router hardware platform. The second part identifies the feature set, with individual letters identifying different options—for instance, "j" means the IOS has the Enterprise feature set, which contains most features. Finally, the last few digits tell us some information about the run-time features—for instance, a "z" means that the file is compressed, and need decompression when being loaded. See www.cisco.com/warp/ customer/620/4.html#image for more information.
Was this article helpful?