Guest

Support

Using the CompactFlash Disk

 Feedback

Table Of Contents

Using the CompactFlash Disk

Product Description

Installing and Removing the CompactFlash Disk

Software Command Overview

Using Software Commands

Using the show Command

Using the pwd Command

Using the cd Command

Using the dir Command

Using the format Command

Using the copy Command

Using the mkdir Command

Using the rmdir Command

Using the delete Command

Enabling Booting from a CompactFlash Disk

Boot Environment Variables

Making a CompactFlash Disk-Based Software Image the Bootable Software Image


Using the CompactFlash Disk


This appendix provides basic instructions for working with a CompactFlash Disk in your system. Detailed descriptions of more complex CompactFlash Disk options and the Cisco IOS File System feature are beyond the scope of this publication and can be found in the following Cisco IOS Release 12.x publications:

Cisco IOS Configuration Fundamentals Configuration Guide, in the chapter "File Management"

Cisco IOS Configuration Fundamentals Command Reference, in the chapter "File Management Commands"


Note These and all publications are available online and elsewhere. For information on obtaining Cisco documentation, see the "Obtaining Documentation" section.


This appendix includes the following sections:

Product Description

Installing and Removing the CompactFlash Disk

Software Command Overview

Using Software Commands

Enabling Booting from a CompactFlash Disk

Boot Environment Variables

Making a CompactFlash Disk-Based Software Image the Bootable Software Image

Product Description


Note The NPE-G100 supports a CompactFlash Disk in disk0:. A Cisco 7304 router uses the CompactFlash Disk to store the boot helper image in the bootdisk: slot. Therefore, a CompactFlash Disk has to be installed in order to boot a Cisco 7304 router.


CompactFlash Disks are Flash memory-based devices that conform to the PC Card (formerly PCMCIA) standard, and that present an AT Attachment (ATA) interface to the system. This interface complies with the ANSI ATA Interface Document X3T13.1153 D Rev. 9 specification.

The CompactFlash Disk is more flexible than linear Flash memory because the CompactFlash Disk has controller circuitry that allows it to emulate a hard disk and that automatically maps out bad blocks and performs automatic block erasure. Further, the CompactFlash Disk provides the capability to allocate noncontiguous sectors, which eliminates the need for the squeeze command (previously required with linear Flash memory cards).

The CompactFlash Disk is a Type-2 PC Card device. This section provides the external CompactFlash Disk installation procedures. The internal CompactFlash Disk is not field replaceable.

The CompactFlash Disk provides increased Flash-based memory space for storage of system configuration files, Cisco IOS software images, and other types of system-related files. Table A-6 provides memory information for the CompactFlash Disk.

The Cisco IOS File System feature provides a single interface to all file systems your system uses:

Flash memory file systems—CompactFlash Disks, onboard Flash memory

Network file systems—File Transfer Protocol (FTP), Remote Copy Protocol (rcp), and TFTP

Any other endpoint for reading or writing data—NVRAM, the running configuration, ROM, raw system memory, system-bundled microcode, Xmodem, Flash load helper log, modems, and BRI MUX interfaces

A complete discussion of the Cisco IOS File System feature is beyond the scope of this publication. For information about this feature, refer to the Cisco IOS Configuration Fundamentals Configuration Guide and Cisco IOS Configuration Fundamentals Command Reference publications for Cisco IOS Release 12.x. These publications are available online and elsewhere. For information on obtaining Cisco documentation, see the "Obtaining Documentation" section.

For CompactFlash Disk configuration information, see the "Processor and Memory Specifications and Configurations" section.

Installing and Removing the CompactFlash Disk

The NSE-100, NSE-150, and NPE-G100 support a CompactFlash Disk in the CompactFlash Disk slot (disk0:) Use the following procedure to install and eject the CompactFlash Disk.

Figure C-1 Installing and Ejecting a CompactFlash Disk

1

Inserting a CompactFlash Disk (disk0;)

2

Ejecting a CompactFlash Disk (disk0:)



Step 1 Face the front panel of the network processing engine and locate the CompactFlash Disk slot, as shown in Figure C-1.

Step 2 Hold the CompactFlash Disk with its connector end toward the CompactFlash Disk slot and its front label facing up.

The CompactFlash Disk is keyed and cannot be seated the wrong way. The ejector button does not pop out if the CompactFlash Disk is not completely inserted.

Step 3 Insert the CompactFlash Disk into the CompactFlash Disk slot until the CompactFlash Disk completely seats in the connector at the rear of the slot, and the ejector button pops out toward you.

To eject a CompactFlash Disk, press the ejector button—located to the right of the slot— until the compact Flash Disk is free of the connector at the rear of the CompactFlash Disk slot.

Step 4 Remove the CompactFlash Disk from the slot and place it in an antistatic bag.


This completes the procedure for installing and removing a CompactFlash Disk.

Software Command Overview

This section lists some of the basic software commands you can use with the CompactFlash Disk. Examples of these commands are included in the sections that follow.

The CompactFlash Disk and other memory devices and locations in your system are defined as file systems, which are locations where you can store, use, or retrieve files and software images. (See the brief discussion about the Cisco IOS File System feature in the "Product Description" section.)

Table C-1 lists the software commands that you can use with the CompactFlash Disk.


Note You can use other arguments with some of the commands listed in Table C-1; however, in Table C-1 and throughout this document, command arguments are limited to those that apply to the CompactFlash Disk and related file systems.

For a discussion of additional command arguments, refer to the Cisco IOS Configuration Fundamentals Command Reference document, in the chapter "File Management Commands."


Table C-1 CompactFlash Disk-Related Software Commands 

Command and Arguments
Description
cd [disk0: | bootdisk:] directory-name

Changes current directory.
Allows you to move between directories on a CompactFlash Disk, where directory-name is the directory to which you want to move.

copy [disk0: | bootdisk:] source-filename  
[disk0: | bootdisk:] destination-filename

Copies from one file to another.
Allows you to make a copy of a file (source-filename) located on a source file system (disk0: and bootdisk:) and place it with either the same filename or a different filename (destination-filename) on a destination file system. Along with disk0: and bootdisk:, the source and destination file system arguments include, but are not limited to:

bootflash: (onboard Flash memory)

nvram: (onboard nonvolatile random-access memory)

running-config (the running system configuration file)

startup-config (the startup system configuration file)

tftp: (a TFTP server to which you have access)

Note Note that any IFS command that takes disk0: or bootdisk: as parameters can also take standby-disk0: and bootdisk: as parameters.

delete [disk0: | bootdisk:] filename

Deletes a file.
Allows you to delete any file you designate, where filename designates the name of the file.

dir [/all | disk0: | bootdisk:]

Lists files on a file system.
Allows you to list the contents of the CompactFlash Disks in disk0:. The /all argument lists all files on all file systems in your system.

format [disk0: | bootdisk:]

Formats a file system.
Allows you to format a CompactFlash Disk (disk0: or bootdisk:). This command also allows you to reformat a CompactFlash Disk that was formatted on another type of system.

Note This command destroys all data currently in Flash memory; therefore, we strongly recommend that you use the format command with caution to prevent irretrievable loss of data.

Note Flash: maps to disk0:

mkdir [disk0: | bootdisk:] directory-name

Creates a new directory.
Allows you to create directories on a CompactFlash Disk, where directory-name is the name you assign to this directory.

pwd

Displays current working directory.
Allows you to display the name of the CompactFlash Disk directory in which you are currently working.

rename [disk0: | bootdisk:] filename  
[disk0: | bootdisk:] filename

Renames a file.
Allows you to rename a file that is located on one CompactFlash Disk and assign to that file another (or the same) file system path and filename. The first group of arguments defines the source (current) file system path and filename, and the second set of arguments defines the destination file system path and filename.

rmdir [disk0: | bootdisk:] directory-name

Removes an existing directory.
Allows you to remove a directory that currently exists on a CompactFlash Disk, where directory-name is the name of the directory you want to remove.

show [disk0: | bootdisk:]

Lists information about CompactFlash Disk format and geometry.


Using Software Commands

This section provides examples of some of the basic software commands you can use with the CompactFlash Disk. See Table C-1 for optional arguments you can use with some of the following commands:

Using the show Command

Using the pwd Command

Using the cd Command

Using the dir Command

Using the format Command

Using the copy Command

Using the mkdir Command

Using the rmdir Command

Using the delete Command

Using the show Command

To display information about CompactFlash Disk format and geometry, use the show [disk0:] command:

System# show disk0:
******** ATA Flash Card Geometry/Format Info ********
ATA CARD GEOMETRY
   Number of Heads:       16    
   Number of Cylinders    840   
   Sectors per Cylinder   32    
   Sector Size            512   
   Total Sectors          430080
