File system management
This chapter provides information about file system management.
Topics in this chapter include:
The file system
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.
Compact flash device
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:
cf3:
cf3-A:
cf3-B:
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:
7705 SAR-A
7705 SAR-Ax
7705 SAR-M
7705 SAR-H
7705 SAR-Hc
7705 SAR-Wx
7705 SAR-X
The 7705 SAR-8 Shelf V2, 7705 SAR-18, 7705 SAR-H, and 7705 SAR-M have removable compact flash cards.
The 7705 SAR-A, 7705 SAR-Ax, 7705 SAR-Hc, and 7705 SAR-Wx do not have removable compact flash cards; they are shipped with integrated memory that is used to store system boot software, OS software, and configuration files and logs.
The 7705 SAR-X has two removable compact flash cards but they are not field-replaceable. Replacement of the devices is done as a repair service.
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.
URLs
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 the following table.
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 |
file-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 username |
||
pswd is the FTP user password |
||
remote-locn is the remote host (hostname or IP address) Values:
|
||
file-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. |
|
destination-file-url |
[user@hostname:file-path] |
The destination file to be copied to a remote host file system |
user is the SSH user, 32 characters maximum |
||
hostname is the hostname of the remote location, up to 128 characters maximum Values:
|
||
file-path is the destination file path, 200 characters maximum; directory length is 99 characters maximum each |
||
tftp-url |
tftp://login:pswd@remote-locn/file-path |
TFTP is only supported for operations on file-urls |
File command local and remote file system support 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 uses either slash or backslash characters, but not all SCP clients treat backslash characters as equivalent to slash characters. In particular, UNIX systems interpret the backslash character as an ‟escape” character. This causes 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 gets stripped by the parser and is not transmitted to the 7705 SAR SCP server.
For example, a destination directory specified as ‟cf3:\dir1\file1” is 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.
Wildcards
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:
ALU-1>file cf3:\ # copy test*.cfg siliconvalley
cf3:\testfile.cfg
1 file(s) copied.
ALU-1>file cf3:\ # cd siliconvalley
ALU-1>file cf3:\siliconvalley\ # dir
Volume in drive cf3 on slot A has no label.
Directory of cf3:\siliconvalley\
05/10/2006 11:32p <DIR> .
05/10/2006 11:14p <DIR> ..
05/10/2006 11:32p 7597 testfile.cfg
1 File(s) 7597 bytes.
2 Dir(s) 1082368 bytes free.
ALU-1>file cf3:\siliconvalley\ #
As in a DOS file system, the 7705 SAR wildcard characters can only be used in some of the file commands.
Common configuration tasks
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.
Modifying file attributes
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:
- CLI Syntax:
file>
attrib
[+r | -r] file-url
The following displays an example of the command syntax:
- Example:
# file
file cf3:\ #
attribfile cf3:\ #
attrib +r BOF.SAVfile cf3:\ #
attrib
The following displays the file configuration:
ALU-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\bootlog_prev.txt
cf3:\BOF.SAV
ALU-1>file cf3:\ # attrib +r BOF.SAV
ALU-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\bootlog_prev.txt
R cf3:\BOF.SAV
Creating and navigating directories
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:
- CLI Syntax:
file>
md
file-url
The following displays an example of the command syntax:
- Example:
file cf3:\ # md test1
file cf3:\ # cd test1
file cf3:\test1\ # md test2
file cf3:\test1\ # cd test2
file cf3:\test1\test2\ # md test3
file cf3:\test1\test2\ # cd test3
file cf3:\test1\test2\test3 #
Copying files
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:
- CLI syntax:
file>
copy source-file-url dest-file-url [force]
scp local-file-url destination-file-url [router router name | service-id] [force]
The following displays an example of the copy command syntax:
- Example:
-
ALU-1>file cf3::\ # copy 104.cfg cf3::\test1\test2\test3\test.cfg ALU-1>file cf3::\ # scp file1 admin@192.168.x.x:cf3::\file1 ALU-1>file cf3::\ # scp file2 user2@192.168.x.x:/user2/file2 ALU-1>file cf3::\ # scp cf3::/file3 admin@192.168.x.x:cf3::\file3
Moving files
Use the move command to move a file or directory from one location to another.
Use the CLI syntax displayed below to move files:
- CLI Syntax:
file>
move old-file-url new-file-url [force]
The following displays an example of the command syntax:
- Example:
ALU-1>file cf3::\test1\test2\test3\ # move test.cfg cf3::\test1 cf3::\test1\test2\test3\test.cfg ALU-1>file cf3::\test1\test2\test3\ # cd .. ALU-1>file cf3::\test1\test2\ # cd .. ALU-1>file cf3::\test1\ # dir Directory of cf3::\test1\ 05/04/2006 07:58a <DIR> . 05/04/2006 07:06a <DIR> .. 05/04/2006 07:06a <DIR> test2 05/04/2006 07:58a 25278 test.cfg 1 File(s) 25278 bytes. 3 Dir(s) 1056256 bytes free. ALU-1>file cf3::\test1\ #
Deleting files and removing directories
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 or subdirectories or both, 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:
- CLI syntax:
-
file>
delete file-url [force]
rd file-url [force]
The following displays an example of the command syntax:
ALU-1>file cf3::\test1\ # delete test.cfg
ALU-1>file cf3::\test1\ # delete abc.cfg
ALU-1>file cf3::\test1\test2\ # cd test3
ALU-1>file cf3::\test1\test2\test3\ # cd ..
ALU-1>file cf3::\test1\test2\ # rd test3
ALU-1>file cf3::\test1\test2\ # cd ..
ALU-1>file cf3::\test1\ # rd test2
ALU-1>file cf3::\test1\ # cd ..
ALU-1>file cf3::\ # rd test1
ALU-1>file cf3::\ #
Use the CLI syntax displayed below to remove a directory without first deleting files or subdirectories:
- CLI syntax:
-
file>
rd file-url rf
Displaying directory and file information
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:
- CLI syntax:
file>
dir [file-url]
type file-url
version file-url
The following displays an example of the command syntax:
A:ALU-1# file
A:ALU-1>file cf3::\ # dir
Volume in drive cf3: on slot A has no label.
Volume in drive cf3: on slot A is formatted as FAT32.
Directory of cf3::\
02/08/2008 11:23a 140584 boot.ldr
02/07/2008 12:19p 786 bof.cfg
02/13/2008 05:42p 2058 bootlog.txt
01/13/2008 05:42p 2434 bootlog_pre.txt
01/30/2008 05:17p 797 bof.cfg.arash
01/25/2008 04:11p <DIR> TXT
01/30/2008 11:36a 787 bof.cfg.ftp
01/30/2008 01:11p 736 bof.cfg.root
01/30/2008 11:35a 886 bof.cfg.deep
01/30/2008 11:35a 483 bof.cfg.JC
8 File(s) 411097 bytes.
1 Dir(s) 1043456 bytes free.
A:ALU-1>file cf3::\ # type bof.cfg
# TiMOS-B-1.1.R1 both/hops NOKIA SAR 7705
# Copyright (c) 2016 Nokia.
# All rights reserved. All use subject to applicable license agreements.
# Built on Wed Apr 9 09:53:01 EDT 2016 by csabuild in /rel2.0/b1/R1/panos/main
# Generated WED APR 09 20:18:06 2016 UTC
primary-image ftp://*:*@xxx.xxx.xxx.xx/home/csahwreg17/images/both.tim
primary-config ftp://*:*@ xxx.xxx.xxx.xx /home/csahwreg17/images/dut-a.cfg
address xxx.xxx.xxx.xx /24 active
address xxx.xxx.xxx.xx /24 standby
primary-dns xxx.xxx.xxx.xx
dns-domain labs.ca.alcatel-lucent.com
static-route xxx.xxx.0.0/16 next-hop xxx.xxx.xxx.x
autonegotiate
duplex full
speed 100
wait 3
persist off
console-speed 115200
A:ALU-1>file cf3::\ #
Repairing the file system
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:
- CLI syntax:
-
file
repair [flash-id]
The following displays an example of the command syntax:
ALU-1>file cf3:\ # repair
Checking drive cf3: on slot A for errors...
Drive cf3: on slot A is OK.
File system command reference
Command hierarchy
Configuration commands
file
- attrib [+r | -r] file-url
- attrib
- cd [file-url]
- copy source-file-url dest-file-url [force]
- delete file-url [force]
- dir [file-url] [sort-order {d | n | s}] [reverse]
- format [flash-id] [reliable]
- md file-url
- move old-file-url new-file-url [force]
- rd file-url rf
- rd file-url [force]
- repair [flash-id]
- scp local-file-url destination-file-url [router router-instance] [force]
- scp local-file-url destination-file-url [service service-name] [force]
- [no] shutdown [active] [standby]
- [no] shutdown flash-id
- type file-url
- version file-url [check]
Command descriptions
Configuration commands
file
Syntax
file
Context
root
Description
This command enters the context to perform file system operations.
When entering the file context, the prompt changes to reflect the present working directory. Navigating the file system with the cd .. command results in a changed prompt.
The exit all command leaves the file system/file operation context and returns to the <ROOT> CLI context. The state of the present working directory is maintained for the CLI session. Entering the file command returns the cursor to the working directory where the exit command was issued.
attrib
Syntax
attrib [+r | -r] file-url
attrib
Context
file
Description
This command sets or clears/resets the read-only attribute for a file in the local file system.
To list all files and their current attributes, enter attrib or attrib x where x is either the filename or a wildcard (*).
When an attrib command is entered to list a specific file or all files in a directory, the file’s attributes are displayed with or without an ‟R” preceding the filename. The ‟R” implies that the +r is set and that the file is read-only. Files without the ‟R” designation imply that the -r is set and that the file is read-write-all. For example:
ALU-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\sr1.cfg
cf3:\test
cf3:\bootlog_prev.txt
R cf3:\BOF.SAV
Parameters
- file-url
the URL for the local file (see URL types and syntax for parameter descriptions)
- +r
sets the read-only attribute on the specified file
- -r
clears/resets the read-only attribute on the specified file
cd
Syntax
cd [file-url]
Context
file
Description
This command displays or changes the current working directory in the local file system.
Parameters
- file-url
the URL for the local file (see URL types and syntax for parameter descriptions)
- <none>
displays the current working directory
- ..
signifies the parent directory. This can be used in place of an actual directory name in a directory-url.
- directory-url
the destination directory
copy
Syntax
copy source-file-url dest-file-url [force]
Context
file
Description
This command copies a file or all files in a directory from a source URL to a destination URL. At least one of the specified URLs should be a local URL. The optional wildcard (*) can be used to copy multiple files that share a common (partial) prefix and/or (partial) suffix.
When a file is copied to a destination with the same filename, the original file is overwritten by the new file specified in the operation. The following prompt appears if the destination file already exists:
‟Overwrite destination file (y/n)?”
For example:
To copy a file named srcfile in a directory called test on cf3: in slot CSM B to a file called destfile in a directory called production on cf3: in slot CSM A, the syntax is:
file cf3:\ # copy cf3-B:/test/srcfile cf3-A:/production/destfile
To FTP a file named 121201.cfg in directory mydir stored on cf3: in slot CSM A to a network FTP server with IP address 192.0.2.255 in a directory called backup with a destination filename of 121201.cfg, the FTP syntax is:
copy cf3-A:/mydir/121201.cfg 192.0.2.255.79/backup/121201.cfg
Parameters
- source-file-url
the location of the source file or directory to be copied (see file-url)
- dest-file-url
the destination of the copied file or directory (see file-url)
- force
forces an immediate copy of the files without displaying a user prompt message
- file-url
the local or remote URL (see URL types and syntax for parameter descriptions)
delete
Syntax
delete file-url [force]
Context
file
Description
This command deletes the specified file.
The optional wildcard ‟*” can be used to delete multiple files that share a common (partial) prefix and/or (partial) suffix. When the wildcard is entered, the following prompt displays for each file that matches the wildcard:
‟Delete file <filename> (y/n)?”
Parameters
- file-url
the filename to delete (see URL types and syntax for parameter descriptions)
- force
forces an immediate deletion of the specified files
file delete * force deletes all the wildcard matching files without displaying a user prompt message
dir
Syntax
dir [file-url] [sort-order {d | n | s}] [reverse]
Context
file
Description
This command displays a list of files and subdirectories in a directory. The sort-order keyword sorts the files by date, name, or size. The default is to list in ascending order (oldest to newest, A to Z, or smallest to largest); to list the files in descending order, use the reverse keyword.
Parameters
- file-url
the path or directory name (see URL types and syntax for parameter descriptions)
Use file-url with the optional wildcard (*) to reduce the number of files to list.
- sort-order
specifies the order by which the files are sorted
- reverse
sorts the files in descending order
format
Syntax
format [flash-id] [reliable]
Context
file
Description
This command formats the compact flash. The compact flash must be shut down before formatting.
Parameters
- cflash-id
the compact flash type (see URL types and syntax for parameter descriptions and values)
- reliable
enables the reliance file system and disables the default DOS file system. This option is valid only on compact flashes 1 and 2.
md
Syntax
md file-url
Context
file
Description
This command creates a new directory in a file system.
Directories can only be created one level at a time.
Parameters
- file-url
the directory name to be created (see URL types and syntax for parameter descriptions)
move
Syntax
move old-file-url new-file-url [force]
Context
file
Description
This command moves a local file, system file, or a directory. If the target already exists, the command fails and an error message displays.
The following prompt appears if the destination file already exists:
‟Overwrite destination file (y/n)?”
Parameters
- old-file-url
the file or directory to be moved (see URL types and syntax for parameter descriptions)
- new-file-url
the new destination to place the old-file-url (see URL types and syntax for parameter descriptions)
- force
forces an immediate move of the specified files
file move force executes the command without displaying a user prompt message
rd
Syntax
rd file-url rf
rd file-url [force]
Context
file
Description
This command removes (deletes) a directory in a file system.
If the directory is empty, the rd command is used to remove it. The force option executes the command without prompting the user to confirm the action.
If the directory contains files and/or subdirectories, the rf parameter must be used to remove the directory.
Parameters
- file-url
the directory to be removed (see URL types and syntax for parameter descriptions)
- rf
forces a recursive delete (directory and its subdirectories/files)
- force
forces an immediate deletion of the specified directory; no user prompt is displayed
repair
Syntax
repair [flash-id]
Context
file
Description
This command checks a compact flash device for errors and repairs any errors found.
Parameters
- cflash-id
the compact flash slot ID to be shut down or enabled. When a specific cflash-id is specified, then that drive is shut down. If no cflash-id is specified, the drive referred to by the current working directory is assumed. If a slot number is not specified, then the active CSM is assumed.
scp
Syntax
scp local-file-url destination-file-url [router router-instance] [force]
scp local-file-url destination-file-url [service service-name] [force]
Context
file
Description
This command copies a local file to a remote host file system. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh. When the command is entered, the following prompt appears:
‟Are you sure (y/n)?”
The destination must specify a user and a host.
Parameters
- local-file-url
the local source file or directory (see URL types and syntax for parameter descriptions)
- destination-file-url
the destination file (see URL types and syntax for parameter descriptions)
- router-instance
specifies the router name or service ID
- service-name
specifies the service name, 64 characters maximum
- force
forces an immediate copy of the specified file
file scp local-file-url destination-file-url [router router-instance | service-name service-name] force executes the command without displaying a user prompt message
shutdown
Syntax
[no] shutdown [active] [standby]
[no] shutdown flash-id
Context
file
Description
This command shuts down (unmounts) the specified CSMs.
Use the no shutdown [active] [standby] command to enable one or both CSMs.
Use the no shutdown flash-id command to enable a compact flash (cf3: on all platforms; cf1: or cf2: on the 7705 SAR-18) on the CSM. The no shutdown command can be issued for a specific slot when no compact flash is present. When a compact flash is installed in the slot, the device is activated upon detection.
In redundant systems, use the no shutdown command on cf3: on both CSMs in order to facilitate synchronization. See the synchronize command in the config>redundancy context.
The shutdown command must be issued before removing a compact flash. If no parameters are specified, the drive referred to by the current working directory shuts down.
LED status indicators — the following states are possible for the compact flash:
Operational: If a compact flash is present in a drive and operational (no shutdown), the respective LED is lit green. The LED flickers when the compact flash is accessed. Do not remove the compact flash during a read/write operation.
State: admin = up, operational = up, equipped
Flash defective: If a compact flash is defective, the respective LED blinks amber to reflect the error condition and a trap is raised.
State: admin = up/down, operational = faulty, equipped = no
Flash drive shut down: When the compact flash drive is shut down and a compact flash is present, the LED is lit amber. In this state, the compact flash can be ejected.
State: admin = down, operational = down, equipped = yes
No compact flash present, drive shut down: If no compact flash is present and the drive is shut down, the LED is unlit.
State: admin = down, operational = down, equipped = no
No compact flash present, drive enabled: If no compact flash is present and the drive is not shut down, the LED is unlit.
State: admin = up, operational = down, equipped = no
Ejecting a compact flash: The compact flash drive should be shut down before ejecting a compact flash. The LED should turn to solid (not blinking) amber. This is the only way to safely remove the compact flash. If a compact flash drive is not shut down before a compact flash is ejected, the LED blinks amber for approximately 5 s before shutting off.
State: admin = down, operational = down, equipped = yes
The shutdown or no shutdown state is not saved in the configuration file. Following a reboot, all compact flash drives are in their default state.
Default
no shutdown — compact flash device is administratively enabled
Parameters
- cflash-id
the compact flash slot ID to be shut down or enabled. If a cflash-id is specified, the drive is shut down or enabled. If no cflash-id is specified, the drive referred to by the current working directory is assumed. If a slot number is not specified, the active CSM is assumed.
- active
all drives on the active CSM are shut down or enabled
- standby
all drives on the standby CSM are shut down or enabled
If both active and standby keywords are specified, all drives on both CSMs are shut down or enabled.
type
Syntax
type file-url
Context
file
Description
This command displays the contents of a text file.
Parameters
- file-url
the file contents to display (see URL types and syntax for parameter descriptions)
version
Syntax
version file-url[check]
Context
file
Description
This command displays the version of a -TiMOS both.tim file.
Parameters
- file-url
the filename of the target file (see URL types and syntax for parameter descriptions)
- check
validates the .tim file
Output
The following example shows the version of a -TiMOS both.tim file.
A:ALU-1# file version cf3:/both.tim
TiMOS-B-0.0.R1 for NOKIA SAR 7705
A:ALU-1# file version ftp://timos:timos@xxx.xxx.xx.xx/./both.tim check
Validation successful
TiMOS-I-0.0.R1 for NOKIA SAR 7705
B:Performance#