Backing Up Filesystems on J-Series Routers
Problem
You are preparing to load a different release of the JUNOS software or reload the current release on a J-series router and you want to save the files that are already on the router.
Solution
On any J-series router, back up the filesystem to a device that is connected to the router's USB port:
aviva@RouterA> request system snapshot media usb
On J4300 and J6300 routers, you can also back up the files in the router's filesystem to a removable compact flash disk:
aviva@RouterA> request system snapshot media removable-compact-flash
Before installing the software upgrade, delete old log- and crashfiles:
aviva@RouterA> request system storage cleanup
Discussion
The snapshot process on J-series routers differs from the process for M-series and T-series routers because of hardware differences. You can place a snapshot of the J-series filesystems on a device connected to the router's USB port or, for J4300 and J6300 routers, on a removable compact flash disk.
You can take a snapshot of the software at any time, but you should always do so before installing a new JUNOS software version so that you can recover to a known, stable environment in case something goes wrong when you load the software. You should also always take a snapshot after you have successfully loaded a new version of the software.
Before installing a new software package, you can use the request system storage cleanup command to remove older files to free up space in the filesystem. This command deletes any rotating logfiles in /cf/var/log that are not current files in /cf/var/tmp that have not been modified in the last two days and all crashfiles in /cf/var/crash. Before you delete files in the directories, you can use the file list command to check what they contain:
aviva@RouterA> file list detail /cf/var/tmp /cf/var/tmp: total 28 -rw-r--r-- 1 root wheel 6379 Nov 3 00:10 cleanup-pkgs.log drwxrwxrwx 2 root wheel 512 Apr 15 2005 install/ -rw-r----- 1 root wheel 2492 Nov 3 00:10 sampled.pkts aviva@RouterA> file list detail /cf/var/log/messages* -rw-rw-r-- 1 root wheel 65 Nov 3 00:06 /cf/var/log/messages -rw-rw---- 1 root wheel 2587 Nov 3 00:06 /cf/var/log/messages.0.gz -rw-rw-r-- 1 root wheel 21746 Apr 16 2005 /cf/var/log/messages.1.gz -rw-rw---- 1 root wheel 12381 Dec 9 2004 /cf/var/log/messages.10.gz -rw-rw-r-- 1 root wheel 11066 Apr 9 2005 /cf/var/log/messages.2.gz -rw-rw-r-- 1 root wheel 12844 Feb 24 2005 /cf/var/log/messages.3.gz -rw-rw-r-- 1 root wheel 8751 Feb 18 2005 /cf/var/log/messages.4.gz -rw-rw---- 1 root wheel 12280 Feb 17 2005 /cf/var/log/messages.5.gz -rw-rw---- 1 root wheel 11486 Feb 10 2005 /cf/var/log/messages.6.gz -rw-rw---- 1 root wheel 44407 Feb 8 2005 /cf/var/log/messages.7.gz -rw-rw---- 1 root wheel 22260 Dec 10 2004 /cf/var/log/messages.8.gz -rw-rw---- 1 root wheel 18618 Dec 9 2004 /cf/var/log/messages.9.gz total 12
The show log command is another way to find out when logfiles were last modified:
aiva@RouterA> show log messages Size: 65, Last changed: Nov 03 00:06:10 messages.0.gz Size: 2587, Last changed: Nov 03 00:06:10 messages.1.gz Size: 21746, Last changed: Apr 16 2005 messages.10.gz Size: 12381, Last changed: Dec 09 2004 messages.2.gz Size: 11066, Last changed: Apr 09 2005 messages.3.gz Size: 12844, Last changed: Feb 24 2005 messages.4.gz Size: 8751, Last changed: Feb 18 2005 messages.5.gz Size: 12280, Last changed: Feb 17 2005 messages.6.gz Size: 11486, Last changed: Feb 10 2005 messages.7.gz Size: 44407, Last changed: Feb 08 2005 messages.8.gz Size: 22260, Last changed: Dec 10 2004 messages.9.gz Size: 18618, Last changed: Dec 09 2004
See Also
Recipe 1.19