Cisco – Create an IOS Bootable USB Drive

Creating a bootable USB that contains bin files of the firmware that your routers/switches use is a good thing to have in your pocket as a network admin in the event you are shipped a new or refurbished device without any firmware or if something happens during an IOS upgrade and the image on your router or switch is corrupt. If your router or switch has a USB port you will be able to insert that flash drive and with a few commands will be able to boot your device to that USB, copy the firmware to internal flash, and reboot again from the internal flash versus having to upload the image through the serial port or some other method.

There are multiple ways to do this, at its core all you need is a working flash drive formatted in FAT 16 with known good IOS images on it. You may do this directly on a working Cisco device or on your workstation using disk formatting tools, I have found that formatting a USB drive on a Cisco device if your USB drive is over 2GB (Max partition size for Fat16) it seems it will format the drive using FAT 32 which the switch will not be able to boot from. I would suggest if your USB drive is over 2GB to use your workstation and diskpart (windows) or gparted (linux) to create a FAT 16 partition, if your USB drive is under 2GB from my testing you should be alright with formatting the drive directly on a working Cisco device. Below are the commands to format a USB drive on a Cisco 3750x switch.

First enter your USB drive into a working Cisco device and if you are on the console or logged in via SSH you will see output similar to the following line

Now you know your USB drive can be reached on ‘usbflash0’

Next you will need to format the flash drive.

 

Once you have your flash drive formatted you will just need to copy an image to that drive which you can copy it directly off of a working Cisco device or you can insert the drive into your computer and copy an image from there. Below is an example of copying the .bin file from a switch to the flash drive.

At this point we can set the boot variable to our USB drive and we will reboot and boot using the image on the USB drive.

When the switch is booting, watch on the console to validate that the image is loading from usbflash0.

 

You can see our last line of output shows its booting from usbflash0 now just wait until the image is fully booted up. If your device fully boots we know we have a working USB drive and your image that is currently on there is good, now in the event we need to recover a device and we are unable to boot to the image that is on the device we can use our USB drive. I highly suggest not to just copy .bin files to the flash drive and assume they will work, I have run into instances that they don’t copy properly to the flash drive so I would suggest testing each .bin file you copy over to make sure it boots or at least run an MD5 checksum to the file prior to the transfer and to the file after the transfer. If you don’t validate the image we all know that’s the first image you will need to use.

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*