Support Support Downloads Knowledge Base Apex Support Portal Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

How to mount a USB drive on MX150 device



Article ID: KB32657 KB Last Updated: 01 May 2018Version: 1.0

This article explains how to mount a USB drive on an MX150 device and copy files to or from the device via the USB drive.


The following procedure allow users to mount a USB device on MX150.  This can be helpful if network connectivity is unavailable and you need to copy files to or from the device.
Note: the USB drive is detected on Linux host side /dev directory, not on FreeBSD (Junos VM) /dev directory.

  1. Change the shell from Junos CLI to BSD shell.

    user@mx150> start shell

  2. Before inserting the USB device, check current disk device partitions. "" is a fixed address for Linux host via internal connection.
    You can issue Linux command via SSH connection with Juniper private routing instance onward.
    % ssh -JU __juniper_private4__ root@ 'ls /dev/sd*'
    /dev/sda7  <-- Currently there is only "sda(and number at the tail)" device found
  3. Insert USB stick to MX150 box USB port. You can check the disk partition of USB from dmesg.

    % ssh -JU __juniper_private4__ root@ 'dmesg | grep -i scsi'
    [600876.608516] scsi7 : usb-storage 3-1:1.0
    [600877.608645] scsi 7:0:0:0: Direct-Access     SanDisk  Cruzer Blade     1.27 PQ: 0 ANSI: 6
    [600877.616627] sd 7:0:0:0: [sdb] Attached SCSI removable disk <-- [sdb] is the device name

    Note: Or, you can check the disk partition of USB by lsblk command as well.

    % ssh -JU __juniper_private4__ root@ 'lsblk -S'
    NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
    sda  0:0:0:0    disk ATA      StorFly VSFBM6CC 0629 sata
    sdb  7:0:0:0    disk SanDisk  Cruzer Blade     1.27 usb    <-- sdb shows usb transport type

    There is certainly such disk partition attached in Linux host.

    %  ssh -JU __juniper_private4__ root@ 'ls /dev/sd*'
    /dev/sdb    <-- "sdb" device is attached. (The last letter "b" may vary depending on your circumstance.)
  4. Create a directory for the USB drive to mount in Linux host side.

    % ssh -JU __juniper_private4__ root@ 'mkdir /var/tmp/usb'
  5. Mount the USB drive to the /var/tmp/usb directory in Linux host side.

    % ssh -JU __juniper_private4__ root@ 'mount /dev/sdb /var/tmp/usb'

    Check if it is properly mounted in Linux host.

    % ssh -JU __juniper_private4__ root@ 'mount | grep usb'
    /dev/sdb on /var/tmp/usb type ext2 (rw,relatime,errors=continue,user_xattr,acl)  <-- You can see this line
  6. Copy any of files:

    a.  From MX150 storage to the USB disk(/var/tmp/usb directory) with the following SCP command:

    scp -JU __juniper_private4__ <filename> root@
    % scp -JU __juniper_private4__ /var/tmp/testfile.txt root@  <-- source-file name is "testfile.txt" in current directory
    testfile.txt                                  100%    9     0.0KB/s   00:00  <-- transfer completed
    %ssh -JU __juniper_private4__ root@ 'ls /var/tmp/usb'
    testfile.txt  <-- you can see the same file in the USB mounted directory

    b.  From the USB disk to MX150 storage with the following SCP command:

    scp -JU __juniper_private4__ root@<filename> <target_directory_in_MX150_Junos>
    % scp -JU __juniper_private4__ root@ /var/tmp/  <-- source-file name is "testfile.txt" in USB destins "/var/tmp" directory in MX150
  7. Unmount the USB drive after the file is completely copied:

    % ssh -JU __juniper_private4__ root@ umount /var/tmp/usb

Related Links

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search