JunOS: Copy From USB
JunOS is based on FreeBSD, and therefore uses Linux commands to copy files back and forth. This may be required to retrieve logs or to update the software.
Start with the USB drive disconnected. This assumes that the USB disk is FAT formatted.
- Connect to the shell with start shell
- See a list of existing partitions with ls /dev/da*
- Plugin the USB drive; A list of mount information will appear
- Run ls /dev/da* again, and see an additional partition is available, such as /dev/da1s1
- Create a mount point with mkdir /var/tmp/usb
- Mount the partition with mount_msdosfs [partition] /var/tmp/usb
- Copy files as required with cp
- Unmount the partition with umount /var/tmp/usb
- Remove the USB drive
Note that cp does not show copy rate and completion percent. Rsync would normally be an option, but it’s not available on JunOS.
root@Switch01> start shell root@Switch01:RE:0% ls /dev/da* /dev/da0 /dev/da0p1 /dev/da0p2 root@Switch01:RE:0% ugen0.4: at usbus0 umass1: on usbus0 umass1: SCSI over Bulk-Only; quirks = 0x8100 umass1:1:1: Attached to scbus1 da1 at umass-sim1 bus 1 scbus1 target 0 lun 0 da1: Removable Direct Access SPC-4 SCSI device da1: Serial Number 4C530002770123121310 da1: 40.000MB/s transfers da1: 7633MB (15633408 512 byte sectors) da1: quirks=0x2 root@Switch01:RE:0% ls /dev/da* /dev/da0 /dev/da0p1 /dev/da0p2 /dev/da1 /dev/da1s1 root@Switch01:RE:0% mkdir /var/tmp/usb root@Switch01:RE:0% mount_msdosfs /dev/da1s1 /var/tmp/usb root@Switch01:RE:0% cp /var/tmp/usb/ex-2300-18.3R1.9.tgz /var/tmp root@Switch01:RE:0% cp /var/tmp/usb/jweb-ex-app-x86-32-18.3A1.tgz /var/tmp root@Switch01:RE:0% umount /var/tmp/usb root@Switch01:RE:0% ugen0.4: at usbus0 (disconnected) umass1: at uhub1, port 4, addr 4 (disconnected) da1 at umass-sim1 bus 1 scbus1 target 0 lun 0 da1: s/n 4C530002770123121310 detached (da1:umass-sim1:1:0:0): Periph destroyed