This chapter provides information about file system management.
Topics in this chapter include:
The 7705 SAR file system is used to store files used and generated by the system; for example, image files, configuration files, logging files, and accounting files.
The file commands allow you to copy, create, move, and delete files and directories, navigate to a different directory, and display file or directory contents and the image version.
The file system is based on a DOS file system. On the 7705 SAR, each CSM has an integrated compact flash device. The names for these devices are:
The first device name above (cf3:) is a relative device name in that it refers to the device local to the control processor on the CSM running the current console session. As in the DOS file system, the colon (“:”) at the end of the name indicates that it is a device.
The second and third device names (cf3-A: and cf3-B:) are absolute device names that refer directly to the device on CSM A or CSM B (CSM B applies only to chassis with redundant CSMs).
The device cf3-B: does not apply to the following chassis because they do not have redundant CSMs:
Note:
|
On the 7705 SAR-18, cf3: is used to store the software image required for system startup and operation, including the application load. The 7705 SAR-18 CSM also has two optional compact flash slots for two compact flash devices (cf1: and cf2:). These compact flash devices are also referred to as cf1-A:/cf1-B: and cf2-A:/cf2-B: to indicate whether they are on CSM A or CSM B. All the compact flash devices can be used to store software upgrades, statistics, logging files, accounting files, scripts, and configuration data.
Note: To prevent corruption of open files in the file system, compact flashes should be removed on those chassis that have replaceable compact flash cards only when the CFs are administratively shut down. The 7705 SAR gracefully closes any open files on the device so that it can be safely removed. |
The arguments for the 7705 SAR file commands are modeled after the standard universal resource locator (URL).
A URL can refer to a file (a file-url) or a directory (a directory-url).
The 7705 SAR supports operations on both the local file system and on remote files. For the purposes of categorizing the applicability of commands to local and remote file operations, URLs are divided into three types of URLs: local, ftp, and tftp.
The syntax for each of the URL types is listed in Table 16.
URL Type | Syntax | Notes |
local-url | [cflash-id/] [file-path] | cflash-id is the compact flash device name Values: cf1: | cf1-A: | cf1-B: | cf2: | cf2-A: | cf2-B: | cf3: | cf3-A: | cf3-B: (the 7705 SAR-18 supports all values; the 7705 SAR-8 Shelf V2 supports cf3:, cf3-A:, and cf3-B:; all fixed platforms support cf3: and cf3-A:) Length: 200 characters maximum, including cflash-id; directory length is 99 characters maximum each |
path is the path to the directory or file | ||
remote-url | [ftp://login:pswd@remote-locn/] [file-path] | An absolute ftp path from the root of the remote file system: Length: 255 characters maximum (could be less depending on command); directory length is 99 characters maximum each |
login is the ftp user name | ||
pswd is the ftp user password | ||
remote-locn is the remote host (hostname or IP address) Values:
path is the path to the directory or file | ||
ftp://login:pswd]@host/./path | A relative ftp path from the user’s home directory. Note the period and slash (“./”) in this syntax, as compared to the absolute path. | |
tftp-url | tftp://login:pswd@remote-locn/file-path | tftp is only supported for operations on file-urls |
Table 17 lists the commands that are supported both locally and remotely.
Command | local-url | ftp-url | tftp-url |
attrib | ✓ | ||
cd | ✓ | ✓ | |
copy | ✓ | ✓ | ✓ |
delete | ✓ | ✓ | |
dir | ✓ | ✓ | |
md | ✓ | ||
move | ✓ | ✓ | |
rd | ✓ | ||
repair | |||
scp | source only | ||
type | ✓ | ✓ | ✓ |
version | ✓ | ✓ | ✓ |
The 7705 SAR accepts either forward slash (“/”) or backslash (“\”) characters to delimit directory and/or filenames in URLs. Similarly, the 7705 SAR SCP client application can use either slash or backslash characters, but not all SCP clients treat backslash characters as equivalent to slash characters. In particular, UNIX systems will often interpret the backslash character as an “escape” character. This can cause problems when using an external SCP client application to send files to the 7705 SAR SCP server. If the external system treats the backslash like an escape character, the backslash delimiter will get stripped by the parser and will not be transmitted to the 7705 SAR SCP server.
For example, a destination directory specified as “cf3:\dir1\file1” will be transmitted to the 7705 SAR SCP server as “cf3:dir1file1” where the backslash escape characters are stripped by the SCP client system before transmission. On systems where the client treats the backslash like an “escape” character, a double backslash “\\” or the forward slash “/” can typically be used to properly delimit directories and the filename.
The 7705 SAR supports the standard DOS wildcard characters. The asterisk (*) can represent zero or more characters in a string of characters, and the question mark (?) can represent any one character.
Example:
As in a DOS file system, the 7705 SAR wildcard characters can only be used in some of the file commands.
The following sections describe the basic system tasks that can be performed.
Note: When a file system operation is performed with a command that can potentially delete or overwrite a file system entry (such as a copy, delete, move, rd, or scp command), a prompt appears to confirm the action. The force keyword performs the copy, delete, move, rd, or scp action without displaying the confirmation prompt. |
The system administrator can change the read-only attribute in the local file. Enter the attrib command with no options to display the contents of the directory and the file attributes.
Use the CLI syntax displayed below to modify file attributes:
The following displays an example of the command syntax:
The following displays the file configuration:
Use the md command to create a new directory in the local file system, one level at a time.
Use the cd command to navigate to different directories.
Use the CLI syntax displayed below to create a new directory:
The following displays an example of the command syntax:
Use the copy command to upload or download an image file, configuration file, or other file types to or from a flash card or a TFTP server.
The scp command copies files between hosts on a network. It uses SSH for data transfer, and uses the same authentication and provides the same security as SSH.
The source file for the scp command must be local. The file must reside on the 7705 SAR router. The destination file must be in the format: user@host:file-name. The destination does not need to be local.
Use the CLI syntax displayed below to copy files:
The following displays an example of the copy command syntax:
Use the move command to move a file or directory from one location to another.
Use the CLI syntax displayed below to move files:
The following displays an example of the command syntax:
Use the delete and rd commands to delete files and remove directories. Directories can be removed even if they contain files and/or subdirectories. To remove a directory that contains files and/or subdirectories, use the rd rf command. When files or directories are deleted, they cannot be recovered.
The force option deletes the file or directory without prompting the user to confirm.
Use the CLI syntax displayed below to delete files and then remove directories:
The following displays an example of the command syntax:
Use the CLI syntax displayed below to remove a directory without first deleting files or subdirectories:
Use the dir command to display a list of files on a file system.
Use the type command to display the contents of a file.
Use the version command to display the version of a 7705 SAR both.tim file.
Use the CLI syntax displayed below to display directory and file information:
The following displays an example of the command syntax:
Use the repair command to check a compact flash device for errors and repair any errors found.
Use the CLI syntax displayed below to check and repair a compact flash device:
The following displays an example of the command syntax: