Using CompactFlash Memory Cards

Cisco 3900 Series, 2900 Series, and 1900 Series Integrated Services Routers (ISR) use Advanced Capability CompactFlash (CF) external memory to store the system image, configuration files, and some software data files. CF supports True IDE mode and Multi-Word DMA mode.

The following sections explain how to manage directories and files on the CF:

Requirements and Restrictions

CompactFlash Support

  • Only Advanced Capability CF purchased from Cisco operate in Cisco 3900 Series, 2900 Series, and 1900 Series Integrated Services Routers.
  • Legacy CF will not operate in Cisco 3900 Series, 2900 Series, and 1900 Series Integrated Services Routers. When legacy CF is inserted, the following error message appears:
WARNING: Unsupported compact flash detected. Use of this card during normal operation can impact and severely degrade performance of the system. Please use supported compact flash cards only.

Formatting CompactFlash

  • Only Class C file systems are supported on Cisco Compact Flash (CF).
  • We recommend that you format new CF to initialize a new flash file system. Proper formatting lets ROM monitor recognize and boot the flash memory. The CF can be formatted on an ISR, and files copied to or from any PC that is equipped with a CF memory reader. If you use a PC to format the CF, use the Microsoft File Allocation Table (FAT32) file system.

CompactFlash Slots and Files

  • Cisco 3900 series, 2900 series, and 1900 series ISRs have 2 external CF slots.
  • CF in Slot0 can store the system image, configuration, and data files. The CF must be present in this slot for the router to boot and perform normal file operations.

 

Table B-1 Compact Flash Slot Numbering and Naming

Slot Number
CF Filenames
Size 1

Slot02

flash0:

256MB

Slot1

flash1:

0

1.The maximum storage capacity for the CF in Slot0 and Slot1 is 4GB.

2.Slot 0 is the default CF slot. CF in slot0 can store system image, configuration, and data files. CF must be present in this slot for the router to boot and perform normal file operations.

Online Insertion and Removal

Online insertion and removal (OIR) is a feature that allows you to replace CF memory cards without turning off the router and without affecting the operation of other interfaces. OIR of CF memory cards provides uninterrupted operation to network users, maintains routing information, and ensures session preservation.


Caution The external CF memory card should not be removed if the flash memory busy “CF” LED on the router is blinking, because this indicates that the software is accessing the CF memory card. Removing the CF memory card may disrupt the network, because some software features use the CF memory card to store tables and other important data.

For instructions on inserting, removing, and replacing the external CF memory card, see the hardware installation guide for your router.

How to Format CompactFlash Memory Cards

This section contains the following procedures:

Determining the File System on a CompactFlash Memory Card

To determine the file system of a CF memory card, enter the show flash: all command in privileged EXEC mode.

  • If geometry and format information does not appear in the output, the card is formatted with a Class B flash file system. Class B files systems are not supported on CF inserted in Cisco 3900 Series, 2900 Series, and 1900 Series Integrated Services Routers.
  • If geometry and format information appears in the output, the card is formatted with a Class C flash file system.

The following examples show sample outputs for Class B and Class C flash file systems.


Note Use flash1: in the command syntax to access CF in slot1. Use flash0: in the command syntax to access CF in slot0.


External Card with Class B Flash File System: Example

The geometry and format information does not appear.

Router# show flash: all
 
Partition Size Used Free Bank-Size State Copy
Mode
1 125184K 20390K 104793K 0K Read/Write
Direct
 
System Compact Flash directory:
File Length Name/status
addr fcksum ccksum
1 6658376 c29xx-i-mz
0x40 0xE0FF 0xE0FF
2 14221136 c2900-telcoent-mz
0x6599C8 0x5C3D 0x5C3D
[20879640 bytes used, 107308776 available, 128188416 total]
125184K bytes of ATA System Compact Flash (Read/Write)
 
Chip information NOT available.

External Card with Class C Flash File System: Example

The geometry and format information is displayed in this format.

Router# show flash: all
 
-#- --length-- -----date/time------ path
1 6658376 Mar 01 2004 04:27:46 c28xx-i-mz
 
25268224 bytes available (6664192 bytes used)
 
******** ATA Flash Card Geometry/Format Info ********
 
ATA CARD GEOMETRY
Number of Heads: 4
Number of Cylinders 490
Sectors per Cylinder 32
Sector Size 512
Total Sectors 62720
 
ATA CARD FORMAT
Number of FAT Sectors 31
Sectors Per Cluster 8
Number of Clusters 7796
Number of Data Sectors 62560
Base Root Sector 155
Base FAT Sector 93
Base Data Sector 187

Formatting CompactFlash Memory as a Class C File System

Use the format flash0: command in privileged EXEC mode to:

  • Format CF memory cards with a Class C flash file system
  • Remove the files from a CF memory card previously formatted with a Class C flash file system

Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Formatting CompactFlash Memory as a Class C Flash File System: Example

Router# format flash0:
Format operation may take a while. Continue? [confirm]
Format operation will destroy all data in "flash0:". Continue? [confirm]
Enter volume ID (up to 64 chars)[default flash]:
Current Low End File System flash card in flash will be formatted into DOS
File System flash card! Continue? [confirm]
Format:Drive communication & 1st Sector Write OK...
Writing Monlib sectors..................................................................
Monlib write complete
Format:All system sectors written. OK...
Format:Total sectors in formatted partition:250592
Format:Total bytes in formatted partition:128303104
Format:Operation completed successfully.
Format of flash complete

File Operations on CompactFlash Memory Cards

This section describes the following file operations for external CF memory cards:

Copying Files

To copy files, enter the copy command in privileged EXEC mode. To indicate a file that is stored in a CF memory card, precede the filename with flash1: or flash0:.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Examples: Copying Files

In the following example, the file my-config1 on the CF memory card is copied into the startup-config file in the system memory:

Router# copy flash0:my-config1 startup-config
 
Destination filename [startup-config]?
[OK]
517 bytes copied in 4.188 secs (129 bytes/sec)
 

In the following example, the file my-config2 on the CF memory card is copied into the running-config file in the system memory:

Router# copy flash0:my-config2 running-config
 
Destination filename [running-config]?
709 bytes copied in 0.72 secs

Displaying Files

To display a list of files on a CF memory card, enter the dir flash0: command in privileged EXEC mode.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Router# dir flash0:
 
Directory of flash0:/
1580 -rw- 6462268 Mar 06 2004 06:14:02 c2900-universalk9-mz.data
3 -rw- 6458388 Mar 01 2004 00:01:24 c2900-universalk9-mz.bin
63930368 bytes total (51007488 bytes free)

Displaying File Content

To display the content of a file that is stored in flash memory, enter the more flash0: command in privileged EXEC mode:


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Router# more flash0:c29xx-i-mz
 
00000000: 7F454C46 01020100 00000000 00000000.ELF............
00000010: 00020061 00000001 80008000 00000034...a...........4
00000020: 00000054 20000001 00340020 00010028...T....4....(
00000030: 00050008 00000001 0000011C 80008000................
00000040: 80008000 00628A44 00650EEC 00000007.....b.D.e.l....
00000050: 0000011C 0000001B 00000001 00000006................
00000060: 80008000 0000011C 00004000 00000000..........@.....
00000070: 00000000 00000008 00000000 00000021...............!
00000080: 00000001 00000002 8000C000 0000411C..........@...A.
00000090: 00000700 00000000 00000000 00000004................
000000A0: 00000000 00000029 00000001 00000003.......)........
000000B0: 8000C700 0000481C 00000380 00000000..G...H.........
000000C0: 00000000 00000004 00000000 0000002F.............../
000000D0: 00000001 10000003 8000CA80 00004B9C..........J...K.
000000E0: 00000020 00000000 00000000 00000008...............
000000F0: 00000000 0000002F 00000001 10000003......./........
00000100: 8000CAA0 00004BBC 00623FA4 00000000..J..K<.b?$....
00000110: 00000000 00000008 00000000 3C1C8001............ <...
00000120: 679C4A80 3C018001 AC3DC70C 3C018001 g.J. <...,=G. <...
00000130: AC3FC710 3C018001 AC24C714 3C018001,?G. <...,$G. <...
00000140: AC25C718 3C018001 AC26C71C 3C018001,%G. <...,&G. <...
00000150: AC27C720 3C018001 AC30C724 3C018001,'G <...,0G$ <...
00000160: AC31C728 3C018001 AC32C72C 3C018001,1G( <...,2G, <...
--More-- q

Displaying Geometry and Format Information

To display the geometry and format information of a CF flash file system, enter the show flash0: filesys command in privileged EXEC mode.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Router# show flash0: filesys
 
******** ATA Flash Card Geometry/Format Info ********
 
ATA CARD GEOMETRY
Number of Heads: 4
Number of Cylinders 490
Sectors per Cylinder 32
Sector Size 512
Total Sectors 62720
 
ATA CARD FORMAT
Number of FAT Sectors 31
Sectors Per Cluster 8
Number of Clusters 7796
Number of Data Sectors 62560
Base Root Sector 155
Base FAT Sector 93
Base Data Sector 187

Deleting Files

To delete a file from a CF memory card, enter the delete flash0: command.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.



Note The dir flash0: command does not display deleted files and files with errors.


Renaming Files

To rename a file on a CF memory card, enter the rename command in privileged EXEC mode.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Router# dir flash0:
 
Directory of flash0:/
 
3 -rw- 6458388 Mar 01 2004 00:00:58 c2900-universalk9-mz.tmp
1580 -rw- 6462268 Mar 06 2004 06:14:02 c2900-universalk9-mz.3600ata
 
63930368 bytes total (51007488 bytes free)
 
Router# rename flash0:c2900-universalk9-mz.tmp flash0:c2900-universalk9-mz
 
Destination filename [c2900-universalk9-mz]?
 
Router# dir flash0:
 
Directory of flash0:/
 
1580 -rw- 6462268 Mar 06 2004 06:14:02 c2900-universalk9-mz.3600ata
3 -rw- 6458388 Mar 01 2004 00:01:24 c2900-universalk9-mz
 
63930368 bytes total (51007488 bytes free)

Directory Operations on a CompactFlash Memory Card

The following sections describe directory operations for external CF memory cards on Cisco routers:

Entering a Directory and Determining Which Directory You Are In

To enter a directory of a CF memory card, enter the cd command in privileged EXEC mode. The cd command specifies or changes the default directory or file system. If you enter cd only, without specifying a file system, the router enters the default home directory, which is flash0. If you enter cd flash1:, the router enters the flash1 directory.

Router# cd
 

To determine which directory you are in, enter the pwd command in privileged EXEC mode. The CLI displays which directory or file system is specified as the default by the cd command.

Router# pwd

To display a list of files in the directory that you are in, enter the dir command in privileged EXEC mode. The command-line interface will display the files in the file system that was specified as the default by the cd command.

Router# dir
 
Directory of flash0:/
 
1580 -rw- 6462268 Mar 06 2004 06:14:02 c2900-universalk9-mz.3600ata
3 -rw- 6458388 Mar 01 2004 00:01:24 c2900-universalk9-mz
 
63930368 bytes total (51007488 bytes free)

Entering a Directory: Example

To enter the /config directory:

Router# cd config
 

To verify that you are in the /config directory:

Router# pwd
 
flash0:/config/
 
Router# dir
 
Directory of flash0:/config/
 
380 -rw- 6462268 Mar 08 2004 06:14:02 myconfig1
203 -rw- 6458388 Mar 03 2004 00:01:24 myconfig2
 
63930368 bytes total (51007488 bytes free)

Creating a New Directory

To create a directory in flash memory, enter the mkdir flash0: command in privileged EXEC mode.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Creating a New Directory: Example

In the following example, a new directory named “config” is created; then a new subdirectory named “test-config” is created within the “config” directory.

Router# dir flash0:
 
Directory of flash0:/
 
1580 -rw- 6462268 Mar 06 2004 06:14:02 c2900-universalk9-mz.3600ata
3 -rw- 6458388 Mar 01 2004 00:01:24 c2900-universalk9-mz
 
63930368 bytes total (51007488 bytes free)
Router# mkdir flash0:/config
 
Create directory filename [config]?
Created dir flash0:/config
 
Router# mkdir flash0:/config/test-config
 
Create directory filename [/config/test-config]?
Created dir flash0:/config/test-config
 
Router# dir flash0:
 
Directory of flash0:/
 
3 -rw- 6458208 Mar 01 2004 00:04:08 c2900-universalk9-mz.tmp
1580 drw- 0 Mar 01 2004 23:48:36 config
 
128094208 bytes total (121626624 bytes free)

Removing a Directory

To remove a directory in flash memory, enter the rmdir flash0: command in privileged EXEC mode.

Before you can remove a directory, you must remove all files and subdirectories from the directory.


Note Use flash1: in the command syntax to access CF in slot 1. Use flash0: in the command syntax to access CF in slot 0.


Example: Removing a Directory

In the following example, the subdirectory test-config is removed.

Router# dir
 
Directory of flash0:/config/
 
1581 drw- 0 Mar 01 2004 23:50:08 test-config
 
128094208 bytes total (121626624 bytes free)
Router# rmdir flash0:/config/test-config
 
Remove directory filename [/config/test-config]?
Delete flash0:/config/test-config? [confirm]
Removed dir flash0:/config/test-config
Router# dir
 
Directory of flash0:/config/
 
No files in directory
 
128094208 bytes total (121630720 bytes free)