- 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-Tcl configuration
- 13-License management
- 14-Management with BootWare
- 15-Python configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
05-File system management configuration | 133.01 KB |
Contents
Displaying the contents of a text file
Compressing/decompressing a file
Deleting files from the recycle bin
Displaying directory information
Displaying the current working directory
Changing the current working directory
Mounting or unmounting a storage medium
Partitioning a CF card or a USB disk
Setting the operation mode for files and folders
Managing the file system
This chapter describes how to manage the device's file system, including the storage media, directories, and files.
|
IMPORTANT: · Before managing storage media, files, and directories, make sure you know the possible impacts. · A file or directory whose name starts with a period (.) is considered a hidden file or directory. Do not give a common file or directory a name that starts with a period. · Some system files and directories are hidden. |
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.
Storage medium naming rules
The device supports Flash, CF card, and USB disk. These storage media are named according to the following rules:
· If a storage medium is the only storage medium of its type on the device, it is named by its type.
For example, if the device has only one Flash, the name of the Flash is flash.
· If the device has multiple storage media of the same type, a storage medium is named by its type, its sequence number, and the number 0. A sequence number is an English letter such as a, b, or c.
For example, for a device with multiple CF cards, the first CF card is named cfa0, the second is named cfb0, and so on.
· If a storage medium is partitioned, a partition is named by the storage medium type, sequence number, and partition number. Partitions on a storage medium start at 0 and increment by 1.
For example:
¡ For a device with only one CF card, the first and second partitions of the CF card are named cfa0 and cfa1, respectively.
¡ For a device with two CF cards, the third partition of the second CF card is named cfb2.
If there is only one partition on a CF card, the partition name is the same as the storage medium name, such as cfa0.
File name formats
|
IMPORTANT: · Storage medium names and the chassis and slot strings are case sensitive and must be entered in lower case. The system will display that the file or directory does not exist if you enter a storage name, the chassis string, or the slot string in upper case. · Folder names and file names are case insensitive. |
When you specify a file, enter the file name in one of the formats shown in Table 1 and Table 2. When you specify a directory, follow the rules for the drive and path arguments.
Table 1 File name formats in standalone mode
Format |
Description |
Example |
file-name |
Specifies a file in the current working directory. |
a.cfg indicates a file named a.cfg in the current working directory. This working directory might be on the active MPU or standby MPU. |
[path/]file-name |
Specifies a file in a folder in the current working directory. The path argument represents the path to the file. If the file is in a single-level folder, specify the folder name for the argument. If the file is in a nested folder, separate each folder name by a forward slash (/). |
· test/a.cfg indicates a file named a.cfg in the test folder in the current working directory. · test/subtest/a.cfg indicates a file named a.cfg in the subtest subfolder of the test folder in the current working directory. |
drive:/[path]/file-name |
Specifies a file in a storage medium. The drive argument represents the storage medium name. · The storage medium on the active MPU is typically flash or cfa0. · The storage medium on the standby MPU is typically slotn#flash or slotn#cfa0. The n represents the slot number of the standby MPU. To view MPUs' slot numbers, use the display device command. |
· flash:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the Flash on the active MPU. · slot1#flash:/a.cfg indicates a file named a.cfg in the root directory of the Flash on the standby MPU. |
Table 2 File name formats in IRF mode
Format |
Description |
Example |
file-name |
Specifies a file in the current working directory. |
a.cfg indicates a file named a.cfg in the current working directory. This working directory might be on any MPU in the IRF fabric. |
[path/]file-name |
Specifies a file in a folder in the current working directory. The path argument represents the path to the file. If the file is in a single-level folder, specify the folder name for the argument. If the file is in a nested folder, separate each folder name by a forward slash (/). |
· test/a.cfg indicates a file named a.cfg in the test folder in the current working directory. · test/subtest/a.cfg indicates a file named a.cfg in the subtest subfolder of the test folder in the current working directory. |
drive:/[path]/file-name |
Specifies a file in a storage medium on the device. The drive argument represents the storage medium name. · The storage medium on the active MPU of the master is typically flash or cfa0. · The storage medium on a subordinate device is typically chassism#slotn#flash or chassism#slotn#cfa0. The m represents the member ID of the subordinate device. The n represents the slot number of the MPU. To view member devices' member IDs, use the display irf command. |
· flash:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the Flash on the global active MPU of the IRF fabric. · chassis2#slot5#flash:/a.cfg indicates a file named a.cfg in the root directory of the Flash on the standby MPU in slot 5 on member device 2. |
Managing files
|
CAUTION: To avoid file system corruption: · In standalone mode, do not install or remove storage media or perform active/standby switchover during file operations. · In IRF mode, do not install or remove storage media or perform a switchover between the active MPU of the IRF fabric and the standby MPU of the IRF fabric during file operations. |
File management allows you to perform the following tasks:
· Display directory and file information.
· Display file contents.
· Rename, copy, move, remove, restore, and delete files.
· Calculate the digests of files for file integrity verification.
· Create a file by copying, downloading, 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.
Make sure a USB disk is not write protected before you rename, compress, decompress, delete, restore, or move a file on the disk, or copy a file to the disk.
Displaying file information
Perform this task in user view.
Task |
Command |
Display folder or file information. |
dir [ /all ] [ file-url | /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-url |
Renaming a file
Perform this task in user view.
Task |
Command |
Rename a file. |
rename fileurl-source fileurl-dest |
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 fileurl-source fileurl-dest |
Compressing/decompressing a file
Perform the following tasks in user view:
Task |
Command |
Compress a file. |
gzip filename |
Decompress a file. |
gunzip filename |
Deleting/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 with 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-url |
Restore a file from the recycle bin. |
undelete file-url |
Delete a file permanently. |
delete /unreserved file-url |
|
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
The device supports multiple storage media. If a storage medium does not support partitioning or is not partitioned, it has a recycle bin of its own. If a storage medium is partitioned, each partition has its own recycle bin.
A recycle bin is a folder named .trash in the root directory of the storage medium or partition.
To view which files or directories are in a recycle bin, use either of the following methods:
· Enter the storage medium or partition 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.
Perform this task in user view.
Task |
Command |
Calculate the digest of a file. |
sha256sum file-url |
Managing directories
CAUTION: To avoid file system corruption: · In standalone mode, do not install or remove storage media or perform active/standby switchover during directory operations. · In IRF mode, do not install or remove storage media or perform a switchover between the active MPU of the IRF fabric and the standby MPU of the IRF fabric during directory operations. |
You can create, display, or remove a directory, and display or change the current working directory.
Before you create or remove a directory on a USB disk, make sure the disk is not write protected.
Displaying directory information
Perform this task in user view.
Task |
Command |
Display directory or file information. |
dir [ /all ] [ file-url | /all-filesystems ] |
Displaying the current working directory
Perform this task in user view.
Task |
Command |
Display the current working directory. |
pwd |
Changing the current working directory
Perform this task in user view.
Task |
Command |
Change the current working directory. |
cd { directory | .. | / } |
Creating a directory
Perform this task in user view.
Task |
Command |
Create a directory. |
mkdir directory |
Removing a directory
To remove a directory, you must delete all files and subdirectories in this directory. To delete a file, use the delete command. To delete a subdirectory, use the rmdir command.
Removing a directory permanently deletes all its files in the recycle bin, if any.
Perform this task in user view.
Task |
Command |
Remove a directory. |
rmdir directory |
Managing storage media
|
CAUTION: To avoid file system corruption: · In standalone mode, do not install or remove storage media or cards or perform active/standby switchover while the system is repairing, formatting, partitioning, mounting, or unmounting a storage medium. · In IRF mode, do not install or remove storage media or perform a switchover between the active MPU of the IRF fabric and a standby MPU of the IRF fabric while the system is repairing, formatting, partitioning, mounting, or unmounting a storage medium. · Do not create, delete, start, or stop an MDC while the system is repairing, formatting, partitioning, mounting, or unmounting a storage medium. |
If you remove a storage medium while a folder or file on the storage medium is being accessed, the device might not recognize the storage medium when you reinstall it. To reinstall this kind of storage medium, perform one of the following tasks:
· If you were accessing a folder on the storage medium, change the current directory.
· If you were accessing a file on the storage medium, close the file.
· If another administrator was accessing the storage medium, unmount all partitions on the storage medium.
Before you repair or format a USB disk, make sure the disk is not write protected.
Repairing a storage medium
If part of a storage medium is inaccessible, use the fixdisk command to examine and repair the medium.
Before repairing a storage medium, make sure no other users are accessing the medium. Otherwise, the repair operation fails.
Perform this task in user view.
Task |
Command |
Repair a storage medium. |
fixdisk medium-name |
Formatting a storage medium
|
CAUTION: After a storage medium is formatted, all files and directories on it are erased and cannot be restored. |
To format a storage medium that has been partitioned, you must format all the partitions individually, instead of formatting the medium as a whole.
You can format a storage medium only when no one is accessing the medium.
Perform this task in user view.
Task |
Command |
Format a storage medium. |
format medium-name |
Mounting or unmounting a storage medium
Generally, a hot-swappable storage medium is automatically mounted when it is connected to the device. If the system cannot recognize the storage medium, however, you must mount the storage medium before you can access it.
To remove a hot-swappable storage medium from the device, you must first unmount it to disconnect it from the device. Otherwise, files on the storage medium or even the storage medium itself might be damaged.
Restrictions and guidelines
To mount/unmount a storage medium that is partitioned, you must mount/unmount all the partitions individually, instead of mounting/unmounting the medium as a whole. To unmount a USB disk, make sure the system has recognized the USB disk and the USB disk LED is not blinking. Otherwise, the USB interface or USB disk might be damaged.
Before unmounting a storage medium, make sure no other users are accessing the medium. Otherwise, the unmount operation fails.
Configuration procedure
Perform one of the following tasks in user view as appropriate:
Task |
Command |
Remarks |
Mount a storage medium. |
mount medium-name |
By default, a storage medium is automatically mounted and in mounted state when connected to the system. |
Unmount a storage medium. |
umount medium-name |
By default, a storage medium is automatically mounted and in mounted state when connected to the system. |
Partitioning a CF card or a USB disk
A CF card or a USB disk can be divided into logical devices called partitions. Operations on one partition do not affect the other partitions.
The following partitioning modes are available for CF cards and USB disks:
· Simple—Specify the number of partitions. The system divides the CF card or a USB disk into the specified number of partitions with the same size.
· Interactive—The system partitions the CF card or a USB disk according to user input. Each partition must have a minimum of 32 MB of starage space.
Restrictions and guidelines
The specified partition size and the actual partition size might have an error less than 5% of the total memory.
Before partitioning a CF card or USB disk, perform the following tasks:
· Back up the files in the storage medium. The partition operation clears all data in the medium.
· If you are partitioning a USB disk, make sure the disk is not write protected. Otherwise, the partition operation will fail, and you must remount or reinstall the disk to restore access to the USB disk.
· Make sure no other users are accessing the medium. Otherwise, the partition operation fails.
After partitioning a CF card or USB disk, perform the following tasks:
· Reconfigure paths of application files to include the correct partition information.
· If the device starts up from the CF card, put the startup software image files and the configuration files in the first partition of the CF card.
· To make sure the first partition has sufficient storage space for startup system software image and configuration files, set the log file path to a different partition. By default, the system automatically saves log files to the second partition. If the path does not exist, use the info-center logfile directory command to change the path to avoid log loss. For more information about this command, see Network Management and Monitoring Command Reference.
Configuration procedure
Perform this task in user view.
Task |
Command |
Remarks |
Partition a storage medium. |
fdisk medium-name [ partition-number ] |
By default, only one partition cfa0:/ is available on a CF card and only one partition usb0:/ is available on a USB disk. |
Setting the operation mode for files and folders
The device supports the following file and folder operation modes:
· alert—The system prompts for confirmation when your operation might cause problems such as file corruption and 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 and folders:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Set the operation mode for files and folders. |
file prompt { alert | quiet } |
The default mode is alert. |