Catalyst 4500 Series Software Configuration Guide, 7.5
Using the Flash File System

Table Of Contents

Using the Flash File System

Using the Flash File System

Setting the Default Flash Device

Setting the Text File Configuration Mode

Listing the Files on a Flash Device

Displaying the Contents of a File on a Flash Device

Copying Files

Deleting Files

Restoring Deleted Files

Verifying a File Checksum


Using the Flash File System


This chapter describes how to use the Flash file system on the Catalyst enterprise LAN switches. The Flash file system provides a number of useful commands to help you manage system image and configuration files. The Catalyst 4000 family, 2948G, and 2980G switches have one Flash device: botflies.


Note For complete syntax and usage information for the commands used in this chapter, see Command Reference—Catalyst 4000 Family, Catalyst 2948G, and Catalyst 2980G Switches.


Using the Flash File System

These sections describe how to work with the Flash file system:

Setting the Default Flash Device

Setting the Text File Configuration Mode

Listing the Files on a Flash Device

Displaying the Contents of a File on a Flash Device

Copying Files

Deleting Files

Restoring Deleted Files

Verifying a File Checksum

Setting the Default Flash Device

When you set the default Flash device for the system, the default device is assumed when you enter a Flash file system command without specifying the Flash device.

To set the default Flash device, perform this task:

 
Task
Command

Step 1 

Set the default Flash device for the system.

cd [[m/][bootflash:]]

Step 2 

Verify the default Flash device for the system.

pwd [mod_num]

This example shows how to change the default Flash device to bootflash: and verify the default device:

Console> (enable) cd bootflash:
Console> (enable) pwd
bootflash
Console> (enable)

Setting the Text File Configuration Mode

When you configure the switch to use text file configuration mode, the switch stores its configuration as a text file in nonvolatile storage, either in NVRAM or Flash memory. This text file consists of commands entered by you to configure various features. For example, if you disable a port, the command to disable that port will be in the text configuration file.

Since the text file contains only commands you have used to configure your switch, it typically uses less NVRAM or Flash memory space than binary configuration mode. Because the text configuration file in most cases requires less space, NVRAM is a good place to store the file. If the text file exceeds NVRAM space, it can also be stored to Flash memory.

When the switch is operating in text file configuration mode, most user settings are not immediately saved to NVRAM. Configuration changes are written only to DRAM. You will need to enter the write memory command to store the configuration in nonvolatile storage.


Note VLAN commands are not saved as part of the configuration file when the switch is operating in text mode with the VTP mode set to server.


To set the text file configuration mode, perform this task in privileged mode:

 
Task
Command

Step 1 

Set the file configuration mode for the system to text.

set config mode {binary | text} [nvram | device:file-id]

Step 2 

Verify the file configuration mode for the system.

show config mode

Step 3 

Save the text file configuration.

write memory

Step 4 

Display the current runtime configuration.

show running-config all

Step 5 

Display the startup configuration that will be used after the next reset.

show config

This example shows how to configure the system to save its configuration as a text file in NVRAM, verify the configuration mode, and display the current runtime configuration:

Console> (enable) set config mode text nvram
Console> (enable) show config mode
Console> (enable) show running-config all
Console> (enable) show config
Console> (enable)

Listing the Files on a Flash Device

To list the files on a Flash device, perform one of these tasks:

Task
Command

Display a list of files on a Flash device.

dir [[m/]device:][filename]

Display a list of only deleted files on a Flash device.

dir [[m/]device:][filename] deleted

Display a list of all files on a Flash device, including deleted files.

dir [[m/]device:][filename] all

Display a detailed list of files on a Flash device.

dir [[m/]device:][filename] long


This example shows how to list the files on the default Flash device:

Console> (enable) dir
-#- -length- -----date/time------ name
  1  3846376 Jun 14 2000 14:13:10 cat4000-k4.6-1-0-104-ORL.bin
  2  3761580 Jun 14 2000 14:16:05 cat4000.6-1-0-104-ORL.bin

3795052 bytes available (7608212 bytes used) 
Console> (enable)

This example shows how to list the deleted files on the default Flash device:

Console> (enable) dir deleted
-#- ED --type-- --crc--- -seek-- nlen -length- -----date/time------ name
  1 .D ffffffff 81a027ca   41bdc   22     7004 Apr 01 1998 15:27:45 4003.config. 
4.1.98.cfg
  2 .D ffffffff ccce97a3   43644   23     6630 Apr 01 1998 15:36:47 4003.default 
.config.cfg
  3 .D ffffffff 81a027ca   45220   15     7004 Apr 19 1998 10:05:59 4003_config.cfg
1213952 bytes available (6388224 bytes used)
Console> (enable)

Displaying the Contents of a File on a Flash Device

In software release 5.2 and later releases, you can display the contents of a file on a Flash device onscreen. Use the dump keyword to display a hex dump of the file.

To display the contents of a file on a Flash device, perform this task in privileged mode:

Task
Command

Display the contents of a file on a Flash device.

show file [device:]filename [dump]


This example shows how to display the contents of a file in bootflash:

Console> (enable) show file bootflash:dns_config.cfg
begin

!
#dns
set ip dns server 172.16.10.70 primary
set ip dns server 172.16.10.140
set ip dns enable
set ip dns domain corp.com
end
Console> (enable)

Copying Files

Use the copy command to perform these tasks:

Download a system image or configuration file from a TFTP or RCP server to a Flash device

Upload a system image or configuration file from a Flash device to a TFTP or RCP server

