华为VRP-文件系统基础

华为网络设备的配置文件和VRP系统文件都保存在物理存储介质中,所以文件系统是VRP正常运行的基础。只有掌握了对文件系统的基本操作,网络工程师才能对设备的配置文件和VRP系统文件进行高效的管理。

VRP系统是 基于linux开发的,一些命令和linux命令一样。

一、基本查询命令

 image.png


<Huawei>dir   //查看当前目录下的文件信息

Directory of flash:/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  drw-              -  Oct 22 2018 06:22:51   dhcp

    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip

    2  -rw-          2,263  Oct 22 2018 06:22:42   statemach.efs

    3  -rw-        828,482  May 26 2014 09:20:58   ssl***.zip


1,090,732 KB total (784,464 KB free)

<Huawei>

<Huawei>pwd  //查看当前目录,此时属于flash: 根目录下

flash:

<Huawei>




二、目录操作


image.png


<Huawei>cd dhcp  //进入dhcp的文件夹下

<Huawei>pwd   //查看当前目录

flash:/dhcp


<Huawei>cd ..  //返回根目录

<Huawei>pwd

flash:


<Huawei>mkdir test   //创建新的目录,名称为test

Info: Create directory flash:/test......Done

<Huawei>dir   //查看是否创建成功。

Directory of flash:/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  drw-              -  Oct 22 2018 06:36:50   test   ----已创建成功

    1  drw-              -  Oct 22 2018 06:22:51   dhcp

    2  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip

    3  -rw-          2,263  Oct 22 2018 06:22:42   statemach.efs

    4  -rw-        828,482  May 26 2014 09:20:58   ssl***.zip


1,090,732 KB total (784,460 KB free)


<Huawei>rmdir test   //删除目录test

Remove directory flash:/test? (y/n)[n]:y

%Removing directory flash:/test...Done!



三、文件操作

image.png


<Huawei>cd dhcp

<Huawei>dir

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:22:51   dhcp-duid.txt


1,090,732 KB total (784,460 KB free)

<Huawei>more dhcp-duid.txt  //查看文本文件具体内容 

*Huawei DHCP DUID*

*time* 2018-10-22 14:22:51

*version* 1

#DUID_LL: 0003000100E0FCDD6E80

*end*


<Huawei>copy dhcp-duid.txt flash:/test   //复制dhcp-duid.txt 到test文件夹下

Copy flash:/dhcp/dhcp-duid.txt to flash:/test/dhcp-duid.txt? (y/n)[n]:y

100%  complete

Info: Copied file flash:/dhcp/dhcp-duid.txt to flash:/test/dhcp-duid.txt...Done

<Huawei>cd flash:/test

<Huawei>dir

Directory of flash:/test/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:43:31   dhcp-duid.txt   ----复制成功


1,090,732 KB total (784,452 KB free)


<Huawei>pwd   

flash:/test

<Huawei>rename dhcp-duid.txt qytang.txt   //把dhcp.-duid.txt 重命名为qytang.txt

Rename flash:/test/dhcp-duid.txt to flash:/test/qytang.txt? (y/n)[n]:y

Info: Rename file flash:/test/dhcp-duid.txt to flash:/test/qytang.txt ......Done

<Huawei>

<Huawei>dir

Directory of flash:/test/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:43:31   qytang.txt    ----重命名成功


1,090,732 KB total (784,456 KB free)

<Huawei>


<Huawei>move qytang.txt flash:/dhcp   //把qytang.txt 文本移动到dhcp的文件夹下,类似于剪切功能。   move命令只适用于在同一储存设备中移动文件。

Move flash:/test/qytang.txt to flash:/dhcp/qytang.txt? (y/n)[n]:y

%Moved file flash:/test/qytang.txt to flash:/dhcp/qytang.txt.

<Huawei>dir

Info: File can't be found in the directory

1,090,732 KB total (784,456 KB free)


<Huawei>cd flash:/dhcp

<Huawei>dir

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:22:51   dhcp-duid.txt

    1  -rw-             98  Oct 22 2018 06:43:31   qytang.txt    ----移动成功


1,090,732 KB total (784,456 KB free)


四、文件操作

image.png

<Huawei>delete dhcp-duid.txt   //删除文件 

Delete flash:/dhcp/dhcp-duid.txt? (y/n)[n]:y

Info: Deleting file flash:/dhcp/dhcp-duid.txt...succeed.

<Huawei>dir   //查看文件

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:43:31   qytang.txt


1,090,732 KB total (784,452 KB free)

<Huawei>dir /all    //查看所有文件,包括删除的文件,此时删除的文件被放到回收站里面

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:43:31   qytang.txt

    1  -rw-             98  Oct 22 2018 06:56:23   [dhcp-duid.txt]   ----[]中括号表示的被放到回收站的文件。


