- Table of Contents
-
- 01-Fundamentals Configuration Guide
- 00-Preface
- 01-CLI configuration
- 02-RBAC configuration
- 03-Login management configuration
- 04-FTP and TFTP configuration
- 05-File system management configuration
- 06-Configuration file management configuration
- 07-Software upgrade configuration
- 08-ISSU configuration
- 09-Emergency shell configuration
- 10-Automatic configuration
- 11-Device management configuration
- 12-Security zone configuration
- 13-Tcl configuration
- 14-Python configuration
- 15-Management with BootWare
- 16-License management
- Related Documents
-
Title | Size | Download |
---|---|---|
05-File system management configuration | 90.24 KB |
Specifying a directory name or file name
File system management restrictions and guidelines
Managing storage media and file systems
Mounting or unmounting a file system
Displaying directory information
Displaying the working directory
Changing the working directory
Archiving or extracting directories
Setting the operation mode for directories
Displaying the contents of a text file
Compressing or decompressing a file
Archiving or extracting files·
Deleting files from the recycle bin
Setting the operation mode for files
Managing file systems
Overview
File systems
The following matrix shows the storage media supported on different models of devices:
Device model |
Storage media |
SR6600 |
Flash memory USB disk |
SR6600-X |
CF card USB disk |
Each storage medium on the device has one file system.
File system location
(In standalone mode.) To identify a file system that is not located on the active MPU, you must specify the file system location in the slotn# format. The n argument represents the slot number of the standby MPU. For example, the location is slot16# for a file system that resides on the MPU in slot 16.
(In IRF mode.) To identify a file system that is not located on the global active MPU, you must specify the file system location in the chassism#slotn# format. The m argument represents a member device's IRF member ID. The n argument represents the slot number of an MPU. For example, the location is chassis2#slot16# for a file system that resides on the MPU in slot 16 of member device 2.
File system naming conventions
The name of the file system on a flash memory has the following parts:
· File system location. For more information, see "File system location".
· Storage medium type flash.
· Colon (:).
The name of the file system on a CF card or USB disk has the following parts:
· File system location. For more information, see "File system location".
· Storage medium type, cf or usb.
· Sequence number, a lower-case English letter such as a, b, or c.
· Partition number, which is fixed at 0.
· Colon (:).
|
IMPORTANT: File system names are case sensitive and must be entered in lower case. |
Default file system
You are working with the default file system by default after you log in. To specify a file or directory on the default file system, you do not need to specify the file system name. For example, you do not need to specify any location information if you want to save the running configuration to the root directory of the default file system.
To change the default file system, use the BootWare. For more information, see the software release notes.
Directories
Directories in a file system are structured in a tree form.
Root directory
The root directory is represented by a forwarding slash (/). For example, flash:/ represents the root directory of the flash memory.
Working directory
The working directory is also called the current directory.
In standalone mode, the default working directory is the root directory of the flash memory on the active MPU. In IRF mode, the default working directory is the root directory of the flash memory on the global active MPU. (Applicable to SR6600 routers.)
In standalone mode, the default working directory is the root directory of the CF card on the active MPU. In IRF mode, the default working directory is the root directory of the CF card on the global active MPU. (Applicable to SR6600-X routers.)
Directory naming conventions
When you specify a name for a directory, follow these conventions:
· A directory name can contain letters, digits, and special characters except for asterisks (*), vertical bars (|), forward slashes (/), backward slashes (\), question marks (?), left angle brackets (<), right angle brackets (>), quotation marks ("), and colons (:).
· A directory whose name starts with a dot character (.) is a hidden directory. To prevent the system from hiding a directory, make sure the directory name does not start with a dot character.
Commonly used directories
The device has some factory-default directories. The system automatically creates directories during operation. These directories include:
· diagfile—Stores diagnostic information files.
· license—Stores license files.
· logfile—Stores log files.
· seclog—Stores security log files.
· versionInfo—Stores software version information files.
Files
File naming conventions
When you specify a name for a file, follow these conventions:
· A file name can contain letters, digits, and special characters except for asterisks (*), vertical bars (|), forward slashes (/), backward slashes (\), question marks (?), left angle brackets (<), right angle brackets (>), quotation marks ("), and colons (:).
· A file whose name starts with a dot character (.) is a hidden file. To prevent the system from hiding a file, make sure the file name does not start with a dot character.
Common file types
The device is shipped with some files. The system automatically creates files during operation. The types of these files include:
· .ipe file—Compressed software image package file.
· .bin file—Software image file.
· .cfg file—Configuration file.
· .mdb file—Binary configuration file.
· .log file—Log file.
Hidden files and directories
Some system files and directories are hidden. For correct system operation and full functionality, do not modify or delete hidden files or directories.
Specifying a directory name or file name
Specifying a directory name
To specify a directory, you can use the absolute path or a relative path. For example, the working directory is cfa0:/. To specify the test2 directory in Figure 1, you can use the following methods:
· cfa0:/test/test1/test2 (absolute path)
· cfa0:/test/test1/test2/ (absolute path)
· test/test1/test2 (relative path)
· test/test1/test2/ (relative path)
Figure 1 Sample directory hierarchy
Specifying a file name
To specify a file, use the following methods:
· Enter the absolute path of the file and the file name in the format of filesystem/directory1/directory2/…/directoryn/filename, where directoryn is the directory in which the file resides.
· Enter the relative path of the file and the file name.
For example, the working directory is cfa0:/. The samplefile.cfg file is in the test2 directory shown in Figure 1. To specify the file, you can use the following methods:
· cfa0:/test/test1/test2/samplefile.cfg
· test/test1/test2/samplefile.cfg
FIPS compliance
The device supports the FIPS mode that complies with NIST FIPS 140-2 requirements. Support for features, commands, and parameters might differ in FIPS mode and non-FIPS mode. For more information about FIPS mode, see Security Configuration Guide.
File system management restrictions and guidelines
To avoid file system corruption, do not perform the following tasks during file system management:
· Install or remove storage media.
· Install or remove cards.
· Perform an active/standby switchover. (In standalone mode.)
· Perform a switchover between the global active MPU and a global standby MPU. (In IRF mode.)
· Creating, deleting, starting, or stopping an MDC.
If you remove a storage medium while a directory or file on the medium is being accessed, the device might not recognize the medium when you reinstall it. To reinstall this kind of storage medium, perform one of the following tasks:
· If you were accessing a directory on the storage medium, change the working directory.
· If you were accessing a file on the storage medium, close the file.
· If another administrator was accessing the storage medium, unmount the storage medium.
Make sure a USB disk is not write protected before an operation that requires the write right on the disk.
You cannot access a storage medium or a file system that is being formatted or repaired. To access a storage medium or a file system after it is formatted or repaired, use one of the following methods:
· Use the absolute path to specify a file or directory. For example, use the dir cfa0:/ command to display the files and directories in the file system on the CF card.
· Use the cd command to change the working directory to the root directory of the file system before accessing a file or directory in the file system. For example, to display the files and directories in the root directory of the file system on the CF card, perform the following tasks:
a. Use the cd cfa0:/ command to change the working directory to the root directory of the file system.
b. Execute the dir command.
Before managing file systems, directories, and files, make sure you know the possible impact.
Managing storage media and file systems
Mounting or unmounting a file system
Generally, file systems on a hot-swappable storage medium are automatically mounted when the storage medium is connected to the device. If the system cannot recognize a file system, you must mount the file system before you can access it.
To remove a hot-swappable storage medium from the device, you must first unmount all file systems on the storage medium to disconnect the medium from the device. Removing a connected hot-swappable storage medium might damage files on the storage medium or even the storage medium itself.
To use an unmounted file system, you must mount the file system again.
Restrictions and guidelines
You can mount or unmount a file system only when no other users are accessing the file system.
To prevent a USB disk and the USB interface from being damaged, make sure the following requirements are met before unmounting file systems on the USB disk:
· The system has recognized the USB disk.
· The USB disk LED is not blinking.
Configuration procedure
Perform one of the following tasks in user view as appropriate:
Task |
Command |
Mount a file system. |
mount filesystem |
Unmount a file system. |
umount filesystem |
Formatting a file system
|
CAUTION: Formatting a file system permanently deletes all files and directories in the file system. You cannot restore the deleted files or directories. |
You can format a file system only when no other users are accessing the file system.
Perform this task in user view.
Task |
Command |
Format a file system. |
format filesystem |
Repairing a file system
If part of a file system is inaccessible, use this task to examine and repair the file system.
You can repair a file system only when no other users are accessing the file system.
Perform this task in user view.
Task |
Command |
Repair a file system. |
fixdisk filesystem |
Managing directories
Displaying directory information
Perform this task in user view.
Task |
Command |
Display directory or file information. |
dir [ /all ] [ file | directory | /all-filesystems ] |
Displaying the working directory
Perform this task in user view.
Task |
Command |
Display the working directory. |
pwd |
Changing the working directory
Perform this task in user view.
Task |
Command |
Change the working directory. |
cd { directory | .. } |
Creating a directory
Perform this task in user view.
Task |
Command |
Create a directory. |
mkdir directory |
Renaming a directory
Perform this task in user view.
Task |
Command |
Rename a directory. |
rename source-directory dest-directory |
Archiving or extracting directories
When you archive or extract directories or display archived directories, files in the directories are also archived, extracted, or displayed.
Perform the following tasks in user view:
Task |
Command |
Archive directories. |
tar create [ gz ] archive-file dest-file [ verbose ] source source-directory &<1-5> |
Extract directories. |
tar extract archive-file file [ verbose ] [ screen | to directory ] |
Display archived directories. |
tar list archive-file file |
Deleting a directory
To delete a directory, you must delete all files and subdirectories in the directory. To delete a file, use the delete command. To delete a subdirectory, use the rmdir command.
Deleting a directory permanently deletes all its files in the recycle bin, if any.
Perform this task in user view.
Task |
Command |
Delete a directory. |
rmdir directory |
Setting the operation mode for directories
The device supports the following directory operation modes:
· alert—The system prompts for confirmation when your operation might cause problems such as data loss. This mode provides an opportunity to cancel a disruptive operation.
· quiet—The system does not prompt for confirmation.
To set the operation mode for directories:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Set the operation mode for directories. |
file prompt { alert | quiet } |
The default mode is alert. This command also sets the operation mode for files. |
Managing files
You can create a file by copying a file, downloading a file, or using the save command. For more information about downloading a file, see "Configuring FTP" and "Configuring TFTP." For more information about the save command, see Fundamentals Command Reference.
Displaying file information
Perform this task in user view.
Task |
Command |
Display directory or file information. |
dir [ /all ] [ file | directory | /all-filesystems ] |
Displaying the contents of a text file
Perform this task in user view.
Task |
Command |
Display the contents of a text file. |
more file |
Renaming a file
Perform this task in user view.
Task |
Command |
Rename a file. |
rename source-file dest-file |
Copying a file
Perform this task in user view.
Task |
Command |
Copy a file. |
·
In non-FIPS mode: ·
In FIPS mode: |
Moving a file
Perform this task in user view.
Task |
Command |
Move a file. |
move source-file { dest-file | dest-directory } |
Compressing or decompressing a file
Perform the following tasks in user view:
Task |
Command |
Compress a file. |
gzip file |
Decompress a file. |
gunzip file |
Archiving or extracting files
Perform the following tasks in user view:
Task |
Command |
Archive files. |
tar create [ gz ] archive-file dest-file [ verbose ] source source-file &<1-5> |
Extract files. |
tar extract archive-file file [ verbose ] [ screen | to directory ] |
Display the names of archived files. |
tar list archive-file file |
Deleting or restoring a file
You can delete a file permanently or move it to the recycle bin. A file moved to the recycle bin can be restored, but a permanently deleted file cannot.
Files in the recycle bin occupy storage space. To save storage space, periodically empty the recycle bin by using the reset recycle-bin command.
Perform the following tasks in user view:
Task |
Command |
Delete a file by moving it to the recycle bin. |
delete file |
Restore a file from the recycle bin. |
undelete file |
Delete a file permanently. |
delete /unreserved file |
|
IMPORTANT: Do not use the delete command to delete files from the recycle bin. To delete files from the recycle bin, use the reset recycle-bin command. |
Deleting files from the recycle bin
Each file system has a recycle bin of its own. A recycle bin is a folder named .trash in the root directory of a file system.
To view which files or directories are in a recycle bin, use one of the following methods:
· Access the file system and execute the dir/all .trash command.
· Execute the cd .trash command to enter the recycle bin folder, and then execute the dir command.
To delete files from a recycle bin, perform the following task in user view:
Task |
Command |
Delete files from the recycle bin. |
reset recycle-bin [ /force ] |
Calculating the file digest
File digests are used to verify file integrity.
Use the following commands in user view:
Task |
Command |
Calculate the digest of a file by using the SHA-256 algorithm. |
sha256sum file |
Calculate the digest of a file by using the MD5 algorithm. |
md5sum file |
Setting the operation mode for files
The device supports the following file operation modes:
· alert—The system prompts for confirmation when your operation might cause problems such as file corruption or data loss. This mode provides an opportunity to cancel a disruptive operation.
· quiet—The system does not prompt for confirmation.
To set the operation mode for files:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Set the operation mode for files. |
file prompt { alert | quiet } |
The default mode is alert. This command also sets the operation mode for directories. |