01-Fundamentals Configuration Guide

HomeSupportRoutersH3C SR8800 Router SeriesConfigure & DeployConfiguration GuidesH3C SR8800 Configuration Guide-Release3347-6W10301-Fundamentals Configuration Guide
04-File Management Configuration
Title Size Download
04-File Management Configuration 129.82 KB

 

 

NOTE:

Throughout this document, a filename can be entered as either of the following:

·       A fully qualified filename with the path included to indicate a file under a specific path. The filename can be 1 to 135 characters in length.

·       A short filename with the path excluded to indicate a file in the current path. The filename can be 1 to 91 characters in length.

 

File system overview

Files such as host software and configuration files that are necessary for the operation of the router are saved in the storage media of the router. You can perform operations such as directory create and delete, and file copy and display. If an operation, delete or overwrite, for example, may cause problems such as data loss or corruption, the system will ask you to confirm the operation by default.

You can manage files on your router through these operations: Managing directories, Managing files, Performing batch operations, and Managing storage media.

Naming rules for a storage medium

The name of a storage medium follows 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 active MPU and the standby MPU each have a storage media of the same type, the storage medium on the active MPU is named by its type (such as flash and cf0), and the storage medium on the standby MPU is named by its slot number and type (such as slot#flash and slot#cf0).

·           If a CF card is partitioned, the name of a partition is composed of the physical device name and the partition number, such as cf0. The sequence numbers of partitions are numbers such as 0, 1, and 2.

Filename formats

When you specify a file, you must enter the filename in one of the following formats.

 

Format

Description

Length

Example

file-name

Specifies a file in the current working directory.

1 to 91 characters

a.cfg indicates a file named a.cfg in the current working directory. If the current working directory is on the active MPU, a.cfg represents file a.cfg on the active MPU; if the current working directory is on the standby MPU, a.cfg represents file a.cfg on the standby MPU.

path/file-name

Specifies a file in the specified folder in the current working directory. path represents the folder name. You can specify multiple folders, indicating a file under a multi-level folder.

1 to 135 characters

test/a.cfg indicates a file named a.cfg in the test folder in the current working directory.

drive:/[path]/file-name

Specifies a file in the specified storage medium on the router. drive represents the storage medium name. The storage medium on the active MPU is usually flash or cf; the storage medium on the standby MPU is usually slot1#flash or slot1#cf, where 1 represents the number of the slot where the standby MPU resides. For example, slot2#flash. You can use the display device command to view the correspondence between a board and its slot number.

1 to 135 characters

flash:/test/a.cfg indicates a file named a.cfg in the test folder in the root directory of the flash memory on the active MPU.

To read and write the a.cfg file in the root directory of the flash on the standby MPU (with the slot number 1), enter slot1#flash:/a.cfg for the filename.

 

Managing directories

You can perform an extensive set of directory operations, such creating or removing a directory, displaying the current working directory, displaying a specific directory, or displaying file information.

Displaying directory information

 

Task

Command

Remarks

Display directory or file information.

dir [ /all ] [ file-url | /all-filesystems ]

Available in user view

 

Displaying the current working directory

 

Task

Command

Remarks

Display the current working directory.

pwd

Available in user view

 

Changing the current working directory

 

Task

Command

Remarks

Change the current working directory.

cd { directory | .. | / }

Available in user view

 

Creating a directory

 

Task

Command

Remarks

Create a directory.

mkdir directory

Available in user view

 

Removing a directory

 

Task

Command

Remarks

Remove a directory.

rmdir directory

Available in user view

 

 

NOTE:

·       The directory to be removed must be empty. Before you remove a directory, you must delete all the files and the subdirectory in the directory. For more information about file deletion, see the delete command; for more information about subdirectory deletion, see the rmdir command.

·       The rmdir command automatically deletes the files in the recycle bin in the current directory.

 

Managing files

You can display the specified directory or file information; display file contents; rename, copy, move, remove, restore, and delete files.

 

 

NOTE:

You can create a file by copying, downloading or using the save command.

 

CAUTION

CAUTION:

When the system is reading, writing, or deleting contents on the storage medium, power-off of the router may result in space loss and file corruption of the storage medium. In this case, you can try to restore the storage medium in the following steps:

·       Copy the remaining files on the storage medium to another storage medium for backup.

·       Format the storage medium using the format command.

For a partition device, you can just format the partition corresponding to the corrupted file.

 

Displaying file information

 

Task

Command

Remarks

Display files or directories.

dir [ /all ] [ file-url | /all-filesystems ]

Available in user view

 

Displaying the contents of a file

 

Task

Command

Remarks

Display the contents of a file.

more file-url

Currently only a .txt file can be displayed.

Available in user view

 

Renaming a file

 

Task

Command

Remarks

Rename a file.

rename fileurl-source fileurl-dest

Available in user view

 

Copying a file

 

Task

Command

Remarks

Copy a file.

copy fileurl-source fileurl-dest

Available in user view

 

Moving a file

 

Task

Command

Remarks

Move a file.

move fileurl-source fileurl-dest

Available in user view

 

Deleting a file

 

Task

Command

Remarks

Move a file to the recycle bin or delete it permanently.

delete [ /unreserved ] file-url

Available in user view

 

CAUTION

CAUTION:

·       The files in the recycle bin still occupy storage space. To delete a file in the recycle bin, execute the reset recycle-bin command in the directory to which the file originally belongs. H3C recommends you to empty the recycle bin timely with the reset recycle-bin command to save storage space.

·       The delete /unreserved file-url command deletes a file permanently and the action cannot be undone. Execution of this command equals execution of the delete file-url command and then the reset recycle-bin command in the same directory.

 

Restoring a file from the recycle bin

 

Task

Command

Remarks

Restore a file from the recycle bin.

undelete file-url

Available in user view

 

Emptying the recycle bin

 

Step

Command

Remarks

1.     Enter the original working directory of the file to be deleted.

cd { directory | .. | / }

Optional.

If the original directory of the file to be deleted is not the current working directory, this command is required.

Available in user view.

2.     Delete the file in the current directory and in the recycle bin.

reset recycle-bin [ /force ]

Available in user view.

 

Computing the digest of a specified file

Computing the digest of a specified file is used to verify the correctness and integrity of the file to prevent the file from being tampered with. For example, you can compute the digest of the software image file of a device, and compare the digest with that on the H3C web site to verify whether the file is valid.

To compute the digest of a specified file:

 

Task

Command

Compute the digest of a specified file.

crypto-digest sha256 file-url

 

Performing batch operations

A batch file is a set of executable commands. Executing a batch file is the same as executing the commands in the batch file one by one.

Before executing a batch file, edit the batch file on your PC, and then download it to the device. If the suffix of the file is not .bat, use the rename command to change the suffix to .bat.

To execute a batch file:

 

Step

Command

3.     Enter system view.

system-view

4.     Execute a batch file.

execute filename

 

CAUTION

CAUTION:

Execution of a batch file does not guarantee successful execution of every command in the batch file. If a command has error settings or the conditions for executing the command are not satisfied, this command fails to be executed, and the system skips to the next one.

 

Managing storage media

The router supports the following storage media:

·           Built-in flash memory

·           USB disk

·           CF card

When a storage medium is recognized, the router manages and manipulates the files in the storage medium, for example, reading and writing the files.

 

 

NOTE:

·       The MPU of the router has two USB interfaces, and only the upper one supports USB disk.

·       The router supports FAT16 and FAT32 file systems for storage media.

·       The router does not support such USB devices as movable disks, USB HUB, MP3 or MP4. Kingston 1G USB disk is recommended.

 

Naming rules

Naming rules of the storage media are as follows:

·           The name of the partition device includes the physical device name and partition number. The sequence numbers of partitions are displayed in numbers such as 0, 1 and 2. For example, the second partition of the CF card is cf1. If there is only one partition on the CF card, the partition name is the physical device name followed by 0.

·           The name of the router not supporting partitioning (like USB disk) is composed of the physical device name and sequence number. The sequence numbers of partitions are displayed in letters such as a, b, and c, for example, usba.

Memory space management

To restore the space of a storage medium, use the fixdisk command. To format a specified storage medium, use the format command.

To manage the space of a storage medium:

 

Task

Command

Remarks

Restore the space of a storage medium.

fixdisk device

Available in user view

Format a storage medium.

format device [ FAT16 | FAT32 ]

FAT16 and FAT32 are not applicable to a Flash card.

Available in user view.

 

CAUTION

CAUTION:

·       When you format a storage medium, all the files stored on it are erased and cannot be restored. In particular, if there is a startup configuration file on the storage medium, formatting the storage medium results in loss of the startup configuration file.

·       For a partition device, you can only format a partition rather than the whole storage medium.

·       You can execute the fixdisk command for a storage medium on the active MPU, but you cannot execute the command for a storage medium on the standby MPU.

 

Mounting and unmounting a storage medium

For a hot swappable storage medium (excluding flash), such as a CF card, you can use the mount and umount command to mount or unmount it. When a storage medium is connected to a lower version system, the system cannot recognize the storage medium. To perform read and write operations to the storage medium, you must mount it.

When a router is unmounted, it is in a logically disconnected state, and you can then safely remove the storage medium from the system. To mount a router, you are reconnecting the logically disconnected router to the system.

To mount or unmount a storage medium:

 

Task

Command

Remarks

Mount a storage medium.

mount device

By default, a storage medium is automatically mounted and in mounted state when connected to the system.

Unmount  a storage medium.

umount device

By default, a storage medium is automatically mounted. Before unplugging a storage medium, unmount it.

 

CAUTION

CAUTION:

·       Do not remove the storage medium or swap a card when mounting or unmounting the router, or when you are processing files on the storage medium. Otherwise, the file system could be damaged.

·       When a storage medium is connected to a low version system, the system may not be able to recognize the router automatically; you need to use the mount command for the storage medium to function normally.

·       Before removing a mounted storage medium from the system, you should first unmount it by using the umount command. If the unmount operation fails, its means the files in the storage medium are still being accessed. You need to wait until the file reading/writing operation ends and execute the umount command again to unmount the storage medium.

·       If one or more partitions of a CF card are not unmounted through the umount command, the CF card will still be powered on. Therefore, make sure you have unmounted all the partitions before removing the CF card from the system to avoid storage medium damage caused by charged operations.

·       For a USB disk inserted into the USB interface, you must not unplug it before the system recognizes it. Otherwise, the USB interface or the USB disk may work abnormally. To unplug a USB disk, make sure that the system has recognized it and the USB disk LED does not blink, use the umount command to unmount it, and unplug it.

·       Before removing a partitioned CF card or a USB disk, unmount all the partitions of the CF card or a USB disk. Otherwise, the file system on the CF card or a USB disk may be damaged.

·       Before partitioning a USB disk, make sure that the disk is not write protected; otherwise, the partition operation fails, and you need to remount or re-plug the disk to restore normal access to the USB disk.

 

Partitioning a storage medium

The storage medium partitioning function enables you to divide a storage medium into several different logical devices called partitions and you can perform file operations on each partition respectively. This prevents interaction of files on each partition.

The following two partitioning modes are supported on a storage medium:

·           SimpleIn this mode, you should specify the number of partitions. The system divides the storage medium into the specified number of partitions with the same size.

·           InteractiveIn this mode, you need not specify the number of partitions. The system partitions the storage medium according to user input. Each partition, however, must be 32 MB at least.

To partition a storage medium:

 

Task

Command

Remarks

Partition a storage medium.

fdisk device [ partition-number ]

Only one partition cf0:/ is available on a CF card by default.

 

CAUTION

CAUTION:

·       The fdisk device [ partition-number ] command clears all data in a storage medium. Save the files in the CF card before partitioning it.

·       The fdisk device [ partition-number ] command adds or reduces partition devices. You should reset the path of the application program as needed.

·       If the router starts from the CF card, the startup file and the configuration file must be in the first partition of the CF card.

·       To prevent log file from affecting the startup file and configuration file, you are recommended to set the path of the log file to partitions other than the first partition if you partition the CF card. By default, the system automatically sets the path of the log file to the second partition. If the path does not exist on the CF card, you can use the info-center logfile switch-directory command to change the path to avoid loss of the log files. For more information about this command, see Network Management and Monitoring Command Reference.

·       After partitioning is completed, the sizes of the partitions are not necessarily consistent with those specified in an interactive way. The dispersion, however, is smaller than 5% of the total memory of the CF card.

·       Before removing a partitioned storage medium, unmount all the partitions of the storage medium. Otherwise, the file system on the storage medium may be damaged.

·       Before partitioning a USB disk, make sure that the disk is not write protected; otherwise, the partition operation fails, and you need to remount or re-plug the disk to restore normal access to the USB disk.

 

Setting the file system operation mode

The file systems support the following operation modes:

·           alert—The system warns you about operations that may cause problems such as file corruption and data loss. To prevent incorrect operations, use the alert mode.

·           quiet—The system does not prompt for any operation confirmation.

To set the file system operation mode:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Set the file system operation mode.

file prompt { alert | quiet }

Optional.

The default is alert.

 

File system management examples

# Display the files and the subdirectory in the current directory.

<Sysname> dir

Directory of flash:/

 

   0   drw-         -  Feb 16 2006 11:45:36   logfile

   1   -rw-      1218  Feb 16 2006 11:46:19   config.cfg

   2   drw-         -  Feb 16 2006 15:20:27   test

   3   -rw-    184108  Feb 16 2006 15:30:20   aaa.bin

 

19540 KB total (2521 KB free)

# Create a new folder called mytest in the test directory.

<Sysname> cd test

<Sysname> mkdir mytest

%Created dir flash:/test/mytest.

# Display the current working directory.

<Sysname> pwd

flash:/test

# Display the files and the subdirectory in the test directory.

<Sysname> dir

Directory of flash:/test/

 

   0   drw-         -  Feb 16 2006 15:28:14   mytest

 

2540 KB total (2519 KB free)

# Return to the upper directory.

<Sysname> cd ..

# Display the current working directory.

<Sysname> pwd

flash:/

# Display the files and directories in the USB disk.

<Sysname> dir usba:/

Directory of usba:/

 

   0     -rw-  15286272  Jan 16 2008 16:02:16   debug_usb.app

   1     -rw-  35487744  Jan 16 2008 16:07:32   test.rar

   2     -rw-  29212672  Jan 16 2008 16:07:32   debug_usb_d11.app

   3     -rw-     59652  Jan 23 2008 17:21:04   test.app

   4     -rw-  39067474  Jan 23 2008 17:23:02   debug.app

 

1951520 KB total (1835072 KB free)

 

File system type of usba: FAT16

# Enter the root directory of the USB disk.

<Sysname> cd usba:/

<Sysname> dir

Directory of usba:/

 

   0     -rw-  15286272  Jan 16 2008 16:02:16   debug_usb.app

   1     -rw-  35487744  Jan 16 2008 16:07:32   test.rar

   2     -rw-  29212672  Jan 16 2008 16:07:32   usb_d11.app

   3     -rw-     59652  Jan 23 2008 17:21:04   test.app

   4     -rw-  39067474  Jan 23 2008 17:23:02   debug.app

 

1951520 KB total (1835072 KB free)

 

File system type of usba: FAT16

# Display the current working directory.

<Sysname> pwd

usba:

# Copy the file test.app in the USB disk to the flash, and overwrite the file with the same name in the flash.

<Sysname> copy usba:/test.app flash:/

Copy usba:/test.app to flash:/test.app?[Y/N]:y

The file flash:/test.app exists. Overwrite it?[Y/N]:y

......

%Copy file usba:/test.app to flash:/test.app...Done.

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网