Networking

Using a USB flash drive with your Cisco router


Some time ago, ZDNet's George Ou wrote an innovative article for TechRepublic about using USB flash drives or compact flash (CF) cards to upgrade a router. This week, I want to take that article a step further. Here's how I used my USB flash drive with my Cisco 871W router.

A little background

Before we get started, let's review some of the specifics you need to know about using USB flash and CF cards with Cisco routers. You can find much of this in George's article, but here's a recap:

  • Many of the newer 800, 1800, 2800, and 3800 series routers support USB Flash. 800 series routers don't support CF, but they do support USB flash.
  • The Cisco IOS can only read FAT-formatted flash drives.
  • The IOS may not recognize the proper size of your USB flash drive. However, it doesn't really matter -- you have much more space with today's USB flash drives than you could ever use.
  • While using USB flash and CF cards are a great way to transfer data to and from a router, you obviously must have physical access to the router.
  • The USB ports on a router are usually USB 2.0, but check the specifications.
  • Some routers with certain IOS versions support Aladdin eTokens.

Ideally, USB flash can hold multiple copies of the Cisco IOS and multiple router configurations, and you can use it to easily move and copy those IOS files and configurations from router to router. And many times, when you're physically at the router, the copying process can take place several times faster than it would over a LAN or WAN.

My experience

I have a new 4-GB USB flash drive that I recently bought for about $40. I had used this drive on my Window Vista PC to back up and transport data.

I wondered if I could easily copy or back up the Cisco IOS from my 871W onto another 871W without configuring network settings on the router, plugging it into the network, running a TFTP server on my PC, and copying the IOS over. I wanted to just plug in the USB drive and copy off the IOS, just as I would on my PC with any other file.

I'll be honest: Like most techies out there, I abhor reading directions. I save that until something absolutely, positively doesn't work. Admittedly, I had only skimmed George's article, and it had been some time since I had done even that. (Yes, I confess: I didn't read it thoroughly until after this experiment.)

So, like most new gadgets I try out for the first time, I just plugged it in to see what would happen. While on the console of my Cisco 871W, I took the USB flash drive from my pocket and connected it to the router. Immediately, the router told me this:

*Aug 26 21:03:10.251: %USBFLASH-5-CHANGE: usbflash1 has been inserted!
*Aug 26 21:03:10.275: %USBFLASH-4-FORMAT: usbflash1 contains unexpected values in partition table or boot sector.  Device needs formatting before use!

Actually, this was a pleasant surprise: At least, the router knew there was a USB flash drive connected, it knew it didn't work, and it knew why it didn't work.

Later, I found out that the drive wouldn't work because of its NTFS format. As mentioned above, it needed a FAT format -- the Cisco IOS only recognizes the FAT file system. As I already knew that I didn't need anything on this flash drive, I formatted the flash drive with the router. (I could have also formatted the flash drive with a PC as long as I specified the FAT file system.)

Here's what it looked like:

TechRepublic-Router# format ?

  flash:      Filesystem to be formatted

  usbflash1:  Filesystem to be formatted

TechRepublic-Router# format usbflash1:

Format operation may take a while. Continue? [confirm]

Format operation will destroy all data in "usbflash1:".  Continue? [confirm]

Format: Drive communication & 1st Sector Write OK...

Format: All system sectors written. OK...

Format: Total data sectors in formatted partition: 8191435

Format: Total data bytes in formatted partition: -100952576

Format: Operation completed successfully.

Format of usbflash1 complete

TechRepublic-Router#

At this point, as you can see below, I had a working USB flash drive.

TechRepublic-Router# dir usbflash1:

Directory of usbflash1:/

No files in directory

No space information available

TechRepublic-Router#

Next, I copied my 871W IOS from the internal flash and to the USB flash. Here's what it looked like:

TechRepublic-Router# dir

Directory of flash:/

    2  -rwx    17227284   Aug 8 2006 17:16:53 +00:00  c870-advipservicesk9-mz.124-11.T2.bin

    3  -rwx        3053  Aug 26 2006 20:24:58 +00:00  SDM_Backup

23482368 bytes total (6246400 bytes free)

TechRepublic-Router# copy c870-advipservicesk9-mz.124-11.T2.bin usb

TechRepublic-Router# copy c870-advipservicesk9-mz.124-11.T2.bin usbflash1:

Destination filename [c870-advipservicesk9-mz.124-11.T2.bin]?

Copy in progress...CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

(truncated)

17227284 bytes copied in 14.440 secs (1193025 bytes/sec)

TechRepublic-Router# dir usbflash1:

Directory of usbflash1:/

    1  -rw-    17227284  Aug 26 2006 21:07:00 +00:00  c870-advipservicesk9-mz.124-11.T2.bin

No space information available

TechRepublic-Router#

At this point, I had my 17-MB Cisco IOS on my flash drive. I could then take it and plug it into any other router and quickly copy that IOS without going through any network configuration or connecting that router to the network.

Some helpful commands

Here are some commands that can come in handy, along with links to their Cisco documentation:

Summary

A USB flash drive offers cheap, easy storage space for your Cisco routers to hold the Cisco IOS, configuration files, and security certificates. However, what interests me even more is that it frees us from the limitations of only having 16 MB, 128 MB, or 256 MB of storage on our routers. These limitations have defined our work for so long that the lack of them suddenly opens up so many more possibilities.

What do you think? Have you used a USB flash drive with your Cisco routers? Share your own experiences in the discussion area.

David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.

Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!

13 comments
zoolandercu
zoolandercu

Hey, thanks for the info. I know you are an expert with Cisco devices. And I've trying to modify a process in IOS. Could you recommend me a book?...

darkstartito
darkstartito

Hi, Thanks for the info. Would you copy it back to a new one if it's for example from 871 to 881?

Tonsai
Tonsai

can you install the Cisco SDM to the usb device?

jbestor
jbestor

Is there an autorun that the routers look at? I would like to use the USB in a Disaster Recovery plan to automatically config a replacement router.

speculatrix
speculatrix

copying the IOS from one router to another without buying the upgrade from Cisco is violating the license agreement.

aaron.revell
aaron.revell

Don't know if the last two posted... If you're going to put your certs, router configs, and IOS on these things, I hope you don't accidentally lose on in a parking lot somewhere.

dchow
dchow

The I/O reads and writes on a flash drive will go out way before a normal DRAM module will. This means it will instantly die without warning. That's my only concern, but if you're a good admin you will know when something's up before your users do.

TheNetworkGuy
TheNetworkGuy

Here is the link to Q & A page on Cisco's website. The USB is supported beginning in 12.3(14)T. In order to boot from the USB it appears you must be running ROMMON 12.4(13r).

timmy.macaddict
timmy.macaddict

instead of booting from the internal flash or external compact flash, can u boot ios from usb?

ROBDHEISER
ROBDHEISER

You are correct that Flash only has a read/write cycle of 100,000 (typical). The primary purpose, however, is ease of use and transport. Pretty nifty tool to have. But like anything else, just be aware it can fail. Redundancy, Redundancy, Redundancy!

kimsun
kimsun

7.2x and higher?