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.
Change the shell from Junos CLI to BSD shell.
user@mx150> start shell %
% ssh -JU __juniper_private4__ [email protected] 'ls /dev/sd*' /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 <-- Currently there is only "sda(and number at the tail)" device found
Insert USB stick to MX150 box USB port. You can check the disk partition of USB from dmesg.
% ssh -JU __juniper_private4__ [email protected] '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__ [email protected] '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__ [email protected] 'ls /dev/sd*' /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sda6 /dev/sda7 /dev/sdb <-- "sdb" device is attached. (The last letter "b" may vary depending on your circumstance.) /dev/sdb1
Create a directory for the USB drive to mount in Linux host side.
% ssh -JU __juniper_private4__ [email protected] 'mkdir /var/tmp/usb' %
Mount the USB drive to the /var/tmp/usb directory in Linux host side.
% ssh -JU __juniper_private4__ [email protected] 'mount /dev/sdb /var/tmp/usb'
Check if it is properly mounted in Linux host.
% ssh -JU __juniper_private4__ [email protected] 'mount | grep usb' /dev/sdb on /var/tmp/usb type ext2 (rw,relatime,errors=continue,user_xattr,acl) <-- You can see this line
Copy any of files:
scp -JU __juniper_private4__ <filename> [email protected]:/var/tmp/usb/
% scp -JU __juniper_private4__ /var/tmp/testfile.txt [email protected]:/var/tmp/usb/ <-- source-file name is "testfile.txt" in current directory testfile.txt 100% 9 0.0KB/s 00:00 <-- transfer completed %ssh -JU __juniper_private4__ [email protected] 'ls /var/tmp/usb' testfile.txt <-- you can see the same file in the USB mounted directory
scp -JU __juniper_private4__ [email protected]:/var/tmp/usb/ <filename> <target_directory_in_MX150_Junos>
% scp -JU __juniper_private4__ [email protected]:/var/tmp/usb/testfile.txt /var/tmp/ <-- source-file name is "testfile.txt" in USB destins "/var/tmp" directory in MX150
Unmount the USB drive after the file is completely copied:
% ssh -JU __juniper_private4__ [email protected] umount /var/tmp/usb