For feedback and comments:
documentation.feedback@alcatel-lucent.com

Table of Contents Previous Next PDF


File System Management
In This Chapter
This chapter provides information about file system management.
Topics in this chapter include:
 
 
The File System
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.
 
Compact Flash Devices
The file system is based on a DOS file system In the 7750 SR-Series, each control processor can have up to three compact flash devices numbered one through three. 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 compact flash devices on the 7750 SR routers are removable and have an administrative state (shutdown/no shutdown).
NOTE: To prevent corrupting open files in the file system, you should only remove a compact flash that is administratively shutdown. SR OS gracefully closes any open files on the device, so it can be safely removed.
 
URLs
The arguments for the SR OS file commands are modeled after standard universal resource locator (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 17.
 
[cflash-id:\]path
cflash-id is the compact flash device name.
Values: cf1:, cf2:, cf3:
ftp://[username[:password]@]host/path
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
tftp://host[/path]/filename
Note that 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, theThe 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.
 
Wildcards
SR OS 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: A:ALA-1>file cf3:\ # copy test*.cfg siliconvalley
cf1:\testfile.cfg
1 file(s) copied.
A:ALA-1>file cf3:\ # cd siliconvalley
A:ALA-1>file cf3:\siliconvalley\ # dir
Volume in drive cf1 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.
A:ALA-1>file cf3:\siliconvalley\ #
As in a DOS file system, the wildcard characters can only be used in some of the file commands.
 
Another example of wildcard usage:
A:21# show router mpls lsp l-63-8*
===============================================================================
MPLS LSPs (Originating)
===============================================================================
LSP Name                           To                  Fastfail     
Adm   Opr 
Config                 
-------------------------------------------------------------------------------
l-63-8-cc                          213.224.245.8       No           
Up    Dwn 
l-63-8-cw                          213.224.245.8       No           
Up    Dwn 
-------------------------------------------------------------------------------
LSPs : 2
===============================================================================
A:21#
All the commands can operate on the local file system. Table 18 indicates which commands also support remote file operations.
File Management Tasks
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.
 
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 cf
3:\ # attrib
file cf3:\ # attrib +r BOF.SAV
file cf3:\ # attrib
 
 
 
 
 
 
The following displays the file configuration:
		A:ALA-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\bootlog_prev.txt
cf3:\BOF.SAV
	A:ALA-1>file cf3:\ # attrib +r BOF.SAV
	A:ALA-1>file cf3:\ # attrib
cf3:\bootlog.txt
cf3:\bof.cfg
cf3:\boot.ldr
cf3:\bootlog_prev.txt
	R 	cf3:\BOF.SAV
 
Creating Directories
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:
CLI Syntax: file>
md file-url
The following displays an example of the command syntax:
Example: file cf1:\ # md test1
file cf1:\ # cd test1
file cf1:\test1\ # md test2
file cf1:\test1\ # cd test2
file cf1:\test1\test2\ # md test3
file cf1:\test1\test2\ # cd test3
file cf1:\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 7750 SR 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:
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:	 	A:ALA-1>file cf1:\ # copy 104.cfg cf1:\test1\test2\test3\test.cfg
		A:ALA-1>file cf1:\ # scp file1 admin@192.168.x.x:cf1:\file1 
		A:ALA-1>file cf1:\ # scp file2 user2@192.168.x.x:/user2/file2 
		A:ALA-1>file cf1:\ # scp cf2:/file3 admin@192.168.x.x:cf1:\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:	 	A:ALA-1>file cf1:\test1\test2\test3\ # move test.cfg cf1:\test1
cf1:\test1\test2\test3\test.cfg
A:ALA-1>file cf1:\test1\test2\test3\ # cd ..
A:ALA-1>file cf1:\test1\test2\ # cd ..
A:ALA-1>file cf1:\test1\ # dir

Directory of cf1:\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.
		A:ALA-1>file cf1:\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 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:
CLI Syntax: file#
delete file-url [force]
rd file-url [force]
The following displays an example of the command syntax:
A:ALA-1>file cf1:\test1\ # delete test.cfg
A:ALA-1>file cf1:\test1\ # delete abc.cfg
A:ALA-1>file cf1:\test1\test2\ # cd test3
A:ALA-1>file cf1:\test1\test2\test3\ # cd ..
A:ALA-1>file cf1:\test1\test2\ # rd test3
A:ALA-1>file cf1:\test1\test2\ # cd ..
A:ALA-1>file cf1:\test1\ # rd test2
A:ALA-1>file cf1:\test1\ # cd ..
A:ALA-1>file cf1:\ # rd test1
A:ALA-1>file cf1:\ #
 
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.
The type command displays the contents of a file.
The version command displays the version of a *.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:ALA-1>file cf1:\ # dir
 Volume in drive cf1 on slot A has no label.
Directory of cf1:\
01/01/1980  12:00a                7597 test.cfg
01/01/1980  12:00a                 957 b.
08/19/2001  02:14p              230110 BOOTROM.SYS
01/01/1980  12:00a                 133 NVRAM.DAT
04/03/2003  05:32a                1709 103.ndx
01/28/2003  05:06a                1341 103.cftg.ndx
01/28/2003  05:06a               20754 103.cftg
04/05/2003  02:20a      <DIR>          test
              15 File(s)                 338240 bytes.
               3 Dir(s)                 1097728 bytes free.
A:ALA-1>file cf1:\ # type fred.cfg
# Saved to /cflash1/fred.cfg
# Generated THU FEB 21 01:30:09 2002 UTC
exit all
config
#------------------------------------------
# Chassis Commands
#------------------------------------------
card 2 card-type faste-tx-32
exit
#------------------------------------------
# Interface Commands
#------------------------------------------
# Physical port configuration
interface faste 2/1
    shutdown
    mode network
exit
interface faste 2/2
    shutdown
exit
interface faste 2/3
    shutdown
exit
interface faste 2/4
A:ALA-1>file cf1:\ # version boot.tim
TiMOS-L-1.0.B3-8
A:ALA-1>file cf1:\ #
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 [cflash-id]
The following displays an example of the command syntax:
A:ALA-1>file cf3:\ # repair 
Checking drive cf3: on slot A for errors...
Drive cf31: on slot A is OK.