ATA CARD FORMAT
   Number of FAT Sectors  105   
   Sectors Per Cluster    16    
   Number of Clusters     26822 
   Number of Data Sectors 429536
   Base Root Sector       338   
   Base FAT Sector        128   
   Base Data Sector       370   

Router#

In this example:

Number of Heads is the number of heads on the CompactFlash Disk.

Number of Cylinders is the number of cylinders on the CompactFlash Disk.

Sectors per Cylinder is the number of sectors in each cylinder.

Sector Size is the number of bytes in each sector.

Total Sectors is the total number of sectors on the CompactFlash Disk.

Number of FAT Sectors is the number of sectors used to track allocation of clusters to files.

Sectors Per Cluster is the number of sectors contained in each cluster. (Files grow by a minimum of one cluster.)

Number of Clusters is the total number of clusters available for use by files.

Number of Data Sectors is the number of sectors available for files.

Base Root Sector is the logical address of the first sector of the root directory.

Base FAT Sector is the first sector in the File Allocation Table (FAT).

Base Data Sector is the first sector available for use by files.

Using the pwd Command

To determine which CompactFlash Disk slot you are accessing, use the pwd command:

System# pwd
disk0:/
System#

The preceding example indicates that you are currently in the working directory called disk0:, which is the CompactFlash Disk.

Using the cd Command

To move back and forth between installed CompactFlash Disks, use the cd command by defining a specific path name. Then to verify your working directory, use the pwd command:

System# cd disk0:
System# pwd
disk0:/

You can also move up (or back) one level in the CompactFlash Disk directory hierarchy by using the cd .. command, and then verify your working directory with the pwd command:

System# pwd
disk0:daily_dir/
System# cd ..
System# pwd
disk0:/
System#

Using the dir Command

To list the directory structure and contents of the CompactFlash Disk from which you are currently working, use the dir command with no arguments:

System# dir
Directory of disk0:/
  1 drw-           0   Jul 25 2002 10:23:11  daily_dir
  2 drw-           0   Jul 25 2002 10:28:37  access_lists

64755200 bytes total (64742912 bytes free)
System#

Note that the size of the CompactFlash Disk is shown in the output of the dir command. (A 64-MB CompactFlash Disk is shown in this example.) You can also view the contents of other directories and file systems using specific optional arguments with the dir command. (See Table C-1.)

Using the format Command

To format a new CompactFlash Disk, use the format [disk0: ] command.


Note You must format a new CompactFlash Disk before you can use it.



Caution The formatting procedure erases all information on the CompactFlash Disk. To prevent the loss of important data that might be stored on a CompactFlash Disk, proceed carefully. If you want to save data that is currently on your CompactFlash Disk, copy the data to a TFTP server Disk before you format the new CompactFlash Disk. A CompactFlash Disk that was shipped as part of a configured system contains a CompactFlash Disk-compatible Cisco IOS software image; therefore, you do not need to format it to use it in the system in which it was shipped.


Note A spare CompactFlash Disk is shipped blank; therefore, you must format it before you can use it.


Use the following procedure to format a new CompactFlash Disk using the format command. (The procedure assumes you have already booted your system.)


Step 1 Insert the CompactFlash Disk using the procedures in the "Installing and Removing the CompactFlash Disk" section.

Step 2 Use the format disk0: command to format the CompactFlash Disk as follows:

System# format disk0:
Format operation may take a while. Continue? [confirm]
Format operation will destroy all data in `disk0:'.  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:81760
Format:Total bytes in formatted partition:49861120   
Format:Operation completed successfully.
Format of disk0:complete

The new CompactFlash Disk is now formatted and ready to use in the system on which you formatted it.

Using the copy Command

To copy an image from a CompactFlash Disk to another file system or from another file system to the CompactFlash Disk, use the copy command:

copy [tftp: | disk0:] source-filename [tftp: | disk0:] destination-filename

In this example:

The file you want to copy is located in a file system (tftp:).

The variable source-filename is the name of the file you want to copy to another file system (tftp:, bootflash:, and so forth).

The variable destination-filename is the name you want to apply to this file after it is copied.

You do not need to change the filename; this is an option.

The following assumptions are made for this command:

You have a system processor with a CompactFlash Disk-compatible Cisco IOS software image in the onboard Flash memory—called boot flash memory—so you can start the system.

Your system is running an appropriate Cisco IOS Release for the Cisco 7304 router. See the Software Advisor for an appropriate Cisco IOS release.

The bootable image you want to copy to the CompactFlash Disk exists in another file system or on a TFTP server to which you have access (meaning you know its name and have connectivity to it), and at least one interface is available over which you can access this server through Telnet. To ensure access to a TFTP server, you need to configure at least one interface. To configure an interface, you can use the setup command or use the configuration editor.

An Ethernet interface is used in the examples that follow.

You know the filename of the image you want to copy to the CompactFlash Disk.


Note You might need to copy a new image to a CompactFlash Disk whenever a new Cisco IOS software release or a new Cisco IOS software maintenance release becomes available. You can use the copy command for this purpose.


Use the following procedure to copy a file (called new.image in this example) located on a CompactFlash Disk—called disk0:—to the CompactFlash Disk—called bootdisk:


Step 1 If the CompactFlash Disk is unformatted or has been formatted on another possibly incompatible system, format it now using the procedure in the "Using the format Command" section, as appropriate.

Step 2 To copy the image new.image to CompactFlash Disk disk0:, use the following series of commands:

System> enable
Password:
System# copy disk0:new.image bootdisk:new.image
3393 bytes copied in 0.548 secs#
System#

In the preceding example, the 3393-byte file new.image was copied to the CompactFlash Disk in approximately one-half second.

Step 3 Verify that the file new.image is now on the CompactFlash Disk:

System# pwd
disk0:/
System# dir
Directory of disk0:/
  1  -rw-        3393   Jul 26 1998 17:44:47 new.image
48755200 bytes total (48747008 bytes free)
System#


Using the mkdir Command

To create a directory on the CompactFlash Disk, use the mkdir command. The following example shows how to create a directory called daily_dir on the CompactFlash Disk, and then verify that it was created:

System# mkdir disk0:daily_dir
Created dir disk0:daily_dir
System# dir
Directory of disk0:/
  1  drw-           0   Jul 25 1998 10:15:43  daily_dir
48755200 bytes total (48751104 bytes free)
System#

Note If you create a directory and place a file in it that you plan to access or use later, be sure to define the entire directory path to the file as you enter the appropriate software commands.

For example, if you placed the file itsa.file into the directory daily_dir on the CompactFlash Disk in disk0:, you must designate the entire directory path as follows: disk0:daily_dir/itsa.file. Otherwise, the system might not be able to locate this file.


Using the rmdir Command

To remove a directory from the CompactFlash Disk, use the rmdir command. The following example shows how to remove the directory daily_dir from the CompactFlash Disk in disk0:, and then verify that it was removed:

System# rmdir disk0:daily_dir
Delete disk0:daily_dir? [confirm] y
Removed dir disk0:daily_dir
System# dir
Directory of disk0:/
  No files in directory.
48755200 bytes total (48751104 bytes free)
System#

Using the delete Command

To delete a file from a CompactFlash Disk, use the delete command. Use the dir command to find the file you want to delete, and then use the delete command to delete it.

The following example shows how to find a file (called fun1) on the CompactFlash Disk, delete the file, and then verify that it is deleted:


Step 1 Find the file you want to delete:

System# dir
Directory of disk0:/

  1  drw-           0   May 10 1998 09:54:53 fun1

48755200 bytes total (48742912 bytes free)

Step 2 Delete the file fun1:

System# delete disk0:fun1

Step 3 Verify that the file fun1 is deleted:

System# dir
Directory of disk0:/

  No files in directory. 

48755200 bytes total (48742912 bytes free)
System#


Enabling Booting from a CompactFlash Disk

This section explains how to enable booting from a CompactFlash Disk.

To enable booting from a CompactFlash Disk, set configuration register bits 3, 2, 1, and 0 to a value between 2 and 15 in conjunction with the boot system [disk0:] filename configuration command. This section includes only descriptions of boot commands specific to the CompactFlash Disk. (You use diskn: argument for boot commands.)

Following are definitions of the various CompactFlash Disk-related boot commands:

boot system flash disk0:—Boots the first file in the external CompactFlash Disk.

boot system flash bootdisk: —Boots the first file in the internal CompactFlash Disk.

boot system flash disk0:herfile or boot system flash herfile—Boots the file named herfile from the CompactFlash Disk. Note that the boot system flash herfile command defaults to searching for herfile in disk0: if it is entered without specifing a flash-file-system.

boot system flash bootdisk:hisfile—Boots the file named hisfile from the CompactFlash Disk.

As you enter boot commands, pay attention to how you use the Spacebar, which influences the way your system interprets the commands. Also, ensure that you define the entire path to a file as you enter the boot commands; otherwise, the system might not be able to find the file.

For example, notice the difference in the following correct and incorrect commands:

System(config)# boot system flash disk0:myfile

Based on the preceding correct command, the system boots the file specified (myfile).

System(config)# boot system flash disk0: myfile

Based on the preceding incorrect command, the system finds the filename field blank because there is a space after disk0:. In this case, the system ignores the filename argument and boots the first file on the CompactFlash Disk, which might not be the file called myfile.

Use the following procedure to enable booting the file myfile from a CompactFlash Disk:


Step 1 Enter configuration mode and specify an image filename in disk0: from which to boot by using the configure terminal command, as follows:

System# configure terminal
Enter configuration commands, one per line. End with CTRL-Z.
System(config)# boot system flash disk0:myfile

Step 2 Enable the boot system flash disk0:myfile command using the config-register command with the hexadecimal value shown in the following example:

System(config)# config-reg 0x2102

This command, with the hexadecimal value 0x2102, results in the following:

Enables the system to boot the default boot ROM software if the CompactFlash Disk-based image fails to boot—hexadecimal value 0x2000

Disables Break—hexadecimal value 0x0100

Enables the image myfile as the default boot image—hexadecimal value 0x0002


Step 3 Press Ctrl-Z to exit configuration mode:

System(config)#
Crtl-Z
System#

Step 4 Save the new configuration to NVRAM by using the copy system:running-config nvram:startup-config command as follows:

System# copy system:running-config nvram:startup-config


Boot Environment Variables

The contents of the boot environment variables, which are stored in the configuration file in NVRAM, determine the actions your system takes on bootup. To see the current settings of these variables, use the show bootvar command as follows:

Router> show bootvar
BOOT variable = 
CONFIG_FILE variable = 
Current CONFIG_FILE variable = 
BOOTLDR variable does not exist
Configuration register is 0x100

Following are explanations for each of these boot environment variables:

BOOT variable—Points to the Cisco IOS software image that you want to boot; you set it in configuration mode. The default software image is the CISCOxxx image (where xxx is a filename assigned by the system, if you do not enter a specific filename). The system then looks for the first image on the CompactFlash Disk in disk0:.

Enter configuration mode and specify a filename and CompactFlash Disk slot from which to boot using the configure terminal and boot system commands as follows:

Router# configure terminal
Enter configuration commands, one per line. End with CTRL-Z.
System(config)# boot system flash disk0:<image>

The result of this configuration file entry is that the BOOT variable is disk0:c7300-js-mz.

CONFIG_FILE (configuration file) variable—Determines where the configuration is read from on bootup; you set it in configuration mode as follows:

Router# configure terminal
Enter configuration commands, one per line. End with CTRL-Z.
System(config)# boot config disk0:<image>

The result of this configuration file entry is that the CONFIG_FILE variable is disk0:configfile.

BOOTLDR (boot loader) variable—Determines which image is used as the boot helper(boot image); you set it in configuration mode as follows:

Router# configure terminal
Enter configuration commands, one per line. End with CTRL-Z.
System(config)# boot bootldr disk0:<image>

The result of this configuration file entry is that the BOOTLDR variable is boot flash c7300-boot	
-mz.

Configuration register variable—Instructs the system where to look for a bootable Cisco IOS software image; you set it as a hexadecimal value in configuration mode as follows:

Router# configure terminal
Enter configuration commands, one per line. End with CTRL-Z.
System(config)# config-register 0x102

The result of this configuration file entry is that the configuration register is set to hexadecimal 0x102. For more information on the configuration register, see the Cisco IOS Configuration Fundamentals manual.

If there is no boot system command in the configuration file, the router will try to load the default file image from the CompactFlash Disk. For more information, see "Rebooting the Router" in the Cisco IOS Configuration Fundamentals manual.

Making a CompactFlash Disk-Based Software Image the Bootable Software Image

This section explains how to make a CompactFlash Disk-based Cisco IOS software image a bootable image.

After you copy a software image to the CompactFlash Disk, use the following series of commands to make the image bootable (the file named new.image in this example). The software image in this example is located on the CompactFlash Disk. Note that the config-register command is also a part of this command sequence because you must set the configuration register to 0x2102 to enable loading an image from the CompactFlash Disk.

System# config terminal
System(config)# no boot system
System(config)# boot system flash disk0:new.image
System(config)# config-register 0x2102
Ctrl-Z
System# copy system:running-config nvram:startup-config
System# reload

When the system reloads, it boots the image new.image from the CompactFlash Disk.