1-2 File Management

  • Cisco IOS has many files and file systems that require management.

  • File management consists of managing configuration files and operating system files.

  • Cisco routers use a file system known as IFS (IOS File System).

  • IFS commands replace many older file-management commands.

  • IFS commands allow for viewing and classification of all files, including files on remote servers.

  • With IFS, there are no longer any differences for management of files on different platforms.

  • With IFS, you can copy files with complete path information to eliminate the need for system prompting.

  • Three Flash file system types are supported on Cisco platformsClass A, Class B, and Class C.

NOTE

IFS is a relatively new feature of the IOS. It is an extremely powerful way of managing files within the router file systems and on remote systems. Because it is new, many people are unfamiliar with the commands. In order to provide backward compatibility, many aliases map to older commands for file management. See Table 1-4 at the end of this section for a listing of the older commands and the IFS equivalents.


Navigating File Systems

  1. Viewing the available file systems:

     (privileged)  show file systems  

    This command gives you a detailed listing of all the file systems available on the router. This command lists the total size and the amount of free space on the file system in bytes, the type of file system, the flags for the file system, and the alias name used to access the file system. File system types include Flash, NVRAM, and network, as well as some others, such as ROM file systems, which contain microcode . Table 1-2 lists some of the file systems that are available. Note that not all file systems are available on all platforms.

Table 1-2. Cisco File Systems
Prefix File System
system: Contains the system memory, including the running configuration.
nvram: Nonvolatile Random-Access Memory. This contains the startup configuration.
flash: Flash memory typically is the location of the IOS. This is the default or starting file system for file system navigation. The prefix flash: is available on all platforms. For platforms that do not have a device named flash:, the prefix flash: is aliased to slot0:. Therefore, you can use the prefix flash: to refer to the main Flash memory storage area on all platforms.
bootflash: Boot Flash memory typical location for Rxboot IOS image.
slot0: First PCMCIA Flash memory card.
slot1: Second PCMCIA Flash memory card.
tftp: Trivial File Transfer Protocol (TFTP) network server.
ftp: File Transfer Protocol (FTP) network server.
slavenvram: NVRAM on a slave RSP card of a high-end router, such as a 7513, configured for redundancy.
slavebootflash: Internal Flash memory on a slave RSP card of a high-end router, such as a 7513, configured for redundancy.
slaveslot0: First PCMCIA card on a slave RSP card of a high-end router, such as a 7513, configured for redundancy.
slaveslot1: Second PCMCIA card on a slave RSP card of a high-end router, such as a 7513, configured for redundancy.
flh: Flash load helper log files.
null: Null destination for copies. You can copy a remote file to null to determine its size.
rcp: Remote copy protocol (rcp) network server.
disk0: Rotating media.
xmodem: Obtain the file from a network machine using the Xmodem protocol.
ymodem: Obtain the file from a network machine using the Ymodem protocol.
  1. Change the default file system directory:

     (privileged)  cd  [  filesystem:  ] 

    Use this command to move to a specific file system or directory within that file system. By moving to a specific file location, you can use file system commands without having to specify the filesystem: option. For example, if you do a dir command without specifying the filesystem:, it uses the directory that was specified by the default directory or the cd command. The default file system directory is flash.

  2. List the current directory:

     (privileged)  pwd  

    This command prints the working directory. By using this command, you can determine the default file system directory. Use this command to verify that you have moved into the appropriate directory when using the cd command.

  3. Display information about the files:

     (privileged)  dir  [/  all  ] [  filesystem:  ][  path/filename  ] 

    This command displays a directory of the default directory structure as specified by the cd command. By using the option /all, you see files that have been deleted but not permanently removed from a file system. You can also specify a file system by using the filesystem: option. If you want to view a single file, provide the path and filename also. You can use an asterisk ( * ) as a wildcard to display a group of files with common starting characters . You can use this command to get a list of files on any available local file system.

     (privileged)  show   filesystem   :  

    This command displays the contents of a file system. It is similar to the dir command, but the output is formatted differently. This command does not allow individual files or remote file systems to be displayed.

  4. View the information about a local or remote file:

     (privileged)  show file information   filesystem:path  

    This command allows you to view information about a file on a remote or local file system. The output displays the image type and size.

  5. View the contents of a local or remote file:

     (privileged)  more  [  /ascii   /binary   /ebcdic  ]  filesystem:path  

    Use this command to view the contents of a remote or local file. The options ascii, binary, and ebcdic allow you to specify the type of format in which you would like to see the file presented. The filesystem:path options allow you to specify a particular file on a valid file system. For example, more /ascii tftp://172.16.3.1/myconfig.txt displays the file myconfig.txt located on TFTP server 172.16.3.1 in ASCII format.

Deleting Files from Flash

Cisco hardware platforms have three different classifications of file systems. Each of these file systems deals differently with deleting and permanently removing files from the Flash file system. Table 1-3 lists these three types of file systems and the platforms that use them.

Table 1-3. File System Types
File System Type Platforms
Class A Cisco 7000 family, C12000, LS1010, Catalyst 6500 series
Class B Cisco 1003, Cisco 1004, Cisco 1005, Cisco 1600 series, Cisco 1700 series, Cisco 2500 series, Cisco 2600 series, Cisco 3600 series, Cisco 4000 series, Cisco AS5200
Class C Cisco MC3810, disk0 of SC3640
  1. Delete a file from Flash memory:

     (privileged)  delete  [  filesystem:  ]  filename  

    This command deletes a file from Flash on any of the three classifications of file systems. For Type A and B file systems, the file is marked as deleted and shows up only if the command dir /all is used. Files that are marked as deleted can be restored using the undelete command. For type C file systems, the delete command permanently removes the file from the system. The file system must be a Flash file system.

  2. Restore a deleted file:

     (privileged)  undelete index  [  filesystem:  ] 

    For type A and B file systems, if a file has been deleted, you can restore it using the undelete command. You must provide the index number of the file listed by the dir /all command. If the file is not located in your working directory, determined by the pwd command, you can specify the filesystem: option.

  3. Permanently remove a file from Class A Flash memory:

     (privileged)  squeeze filesystem:  

    If you want to permanently remove a file that has been deleted from a Class A file system, you must squeeze the file system. This command removes any file on the file system that has been marked as deleted.

  4. Permanently remove a file from Class B Flash memory or NVRAM:

     (privileged)  erase  [  flash:   bootflash:   nvram:filename  ] 

    To permanently remove a file from a Class B file system, you must erase the file system device. This command removes all the files in the device. By using the command erase nvram:filename, you can delete a file from NVRAM.

  5. Reformat the file system:

     (privileged)  format filesystem:  

    For Class A and Class C devices, you can remove all the files and reformat the device using the format command.

Moving System Files

With most computer systems, it is important to be able to move files from one location to another. To move system files, you use the copy command. This command, along with path parameters, moves system files. The results of some file-system moves are unique. For example, when a file is copied to the system:running-configuration file, the result is a file merge. This section discusses some common copy commands and the results, but on the whole, files can be moved to file systems that allow you to write to the system. The command structure for copy commands is copy [/erase] source-location destination-location. The source and destination locations can be any writeable file system and path. By using the /erase option, you can always erase the destination of a writeable file system before the file is copied. The source location can be any file system that contains files that need to be moved. With all these commands, you can specify the address and filename, or you can leave them out, and the system will prompt you for the information.

  1. Save the active configuration file to be used for startup:

     (privileged)  copy system:running-config nvram:startup-config  

    This command copies the system's current active configuration into the startup configuration file. When anything is copied to the location nvram:startup-config, it is a complete overwrite. In other words, any information that was in that file is completely lost and is overwritten with the source file. The startup configuration file is loaded at startup.

  2. Copy a file into the active configuration:

     (privileged)  copy   source   system:running-config  

    This command copies a file into the current running configuration. The source can be any location that contains a text file that has configuration parameters framed in the appropriate syntax. When files are copied to the running configuration, they are merged with the current configuration. In other words, if a configuration parameter such as an address exists in both placesrunning and sourcethe running is changed by the parameter that is being copied from the source location. If the configuration parameter exists only in the source location, it is added to the running configuration. If a parameter exists in the running configuration but is not modified in the source configuration, there is no change to the running configuration. The source location can be a file in any location, including a file on a TFTP server or FTP server or a text file that has been written to Flash memory.

  3. Save a file to a TFTP server:

     (privileged)  copy   source   tftp:  //  address/   filename  

    This command allows you to save any readable file from an IFS source location to a TFTP server specified in the address of the destination parameter. If you do not supply a filename and address, you are prompted by the system for this information.

  4. Save a file to an FTP server with anonymous login:

     (privileged)  copy   source   ftp://   directory/filename  

    You can also save files to an FTP server. FTP offers a more reliable and robust method of file transfer. As with TFTP, you can copy from any source location to an FTP server. Any readable file can be copied. The main difference is that FTP requires a username and password for the transfer of traffic. The username and password can be specified in global configuration or on the command line. If you don't specify a username in the command or globally for the router, the router uses an anonymous login. The username is anonymous, and the e-mail type password is formed by the router using the current session as the username, the router name as the host name, and the IP domain as the domain name (session@hostname.domain).

  5. Save a file to an FTP server using the username and password specified in global configuration:

     (global)  ip ftp username   username  (global)  ip ftp password   password  (privileged)  copy   source   ftp://   address/directory/filename  

    If you have configured an IP FTP username and password, and you do not specify a password in the command line, the configured username and password are used when you copy files to and from an FTP server.

  6. Save a file to an FTP server using the username and password specified in the command line:

     (privileged)  copy   source   ftp://   username:password@address/directory/   filename  

    If you want to specify the password in the command line, you can do so with the format username:password@address. The username and password are separated by a colon (:), and the address of the FTP server follows the at (@) symbol.

  7. Save a file to Flash memory:

     (privileged)  copy   source  flash-filesystem:  //   path/filename  

    You can copy a file to any Flash file system of a router with the copy command. Some writeable file systems, such as a Class A file system, allow you to create and write to directories as well as files. This copy command allows you to move files into a Flash file system. Files that are moved into Flash are usually IOS files, but Flash can be used to store any file as long as you have room to place it. If fact, as soon as a file has been placed in Flash memory, the router can be configured as a TFTP server and can then serve that file to other devices. See the following subsection for more information about configuring your router to act as a TFTP server.

Related File Management Commands

  1. Compress the configuration file:

     (global)  service compress-config  

    This command allows you to compress your configuration file. Because NVRAM is limited on a router, a very large configuration file might need to be compressed before being stored in NVRAM. The service compress-config command compresses the file to one-third of its normal size.

    NOTE

    Configuration compression is supported only on routers that have Release 10 or later of boot ROM. If your router does not have this version or a later version, you need to perform a ROM upgrade to compress your configuration file. Check your device's documentation to find out how to perform a ROM upgrade.

  2. Specify an IOS image to boot from in a Flash file system:

     (global)  boot system flash   flash-filesystem:/directory/filename  

    By default, routers boot the first valid image in the default Flash location. If you have more than one file in Flash memory and you do not want to boot the first file, you must specify which file is to be used as the IOS image. The boot system flash command specifies which file to use.

  3. Change the config-file environment parameter for Class A file systems:

     (global)  boot config   flash-filesystem:directory/filename  

    For a Class A file system, you can copy configuration files to the Flash filesystem. You can also specify to the router that it is to load a configuration from Flash instead of the startup-config file located in NVRAM. To do this, you must first copy the active configuration to the Flash file system. Then, in global configuration mode, use the boot config parameter followed by the file system name and file location and name. After you save this configuration, the router attempts to load the configuration from the specified location.

  4. Configure the router to act as the TFTP server for files in Flash memory:

     (global)  tftp-server flash   flash-filesystem:/directory/filename  

    This command specifies a file to be served out of the Flash memory file system by the router acting as a TFTP server. You can serve multiple files out of Flash using this command.

Alias Commands

Because the IFS is the third-generation file-management system for Cisco IOS, alias commands have been established to provide backward compatibility for commands that existed in previous operating systems. This allows you to use file-management commands that you might have learned in previous releases without having to learn the new command structure. Table 1-4 shows the alias commands and the IFS equivalent commands.

Table 1-4. File Management Alias Commands
Release 10.2 and Earlier Command Release 10.3 to 11.3 Command Release 12.0 and Later (IFS) Command
write terminal show running-config show system:running-config or more system:running-config
show config show startup-config show system:startup-config or more system:startup-config
write memory copy running-config startup-config copy system:running-config nvram:startup-config
write erase erase startup-config erase nvram:
write network copy running-config tftp: copy system:running-config tftp:// address/filename
config memory copy startup-config running-config copy nvram:startup-config system:running-config
config network copy tftp running-config copy tftp:// address/filename system:running-config
config overwrite copy tftp startup-config copy tftp:// address/filename nvram:startup-config
Cisco's official stance on older commands is that they might not be supported in future releases, so it is conceivable that commands that existed before Release 12.0 might not be supported in future releases of Cisco IOS.


Cisco Field Manual[c] Router Configuration
Cisco Field Manual[c] Router Configuration
ISBN: 1587050242
EAN: N/A
Year: 2005
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net