Change the shell from Junos CLI to BSD shell.
user@mx150> start shell
%
- Before inserting the USB device, check current disk device partitions. "192.168.1.1" 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@192.168.1.1 '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__ root@192.168.1.1 '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@192.168.1.1 '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@192.168.1.1 '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__ root@192.168.1.1 'mkdir /var/tmp/usb'
%
Mount the USB drive to the /var/tmp/usb directory in Linux host side.
% ssh -JU __juniper_private4__ root@192.168.1.1 'mount /dev/sdb /var/tmp/usb'
如果mount失敗出現下面訊息:
mount: /dev/sdb is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sdb,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
則先需格式化USB為etx4格式,使用下列指令:
% ssh -JU __juniper_private4__ root@192.168.1.1 'mkfs -t ext4 /dev/sdb'
Check if it is properly mounted in Linux host.
% ssh -JU __juniper_private4__ root@192.168.1.1 '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:
a. From MX150 storage to the USB disk(/var/tmp/usb directory) with the following SCP command:
scp -JU __juniper_private4__ <filename> root@192.168.1.1:/var/tmp/usb/
% scp -JU __juniper_private4__ /var/tmp/testfile.txt root@192.168.1.1:/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__ root@192.168.1.1 '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@192.168.1.1:/var/tmp/usb/<filename> <target_directory_in_MX150_Junos>
% scp -JU __juniper_private4__ root@192.168.1.1:/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__ root@192.168.1.1 umount /var/tmp/usb
留言
張貼留言