2012年12月20日 星期四

Cisco .tar file Upgrade Downgrade

升級IOS文件:由TFTP上傳IOS到設備上

archive download-sw /leave-old-sw(保留原IOS)/reload(重啟) tftp://IP/x.tar

archive download-sw /overwrite(覆蓋原IOS)/reload(重啟) tftp://IP/x.tar

download時會有演算法來驗證新IOS是否適合當前模塊和內存,否則會報錯。
  
如選用/overwrite,不管downIOS是否與現在相同,都會被刪除。
  
download完成後,會自動將boot參數指向新IOS
  
(文檔雖然沒講,但是我想,有足夠flash空間的情況下,還是不要覆蓋原IOS,傳完再刪)



下載IOS文件:由設備上,下載TFTP


archive upload-sw tftp://ip/x.tar

上傳演算法會自動把多個系統檔生成為.tar ,並下載到TFTP。
  
(具體系統組成文件見文檔937):info, the Cisco IOS image, and the web management files.
  
IOS恢復參見文檔裡的Troubleshooting部分


刪除目錄:
  
delete/force(不再詢問確認)/recursive(刪除目錄下的子目錄和文件)


解壓縮一個tar文件:
  
archive tar /xtract xxx.tar flash: (解壓縮整個tar,只能解到當前flash)
  
archive tar /xtract xxx.tar flash:/xxxxx (指定解壓縮整個tar,或其中某個檔,目錄)



Cisco IOS Document

Downloading an Image File By Using TFTP


Command

Purpose

Step 1 

Copy the image to the appropriate TFTP directory on the workstation. Make sure that the TFTP server is properly configured; see the "Preparing to Download or Upload an Image File By Using TFTP" section.

Step 2 

Log into the switch through the console port or a Telnet session.

Step 3 

archive download-sw /overwrite /reload tftp:[[//location]/directory]/image-name.tar

Download the image file from the TFTP server to the switch, and overwrite the current image.

The /overwrite option overwrites the software image in flash memory with the downloaded image.

The /reload option reloads the system after downloading the image unless the configuration has been changed and not been saved.

For //location, specify the IP address of the TFTP server.

For /directory/image-name.tar, specify the directory (optional) and the image to download. Directory and image names are case sensitive.

Step 4 

archive download-sw /leave-old-sw /reload tftp:[[//location]/directory]/image-name.tar

Download the image file from the TFTP server to the switch, and keep the current image.

The /leave-old-sw option keeps the old software version after a download.

The /reload option reloads the system after downloading the image unless the configuration has been changed and not been saved.

For //location, specify the IP address of the TFTP server.

For /directory/image-name.tar, specify the directory (optional) and the image to download. Directory and image names are case sensitive.

The download algorithm verifies that the image is appropriate for the switch model and that enough DRAM is present, or it aborts the process and reports an error. If you specify the /overwrite option, the download algorithm removes the existing image on the flash device whether or not it is the same as the new one, downloads the new image, and then reloads the software.


Note If the flash device has sufficient space to hold two images and you want to overwrite one of these images with the same version, you must specify the /overwrite option.


If you specify the /leave-old-sw, the existing files are not removed. If there is not enough space to install the new image and keep the running image, the download process stops, and an error message is displayed.

The algorithm installs the downloaded image on the system board flash device (flash:). The image is placed into a new directory named with the software version string, and the BOOT environment variable is updated to point to the newly installed image.

If you kept the old image during the download process (you specified the /leave-old-sw keyword), you can remove it by entering the delete /force /recursive filesystem:/file-url privileged EXEC command. For filesystem, use flash: for the system board flash device. For file-url, enter the directory name of the old image. All the files in the directory and the directory are removed.

Uploading an Image File By Using TFTP


You can upload an image from the switch to a TFTP server. You can later download this image to the switch or to another switch of the same type.

Use the upload feature only if the web management pages associated with the embedded device manager have been installed with the existing image.

Beginning in privileged EXEC mode, follow these steps to upload an image to a TFTP server:


Command

Purpose

Step 1 

Make sure the TFTP server is properly configured; see the "Preparing to Download or Upload an Image File By Using TFTP" section.

Step 2 

Log into the switch through the console port or a Telnet session.

Step 3 

archive upload-swtftp:[[//location]/directory]/image-name.tar

Upload the currently running switch image to the TFTP server.

For //location, specify the IP address of the TFTP server.

For /directory/image-name.tar, specify the directory (optional) and the name of the software image to be uploaded. Directory and image names are case sensitive. Theimage-name.tar is the name of the software image to be stored on the server.

The archive upload-sw privileged EXEC command builds an image file on the server by uploading these files in order: info, the Cisco IOS image, and the web management files. After these files are uploaded, the upload algorithm creates the tar file format.