華爲網絡設備的配置文件和VRP系統文件都保存在物理存儲介質中,所以文件系統是VRP正常運行的基礎。只有掌握了對文件系統的基本操作,網絡工程師才能對設備的配置文件和VRP系統文件進行高效的管理。
VRP系統是 基於linux開發的,一些命令和linux命令一樣。
一、基本查詢命令
<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>
二、目錄操作
<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!
三、文件操作
<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)
四、文件操作
<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)
五、配置文件管理
設備中的配置文件分爲兩種類型:當前配置文件和保存的配置文件。當前配置文件儲存在設備的RAM中。用戶可以通過命令行對設備進行配置,配置完成後使用save命令保存當前配置到存儲設備中,形成保存的配置文件。
保存的配置文件都是以“.cfg”或“.zip”作爲擴展名,存放在存儲設備的根目錄下。
在設備啓動時,會從默認的存儲路徑下加載保存的配置文件到RAM中。如果默認存儲路徑中沒有保存的配置文件,則設備會使用缺省參數進行初始化配置。
<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...