Upgrade and Backup JunOS Image of Juniper SRX Device

Share This Article: Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0Pin on Pinterest0Email this to someone

No software is perfect, so upgrades and patches are required. Today I will be discussing how to upgrade and backup JunOS Image of Juniper SRX device. When performing an upgrade there is always chances of failure. So, to prevent or recover from catastrophic failures, always create a backup before upgrading the device’s operating system.

Upgrade and Backup JunOS Image of Juniper SRX Device

Upgrade and Backup JunOS Image of Juniper SRX Device

Backup JunOS Image of Juniper SRX device

To create a backup to USB type the following command in operational mode

user@host>request system snapshot media usb partition [Hit Enter]
Clearing current label…
Partitioning usb media (/dev/da1) …
Partitions on snapshot:
Partition  Mountpoint Size Snapshot argument
s1a/2.4G none
s2a/altroot  2.4G  none
s3e/config  185M  none
s3f/var  2.1G  none
s4a/recovery/software  216M  none
s4e/recovery/state  15M  none
Copying ‘/dev/da0s1a’ to ‘/dev/da1s1a’ .. (this may take a few minutes)
Copying ‘/dev/da0s2a’ to ‘/dev/da1s2a’ .. (this may take a few minutes)
Copying ‘/dev/da0s3e’ to ‘/dev/da1s3e’ .. (this may take a few minutes)
Copying ‘/dev/da0s3f’ to ‘/dev/da1s3f’ .. (this may take a few minutes)
Copying ‘/dev/da0s4e’ to ‘/dev/da1s4e’ .. (this may take a few minutes)
Copying ‘/dev/da0s4a’ to ‘/dev/da1s4a’ .. (this may take a few minutes)
The following filesystems were archived: / /altroot /config /var /recovery/state /recovery/software

You can view the snapshot information on USB by typing following command,

user@host> show system snapshot media usb

Now, to reboot the device from the backup USB stick enter the following command in operational mode

user@host>request system reboot media usb [Hit Enter]
Reboot the system ? [yes,no]
press y and Hit Enter Button on the keyboard

The device will now reboot and load the OS from USB stick.

Upgrading the JunOS Software

First of all download the latest JunOS software from Juniper’s website www.juniper.net. Now copy that downloaded JunOS file into the USB stick. Remember that the USB Stick must have FAT32 file type partitioned or the upgrade won’t work. Then, log in to the device using root user. We need to mount the USB stick into the device first. Type the following command from shell prompt.

root@host% ls /dev/da* [Hit Enter]
/dev/da0  /dev/da0s1c  /dev/da0s2c  /dev/da0s3e  /dev/da0s4a
/dev/da0s1  /dev/da0s2  /dev/da0s3  /dev/da0s3f  /dev/da0s4c
/dev/da0s1a /dev/da0s2a  /dev/da0s3c  /dev/da0s4  /dev/da0s4e

After you hit enter you will see the above output. These are partitions of the JunOS in SRX.  Now, insert the USB stick into the SRX device. Again type the previous command.

root@host% ls /dev/da* [Hit Enter]
/dev/da0  /dev/da0s2  /dev/da0s3c  /dev/da0s4a  /dev/da1s1
/dev/da0s1  /dev/da0s2a  /dev/da0s3e  /dev/da0s4c /dev/da1s5
/dev/da0s1a  /dev/da0s2c  /dev/da0s3f  /dev/da0s4e
/dev/da0s1c  /dev/da0s3  /dev/da0s4  /dev/da1

Here we can notice that there are three new partition of the USB stick. Note that /dev/da1s5 is the one you must mount. Now create a folder named Flash under /var/tmp. This will be the mounting location. Now type the following command.

root@host% mkdir /var/tmp/Flash

Now lets mount the Flash drive. To do so hit the command given below.
root@host% mount_msdosfs /dev/da1s5 /var/tmp/Flash
Note: – You might get following error if the location you entered is not correct. You can try different location randomly (the bolded and underlined ones that we listed above)
root@host% mount_msdosfs /dev/da1s1 /var/tmp/Flash
root@host% mount_msdosfs: /dev/da1s1: Invalid argument
After mounting you can view the lists of files under USB Flash Drive by typing this command.
root@host% ls /var/tmp/Flash

By now what we have done is, just inserted the USB in the device and the USB stick is visible. We now need to copy the installation file into the device’s hard disk. We will copy to /var/tmp location. To do that hit the command: –

root@host% cp /var/tmp/Flash/junos-srxsme-10.4R8.5-domestic.tgz /var/tmp
root@host% ls /var/tmp
After copying the file, remove the USB from device. Finally, to install the JunOS you need to enter the following command in operation mode not in shell mode.
root@host> request system software add /var/tmp/junos-srxsme-10.4R8.5-domestic.tgz no-validate no-copy
partition unlink reboot

Now the device will reboot and install the software. So now, what if the SRX devices are in cluster. How do you perform the upgrade? Well, to upgrade branch series SRX cluster, you need to upgrade the device one by one and then reboot the device at the same time. You can mount the USB and copy installation file to say node 0 and upgrade the node 0 first. Then you can copy the file from node 0 to node 1 and then upgrade node 1. You can also use same USB to mount and copy files to node 1. To copy file from node 0 to node 1 directly, type following command,

{primary: node 0}
root@host> file copy /var/tmp/junos-srxsme-10.4R8.5-domestic.tgz node1:/var/tmp

After copying the JunOS file to node 1, login to node 1 device. To switch the login, type following command.

{primary: node 0}
root@host> request routing-engine login node 1
Now you can upgrade node 1 and reboot both devices at the same times.
The following two tabs change content below.
Bipin is a freelance Network and System Engineer with expertise on Cisco, Juniper, Microsoft, VMware, and other technologies. You can hire him on UpWork . Follow Bipin Giri on Google+. Bipin enjoys writing articles and tutorials related to Network technologies. Some of his certifications are, MCSE:Messaging, JNCIP-SEC, JNCIS-ENT, and others.