Configure the switch using a configuration file on a Flash device or on a TFTP or RCP server

Copy the current configuration to a Flash device or to a TFTP or RCP server

To copy a file, perform one of these tasks in privileged mode:

Task
Command

Copy a Flash file to a TFTP server, Flash memory, or to the running configuration.

copy file-id {tftp | rcp | flash | file-id | config}

Copy a file from a TFTP server to Flash memory, or to the running configuration.

copy {tftp | rcp} {flash | file-id | config}

Copy a file from Flash memory to a TFTP server, or to the running configuration.

copy flash {tftp | rcp | file-id | config}

Copy the running configuration to Flash memory, or to a TFTP server.

copy config {flash | file-id | tftp | rcp}


This example shows how to copy a file from a TFTP server to the running configuration:

Console> (enable) copy tftp config
IP address or name of remote host []? 172.20.52.3
Name of file to copy from []? dns_config.cfg
Configure using tftp:dns_config.cfg (y/n) [n]? y
/
Finished network download.  (135 bytes)
>>
>> set ip dns server 172.16.10.70 primary
172.16.10.70 added to DNS server table as primary server.
>> set ip dns server 172.16.10.140
172.16.10.140 added to DNS server table as backup server.
>> set ip dns enable
DNS is enabled
>> set ip dns domain corp.com
Default DNS domain name set to corp.com
Console> (enable)

This example shows how to download a configuration file from a TFTP server for storage in bootflash:

Console> (enable) copy tftp flash
IP address or name of remote host []? 172.20.52.3
Name of file to copy from []? dns-config.cfg
Flash device [bootflash]?
Name of file to copy to [dns-config.cfg]?
9932056 bytes available on device slot0, proceed (y/n) [n]? y
/
File has been copied successfully.
Console> (enable)

This example shows how to copy the running configuration to Flash memory:

Console> (enable) copy config flash
Flash device [bootflash]? bootflash:
Name of file to copy to []? 4012_config.cfg
Upload configuration to bootflash:4012_config.cfg
9942096 bytes available on device bootflash, proceed (y/n) [n]? y
.....
..........
.......
..........
...........
..
Configuration has been copied successfully.
Console> (enable)

This example shows how to upload a configuration file on bootflash to a TFTP server:

Console> (enable) copy bootflash:4012_config.cfg tftp
IP address or name of remote host []? 172.20.52.3
Name of file to copy to [4012_config.cfg]?
/
File has been copied successfully.
Console> (enable)

This example shows how to upload an image from a remote host into Flash memory using the copy rcp flash command:

Console> (enable) copy rcp flash
IP address or name of remote host []? 172.20.52.3
Name of file to copy from []? cat4000.6-1-1.bin
Flash device [bootflash]?
Name of file to copy to [cat4000.6-1-1.bin]?
4369664 bytes available on device bootflash, proceed (y/n) [n]? y
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCC
File has been copied successfully.
Console> (enable) 

Deleting Files

Use the delete command to delete files from a Flash device.


Caution If you enter the squeeze command on a Flash device, you cannot restore files that you deleted from that device before you entered the squeeze command.

To delete files from a Flash device, perform this task in privileged mode:

 
Task
Command

Step 1 

Delete a file from a Flash device.

delete [[m/]device:]filename

Step 2 

If desired, permanently remove all deleted files on the Flash device (this operation can take a number of minutes to complete).

squeeze [m/]device:

Step 3 

Verify that the files are deleted.

dir [[m/]device:][filename]

This example shows how to delete a file from a Flash device:

Console> (enable) delete dns_config.cfg
Console> (enable)

This example shows how to permanently remove all deleted files from a Flash device:

Console> (enable) squeeze bootflash:
All deleted files will be removed, proceed (y/n) [n]? y
Squeeze operation may take a while, proceed (y/n) [n]? y
Erasing squeeze log
Console> (enable)

Restoring Deleted Files

You must specify the index number of a deleted file to undelete it. The index number for each file appears in the first column of the dir command output. A file cannot be undeleted if a valid file with the same name already exists. Instead, you must delete the existing file and then undelete the desired file. A file can be deleted and undeleted up to 15 times.

To restore deleted files on a Flash device, perform this task in privileged mode:

 
Task
Command

Step 1 

Identify the index number of the deleted files on the Flash device.

dir [[m/]device:][filename] deleted

Step 2 

Undelete a file on a Flash device.

undelete index [[m/]device:]

Step 3 

Verify that the file is restored.

dir [[m/]device:][filename]

This example shows how to restore a deleted file:

Console> (enable) dir deleted
-#- ED --type-- --crc--- -seek-- nlen -length- -----date/time------ name
6 .D ffffffff 42da7f71  657a00   14      135 Jul 17 1999 11:30:05 dns_config.cfg
1213952 bytes available (3231989 bytes used)
Console> (enable) undelete 6
Console> (enable) dir
-#- -length- -----date/time------ name
5  3231989 Jun 24 1999 12:04:40 cat4000.4-4-0-28.bin
  6      135 Jul 17 1999 11:30:05 dns_config.cfg
1213952 bytes available (3231989 bytes used)
Console> (enable)

Verifying a File Checksum

To verify the checksum of a file on a Flash device, perform this task in privileged mode:

Task
Command

Verify the checksum of a file on a Flash device.

verify [[m/]device:] filename


This example shows how to verify the checksum of a file:

Console> (enable) verify cat4000.4-4-1.bin
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCC
File bootflash:cat4000.4-4-1.bin verified OK
Console> (enable)