Need to format and mount a USB flash drive on a J-series router.
Problem or Goal:
On J-series routers, sometimes upgrading software can be problematic if there is not enough space available on the compact flash. One way to work around this issue is to augment the storage capacity of the J-series by formatting and mounting a USB drive for JUNOS software storage.
This article applies to Junos and Junos-ES version 8.5 and higher. For details for earlier Junos releases, refer to KB8017.
A USB mass storage device can be used to store the Junos image during installation. Follow the steps below to format and mount a USB drive.
You must be root to successfully complete many of these commands.
Connect the USB mass storage device.
Format the USB device by dropping to shell (start shell) then using the dd command: dd if=/dev/zero of=/dev/da0 bs=128k
root@host> start shell root@host% dd if=/dev/zero of=/dev/da0 bs=128k dd: /dev/da0: short write on character device dd: /dev/da0: end of device 3910+0 records in 3909+1 records out 512483328 bytes transferred in nan secs (nan bytes/sec)
Note that this step may take several minutes to complete and that there will not be any output shown at the CLI prompt until the process is complete.
Label the device using the disklabel command: disklabel -R -w da0 auto.
root@host% disklabel -R -w da0 auto
Create the file system using newfs command: newfs -U /dev/da0.
root@host% newfs -U /dev/da0 /dev/da0: nanMB (1000944 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 122.19MB, 7820 blks, 15744 inodes. with soft updates super-block backups (for fsck -b #) at: 32, 250272, 500512, 750752
Create a directory to be used as a mount point using the mkdir command. In this example we will be creating directory called /var/tmp/usb.
root@host% mkdir /var/tmp/usb
Mount the USB device using mount command: mount /dev/da0 /var/tmp/usb. Do not remove the USB device without folling step 8. Failing to do so can lead to operational impact, or possible damage to the filesystem.
root@host> file list detail /var/tmp/usb /var/tmp/usb: total 36946 drwxrwxr-x 2 root operator 512 Feb 13 2008 .snap/ -rw-r--r-- 1 root wheel 18874368 Feb 13 23:07 junos-jseries-8.5R2.10-domestic.tgz
Once you have the Junos image loaded onto the USB drive, then upgrade using the command: request system software add /var/tmp/usb/junos-jseries-8.5R2.10-domestic.tgz no-copy.
The USB device will be unmounted on reboot. To unmount it before reboot, use the unmount command and the path this filesystem is mounted to. If the command has no output, this implies success. After the device is unmounted, it is safe to remove the USB from the router.