Non-root users/super-user may find that the file copy utility always stages the transfer of jinstall packages for Juniper Networks devices, or any other file to the user's home directory even when the destination path is specified as /var/tmp . This article describes a knob that was introduced in Junos OS Release 17.1 to alleviate this problem.
file copy
/var/tmp
For all non-root users/super-user, the file copy utility always stages the transfer of jinstall packages or any other file to the user's home directory even when the destination path is specified as /var/tmp . This can cause problems when users are trying to copy large Junos packages, which are quite often bigger in size than the available space in /var/home.
/var/home
usert@qfx5110> file copy http://10.10.10.1/image/jinstall-host-qfx-5e-x86-64-17.3R1.10-secure-signed.tgz /var/tmp/ /var/home/labroot/...transferring.file........ 35% of 1015 MB 2101 kBps 05m20s /.mount/var: write failed, filesystem is full /var/home/labroot/...transferring.file........ 35% of 1015 MB 2101 kBps 05m18s fetch-secure: /var/home/labroot/...transferring.file.........7BlZfw/jinstall-host-qfx-5e-x86-64-17.3R1.10-secure-signed.tgz: No space left on device error: file-fetch failed error: could not fetch local copy of file
This behavior is by design. The error is seen for files that are larger than the available space in the user's home directory. A non-root user copying a file to the /var/tmp directory automatically attempts to save it to the /var/home/user directory. There is limited access to other directories for a non-root user.
/var/home/user
Even though we have specifically provided the path for the file as /var/tmp , it still gets saved in the /var/home/user location, which has a capacity of 100Mb.
Hence, file transfer above 100MB will trigger this error for the non-root user.
Starting with Junos OS Release 17.1, a hidden knob staging-directory is added to file copy, where you can stage the directory when you want the image to be copied, instead of using your home directory. As shown in the example below, an image size of 1 GB is copied by a non-root user by using both the staging directory and the destination folder as /var/tmp .
staging-directory
root@qfx5110:RE:0% pwd /var/tmp root@qfx5110:RE:0% ls -l total 2082304 -rwxrwxrwx 1 root wheel 0 Apr 22 17:44 LOCK_FILE -rwxrwxrwx 1 root wheel 11 Aug 18 12:09 alarmd.ts
labroot@qfx5110> file copy http://10.10.10.1/image/jinstall-host-qfx-5e-x86-64-17.3R1.10-secure-signed.tgz /var/tmp/ staging-directory /var/tmp /var/tmp/...transferring.file.........vwR0ym/j100% of 1015 MB 2090 kBps 00m00s root@qfx5110:RE:0% ls -l total 2082304 -rwxrwxrwx 1 root wheel 0 Apr 22 17:44 LOCK_FILE -rwxrwxrwx 1 root wheel 11 Aug 18 12:09 alarmd.ts -rw-r--r-- 1 labroot wheel 1065088225 Oct 7 11:25 jinstall-host-qfx-5e-x86-64-17.3R1.10-secure-signed.tgz -rwxrwxrwx 1 root wheel 797 Aug 25 06:08 juniper.conf.sync.gz
For more information, please refer to https://prsearch.juniper.net/problemreport/PR1195599.