- Table of Contents
-
- 01 Fundamentals Configuration Guide
- 00-Preface
- 01-CLI configuration
- 02-Login management configuration
- 03-RBAC configuration
- 04-FTP and TFTP configuration
- 05-File system management configuration
- 06-Configuration file management configuration
- 07-Software upgrade configuration
- 08-ISSU configuration
- 09-Device management configuration
- 10-Tcl configuration
- 11-Python configuration
- 12-License management
- 13-Automatic configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
05-File system management configuration | 120.44 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
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 one flash memory and one USB disk. The name of the flash memory is flash. The name of the USB disk is usba0.
If the USB disk is partitioned, a partition is named by the storage medium type usb, the sequence number a, and the partition number. The partitions start at 0 and increment by 1. For example, the first partition of the USB disk is named usba0, and the second partition is named usba1.
File name formats
|
IMPORTANT: · Storage medium names and the 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 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. When you specify a directory, follow the rules for the drive and path arguments.
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. |
[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. Typically, the storage medium name is flash or usba0. If the device has only one storage medium, the drive argument is optional. |
flash:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the flash memory. |
Managing files
|
CAUTION: To avoid file system corruption, do not install or remove storage media or perform master/subordinate switchover during file operations. |
The device provides the following file management functions:
· Display directory and file information.
· Display file contents.
· Rename, copy, move, remove, restore, delete, compress, decompress, archive, and extract 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 |
Archiving/extracting files
Perform the following tasks in user view:
Task |
Command |
Archive files. |
tar create [ gz ] archive-file fileurl-dest [ verbose ] source fileurl-source-list&<1-5> |
Extract files. |
tar extract archive-file fileurl-dest [ verbose ] [ screen | to directory-name ] |
Display the names of archived files. |
tar list archive-file fileurl-dest |
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. Each storage medium has a recycle bin of its own.
The device supports multiple storage media. If a storage medium 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
The digest of a file can be used to verify file integrity.
Perform this task in user view.
Task |
Command |
Calculate the digest of a file. |
·
Use the SHA-256 digest
algorithm: ·
Use the MD5 digest algorithm: |
Managing directories
CAUTION: To avoid file system corruption, do not install or remove storage media or perform master/subordinate switchover 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: Do not install or remove storage media or perform master/subordinate switchover 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, complete 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.
You cannot access a storage medium while another user is repairing, formatting, or partitioning the medium.
To access a storage medium after the medium is repaired, formatted, or partitioned, use one of the following methods:
· Specify the storage medium name for the command. For example, use dir flash:/ to display all files and folders on the flash memory.
· Use the cd command to change to the storage medium before using the command. For example, use cd flash:/ to change to the root directory of the flash memory, and then use dir to display all files and folders.
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 partitioned storage medium, 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 USB disk
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 USB disks:
· Simple—Specify the number of partitions. The system divides a USB disk into the specified number of partitions with the same size.
· Interactive—The system partitions a USB disk according to user input. Each partition must have a minimum of 32 MB of storage space.
Restrictions and guidelines
It is normal that the specified partition size and the actual partition size have an error less than 5% of the total memory.
Before partitioning a 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 USB disk, perform the following tasks:
· Reconfigure paths of application files to include the correct partition information.
· 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 usba0:/ 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. |