- 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-MDC configuration
- 13-TCL configuration
- 14-License management
- Related Documents
-
Title | Size | Download |
---|---|---|
05-File system management configuration | 115.84 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. · Some files and directories are hidden. For normal operation of the system, do not modify or delete hidden files or directories. |
Storage medium naming rules
The device supports the following types of storage media: 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 multiple storage media of the same type exist on the device, the physical device name of a storage medium is composed of the storage medium type and the sequence number of the storage medium. A sequence number is an English letter such as a, b, or c. For example, for a device with multiple CF cards, the physical device name of the first CF card is cfa0, and that of the second is cfb0, and so on.
· If a storage medium is partitioned, the name of a partition is composed of the physical device name and the partition number. The sequence numbers of partitions are numbers such as 0, 1, and 2. For a device with only one CF card, for example, the name of the second partition of the CF card is cf1; for a device with multiple CF cards, the name of the third partition of the second CF card is cfb2. If there is only one partition on a CF card, the partition name is the physical device name followed by 0, such as cf0.
File name formats
When you specify a file name, enter the file name in one of the formats shown in Table 1 and Table 2. When you specify a directory name, follow the rules for the drive and path arguments. A file or directory name that starts with a dot (.) is considered a hidden file or directory.
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 specific 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 specific storage medium. The drive argument represents the storage medium name. The storage medium on the active MPU is typically flash or cf0. The storage medium on the standby MPU is typically slotn#flash or slotn#cf0, where n represents the number of the slot that hosts the standby MPU, for example, slot1#flash. To view the correspondence between an MPU and its slot number, 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 specific 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 specific 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 cf0. The storage medium on a subordinate device is typically chassism#slotn#flash or chassism#slotn#cf0, where m represents the member ID of the subordinate device and n represents the slot number of the MPU. To view the correspondence between a member device and its member ID, 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. · To avoid file system corruption 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 during file operations. |
You can display directory and file information, display file contents, and rename, copy, move, remove, restore, and delete files.
You can 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.
Before you rename, compress, decompress, delete, restore, or move a file on a USB disk, or copy a file to a USB disk, make sure the disk is not write protected.
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. |
copy fileurl-source fileurl-dest [ vpn-instance vpn-instance-name ] [ source interface interface-type interface-number ] |
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 in user view.
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 under 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 ] |
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. · To avoid file system corruption 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 during directory operations. |
You can create or remove a directory, display or change the current working directory, and display a specific 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
To reinstall a storage medium that was removed while you or someone else was accessing a folder or file on the storage medium, you must release or have the user release the resource by changing the current directory or closing the file, or by unmounting the partition holding the folder or file.
Only administrators who have the right to manage MDCs can manage the storage media.
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 the medium for any damage 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 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 mounting or unmounting a storage medium.
To avoid file system corruption in IRF mode, do not install or remove media or perform a switchover between the active MPU of the IRF fabric and the standby MPU of the IRF fabric while the system is mounting or unmounting a storage medium.
To avoid file system corruption, do not create, delete, start, or stop an MDC while the system is mounting or unmounting a storage medium.
To mount/unmount a 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 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 be at least 32 MB.
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 CF card or USB disk:
· 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 normal 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:
· 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 guarantee the startup system software image and configuration files sufficient storage space, set the path for log files to a partition other than the first partition. By default, the system automatically saves log files to the second partition. If the path does not exist, use the info-center logfile switch-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 cf0:/ 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 warns you about operations that may cause problems such as file corruption and data loss. To avoid operation mistakes, use the alert mode.
· 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. |