1,090,732 KB total (784,452 KB free)


<Huawei>undelete dhcp-duid.txt    //恢复删除的文件

Undelete flash:/dhcp/dhcp-duid.txt? (y/n)[n]:y

%Undeleted file flash:/dhcp/dhcp-duid.txt.

<Huawei>dir /all

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:22:51   dhcp-duid.txt   ---此文件已经恢复

    1  -rw-             98  Oct 22 2018 06:43:31   qytang.txt


1,090,732 KB total (784,452 KB free)


<Huawei>delete /unreserved dhcp-duid.txt   //永久删除文件,不放到回收站中

Warning: The contents of file flash:/dhcp/dhcp-duid.txt cannot be recycled. Continue? (y/n)[n]:y

Info: Deleting file flash:/dhcp/dhcp-duid.txt...

Deleting file permanently from flash will take a long time if needed...succeed.

<Huawei>

<Huawei>

<Huawei>dir /all    ----此时该文件夹下没有dhcp.duid.txt

Directory of flash:/dhcp/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 06:43:31   qytang.txt


1,090,732 KB total (784,456 KB free)


<Huawei>delete qytang.txt  

Delete flash:/dhcp/qytang.txt? (y/n)[n]:y

Info: Deleting file flash:/dhcp/qytang.txt...succeed.

<Huawei>

<Huawei>

<Huawei>dir /all

Directory of *


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  -rw-             98  Oct 22 2018 07:03:01   [qytang.txt]    ---删除文件,放进回收站


1,090,732 KB total (784,456 KB free)


<Huawei>reset recycle-bin   //彻底删除回收站中内容

Squeeze flash:/dhcp/qytang.txt? (y/n)[n]:y

Clear file from flash will take a long time if needed...Done.

%Cleared file flash:/dhcp/qytang.txt.

<Huawei>dir /all

Info: File can't be found in the directory

1,090,732 KB total (784,460 KB free)


五、配置文件管理

image.png

设备中的配置文件分为两种类型:当前配置文件和保存的配置文件。当前配置文件储存在设备的RAM中。用户可以通过命令行对设备进行配置,配置完成后使用save命令保存当前配置到存储设备中,形成保存的配置文件。

保存的配置文件都是以“.cfg”或“.zip”作为扩展名,存放在存储设备的根目录下。

在设备启动时,会从默认的存储路径下加载保存的配置文件到RAM中。如果默认存储路径中没有保存的配置文件,则设备会使用缺省参数进行初始化配置。

image.png

<Huawei>display current-configuration  //查看当前配置

[V200R003C00]

#

 snmp-agent local-engineid 800007DB03000000000000

 snmp-agent 

#

 clock timezone China-Standard-Time minus 08:00:00

#

portal local-server load portalpage.zip


……


<Huawei>dis saved-configuration     //初始化启动的设备还没有保存,此时无保存配置

  There is no correct configuration file in FLASH


<Huawei>system-view 

Enter system view, return user view with Ctrl+Z.

[Huawei]

[Huawei]sysname QYTANG   //修改设备名称为QYTANG


<QYTANG>save   //保存当前配置信息

  The current configuration will be written to the device. 

  Are you sure to continue? (y/n)[n]:y

  It will take several minutes to save configuration file, please wait........

  Configuration file had been saved successfully

  Note: The configuration file will take effect after being activated

<QYTANG>

<QYTANG>display saved-configuration  //查看保存的配置文件

[V200R003C00]

#

 sysname QYTANG

#

……


<QYTANG>dir 

Directory of flash:/


  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 

    0  drw-              -  Oct 22 2018 06:51:39   test

    1  drw-              -  Oct 22 2018 07:03:01   dhcp

    2  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip

    3  -rw-          2,263  Oct 22 2018 06:22:42   statemach.efs

    4  -rw-        828,482  May 26 2014 09:20:58   ssl***.zip

    5  -rw-            352  Oct 22 2018 07:12:00   private-data.txt

    6  -rw-            557  Oct 22 2018 07:11:59   vrpcfg.zip  ---保存的配置文件名称为vrpcfg.zip


1,090,732 KB total (784,452 KB free)


<QYTANG>reset saved-configuration   //清除下次启动时加载的配置文件

This will delete the configuration in the flash memory.

The device configurations will be erased to reconfigure.

Are you sure? (y/n)[n]:y   ---输入y

 Clear the configuration in the device successfully.


<QYTANG>reboot   //重启设备

Info: The system is comparing the configuration, please wait.

Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n   //注意此时要输入n,不然配置还会保存,启动时会加载保存的配置文件

System will reboot! Continue ? [y/n]:y   //输入 y 重启设备

Info: system is rebooting ,please wait...




猜你喜欢

转载自blog.51cto.com/3965485/2307365
今日推荐