Knowledge Center Search


 

How to format and mount a USB flash drive on a J-series router?

  [KB10800] Show KB Properties

  [KB10800] Hide KB Properties

Categories:
Knowledge Base ID: KB10800
Last Updated: 16 Feb 2012
Version: 11.0

Summary:
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.

Solution:

note: 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. 

note: You must be root to successfully complete many of these commands.

  1. Connect the USB mass storage device.
  2. 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.
  3. Label the device using the disklabel command: disklabel -R -w da0 auto.
    root@host% disklabel -R -w da0 auto
  4. 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
  5. 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
  6. 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% mount /dev/da0 /var/tmp/usb
  7. Verify the mount using command: df -h.
    root@host% df -h
    Filesystem      Size    Used   Avail Capacity  Mounted on
    /dev/ad0s1a     851M    277M    565M    33%    /
    devfs           1.0K    1.0K      0B   100%    /dev
    devfs           1.0K    1.0K      0B   100%    /dev/
    /dev/md0        133M    133M      0B   100%    /junos
    /cf             851M    277M    565M    33%    /junos/cf
    devfs           1.0K    1.0K      0B   100%    /junos/dev/
    procfs          4.0K    4.0K      0B   100%    /proc
    /dev/bo0s1e      95M     16K     94M     0%    /config
    /dev/md1        336M    7.2M    302M     2%    /mfs
    /cf/var/jail    851M    277M    565M    33%    /jail/var
    devfs           1.0K    1.0K      0B   100%    /jail/dev
    /dev/da0        481M    4.0K    442M     0%    /cf/var/tmp/usb

    At this point you can use the /var/tmp/usb directory as a place to store your JUNOS install image. Copy the Junos install image to the USB directory using the command: file copy.
    root@host> file copy ftp://1.1.1.1/junos-jseries-8.5R2.10-domestic.tgz /var/tmp/usb   
    /var/tmp//...transferring.file.........PQ6d3g/100% of   48 MB 4209 kBps 00m00s

    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.
  8. 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.

    root@host% umount /var/tmp/usb

Purpose:
Installation

Related Links:

 

 

ASK THE KB

Question or KB ID:


 


 

 
Copyright© 1999-2012 Juniper Networks, Inc. All rights reserved.