This chapter provides information about file system management.
Topics in this chapter include:
The SR OS 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, display file or directory contents and the image version.
Although some of the storage devices on routers are not actually compact flash devices (for example, cf1: on the 7950 XRS is an internal SSD), we refer to all storage devices as compact flash.
The file system is based on a DOS file system (with an optional Reliance file system). In the 7750 SR and 7450 ESS, each control processor can have up to three compact flash devices numbered one through three. In the 7950 XRS, each CCM has an SSD and up to two compact flash devices. The names for these devices are:
The above device names are relative device names as they refer to the devices local to the control processor with the current console session. As in the DOS file system, the colon (“:”) at the end of the name indicates it is a device.
The three compact flash devices on the 7450 ESS and 7750 SR OS are removable and have an administrative state (shutdown/no shutdown).
The cf2: and cf3: compact flash devices on the 7950 XRS routers are removable and have an administrative state (shutdown/no shutdown). cf1: is an internal SSD.
![]() | Note: To prevent corrupting open files in the file system, you should only remove a compact flash that is administratively shutdown. The SR OS gracefully closes any open files on the device, so it can be safely removed. |
The arguments for the SR OS file commands are modeled after standard universal resource locater (URL). A URL refers to a file (a file-url) or a directory (a directory-url).
The SR OS 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 are listed in Table 25.
URL Type | Syntax | Notes |
local-url | [cflash-id:\]path | cflash-id is the compact flash device name. Values: cf1:, cf2:, cf3: |
ftp-url | ftp://[username[:password]@]host/path | An absolute ftp path from the root of the remote file system. username is the ftp user name password is the ftp user password host is the remote host path is the path to the directory or file |
ftp://[username[:password]@]host/./path | A relative ftp path from the user’s home directory. Note the period and slash (“./”) in this syntax compared to the absolute path. | |
tftp-url | tftp://host[/path]/filename | tftp is only supported for operations on file-urls. |
On the 7750 SR and 7950 XRS, if the host portion of the URL is an IPv6 address, then the address should be enclosed in square brackets. For example:
ftp://user:passw@[3ffe::97]/./testfile.txt
tftp://[1111:2222:3333:4444:5555:6666:7777:8888]/./testfile.txt
The system accepts either forward slash (/) or backslash (\) characters to delimit directory and/or filenames in URLs. Similarly, the SR OS 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 times interpret the backslash character as an escape character. This can cause problems when using an external SCP client application to send files to the 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 SCP server.
For example, a destination directory specified as “cf1:\dir1\file1” will be transmitted to the SCP server as “cf1: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 platform SROS 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.
As in a DOS file system, the wildcard characters can only be used in some of the file commands.
Another example of wildcard usage:
All the commands can operate on the local file system. Table 26 indicates which commands also support remote file operations.
Command | local-url | ftp-url | tftp-url |
attrib | X | ||
cd | X | X | |
copy | X | X | X |
delete | X | X | |
dir | X | X | |
md | X | ||
move | X | X | |
rd | X | ||
repair | |||
scp | source only | ||
type | X | X | X |
version | X | X | X |
shutdown |
The following sections are basic system tasks that can be performed.
Note that when a file system operation is performed with the copy, delete, move, rd, or scp commands that can potentially delete or overwrite a file system entry, a prompt appears to confirm the action. The force keyword performs the copy, delete, move, rd, and scp actions 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 shows an example of the command syntax:
The following example shows the file configuration:
Use the md command to create a new directory in the local file system, one level at a time.
Enter the cd command to navigate to different directories.
Use the CLI syntax displayed below to modify file attributes:
The following is 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 router. The destination file has to be of 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. The type command displays the contents of a file. The version command displays the version of a *.tim or iom.tim file. (iom.tim file is used for the XCM on the 7950 XRS).
Use the CLI syntax displayed below to display directory and file information:
The following shows 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 example shows the command syntax: