Flylib.com

Books Software

 
 
 

Recipe 1.18. Creating an Emergency Rescue Configuration


Recipe 1.18. Creating an Emergency Rescue Configuration

Problem

You want to store a copy of a known good and working configuration that you can load in case of an emergency without having to remember which rollback number to use.

Solution

When a known stable and working configuration is loaded and running on the router, save it as the rescue configuration:

aviva@router1>

request system configuration rescue save


You can also save it directly from configuration mode:

aviva@router1#

run request system configuration rescue save


Discussion

You create a rescue configuration to define a known working configuration or a configuration with a known state that you can roll back to at any time. This alleviates having to know the rollback number when you use the rollback command. You use the rescue configuration when you need to roll back to a known configuration or as a last resort if your router configuration and the backup configuration files become damaged beyond repair. The JUNOS software does not provide a default rescue configuration.

To return to the rescue configuration, load it with the following command:

[edit]
	aviva@router1#

rollback rescue

[edit]
	aviva@router1#

commit

commit complete

The JUNOS software stores the rescue configuration in the /config directory:

aviva@router1>

file list /config

/config:
	juniper.conf.1.gz
	juniper.conf.2.gz
	juniper.conf.3.gz
	juniper.conf.gz
	rescue.conf.gz

To save a different configuration as the rescue configuration, just use the request system configuration rescue save command to overwrite the existing file. If you discover that the existing rescue configuration is not correct, but you don't have something to replace it with, delete the rescue configuration so no one accidentally uses it:

aviva@router1>

request system configuration rescue delete


See Also

Recipe 1.17



Recipe 1.19. Backing Up Filesystems on M-Series and T-Series Routers

Problem

You are preparing to load a different release of the JUNOS software or reload the current release and you want to save the files that are already on the router.

Solution

On M-series and T-series routers, use the following command to back up the files in the router's filesystems:

aviva@router1>

request system snapshot


Discussion

Before you install any JUNOS software, either upgrading, downgrading , or reinstalling the current software version, you should always back up the files in the router's filesystem. This operation is sometimes called taking a snapshot of the software. The request system snapshot command copies the files and filesystems from the current running active partitions to standby partitions. Specifically, it copies the / (root) filesystem to /altroot , and the /config filesystem to /altconfig . You see information about the copying as the command is running:

aviva@router1>

request system snapshot

Copying '/' to '/altroot' .. (this may take a few minutes)
	Copying '/config' to '/altconfig' .. (this may take a few minutes)
	The following filesystems were archived: / /config

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 run it after you have successfully loaded a new version of the software.

Why do you need to back up the JUNOS filesystems? One seasoned administrator has said that the less you know about the JUNOS filesystems, the more sane you will bebut still, you have to know at least a little bit. Routers have two internal storage areas, the flash drive (by default, the primary boot device) and the hard disk (the secondary boot device). A copy of the JUNOS software is stored in both. The flash drive has two filesystems (or partitions): /config , which contains the active and most recent backup configurations, the rescue configuration, and software licenses, and /, which contains the JUNOS software (everything installed by the jinstall or jbundle command), the router's SSH keys, and a few other files generated from the configuration. The hard disk has one filesystem, /var , which is a large partition that contains system logfiles, diagnostic dump files, archived configuration files, and user home directories.(Also on the hard disk are the /altroot and /altconfig partitions, which contain a copy of the JUNOS software and related files and a swap partition.) When booting from the flash drive, the router uses the software and files on the flash drive. If the boot fails, it automatically tries the software and files on the hard disk. For the boot failover process to work, you must have already created a snapshot from a working version of the software.

There is one additional filesystem on the router, /tmp , which is a RAM disk (a memory filesystem).

To verify that the snapshot was successful, you might want to list the contents of the filesystems (with the file list command). However, the /altroot and /altconfig filesystems are not mounted, so they are not visible even though the underlying directories are still present:

aviva@router1>

show system storage

Filesystem     Size       Used      Avail    Capacity    Mounted on
	/dev/ 
ad0s1a     77M        39M        32M         55%   /devfs
	                16K        16K         0B        100%   /dev/
	/dev/vn0        13M        13M         0B        100%   /packages/mnt/jbase
	/dev/vn1        37M        37M         0B        100%   /packages/mnt/jkernel-7.4R1.7
	/dev/vn2        12M        12M         0B        100%   /packages/mnt/jpfe-M40-7.4R1.7
	/dev/vn3       2.3M       2.3M         0B        100%   /packages/mnt/jdocs-7.4R1.7
	/dev/vn4        14M        14M         0B        100%   /packages/mnt/jroute-7.4R1.7
	/dev/vn5       5.1M       5.1M         0B        100%   /packages/mnt/jcrypto-7.4R1.7
	/dev/ad0s1e     12M        16K        11M          0%   /config
	procfs         4.0K       4.0K         0B        100%   /proc
	/dev/ 
ad1s1f    9.4G       1.2G       7.4G         14%   /var

How do you know from the output of this command which partition is where? /dev/ad0s1a refers to a portion of a disk. It is drive ad0 (the storage device) slice 1 (the first "slice," and there's generally just one slice), partition a (which is the first partition on a disk and always refers to the root partition). Similarly, /dev/ad1s1f refers to drive ad1 , slice 1 , partition f .

On most M-and T-series routers, ad0 is the flash disk. In the case of router1 , an M20 router that has an RE-2.0, ad0 is the flash disk and ad1 is the hard disk:

aviva@router1>

show chassis hardware detail

Hardware inventory:
	Item             Version      Part number   Serial number    Description
	Chassis                                     25708            M20
	Backplane        REV 03       710-002334    BB9738           M20 Backplane
	Power  
Supply A   REV 06       740-001465    005234           AC Power Supply
	Display          REV 04       710-001519    BA4681           M20 FPM Board
	Routing Engine 0 REV 06       740-003239    1000224893       RE-2.0

Routing Engine 0                            58000007348d9a01 RE-2.0
	  ad0      91 MB  SanDisk     SDCFB-96      i3238140903      Compact Flash
	  ad1   11513 MB IBM-DARA-212000            AH0AHGN1017      Hard Disk

Routing Engine 1 REV 06 740-003239          9000022146       RE-2.0

Routing Engine 1                            d800000734745701 RE-2.0
	  ad0      91 MB  SanDisk SDCFB-96          ggbsc410020      Compact Flash
	  ad1    8063 MB  TOSHIBA MK2016GAP         Y0T39909T        Hard Disk

The output of this command also shows the manufacturer of the disks.

Use the show system storage command to find out the drive names :

aviva@router1>

show system storage

Filesystem              Size        Used     Avail  Capacity    Mounted on
	/dev/ad0s1a              77M         40M       31M       56%   /
	devfs                    16K         16K        0B      100%   /dev/
	/dev/vn0                 13M         13M        0B      100%   /packages/mnt/jbase
	/dev/vn1                 37M         37M        0B      100%   /packages/mnt/jkernel-
	7.3-20050504.0
	/dev/vn2                 12M         12M        0B      100%   /packages/mnt/jpfe-M40-
	7.3-20050504.0
	/dev/vn3                2.3M        2.3M        0B      100%   /packages/mnt/jdocs-7.
	3-20050504.0
	/dev/vn4                 14M         14M        0B      100%   /packages/mnt/jroute-7.
	3-20050504.0
	/dev/vn5                5.1M        5.1M        0B      100%   /packages/mnt/jcrypto-
	7.3-20050504.0
	mfs:102                 1.5G         12K      1.4G        0%   /tmp
	/dev/ad0s1e              12M         24K       11M        0%   /config
	procfs                  4.0K        4.0K        0B      100%   /proc
	/dev/ad1s1f             9.4G        2.4G      6.2G       28%   /var

You see that /dev/ad0s1a is mounted at /, and you know that's the flash disk. /config is also on ad0 (the flash disk again) but on a different partition, and /var is on ad1 (the hard disk). The /dev/vn0 devices refer to the software installed on the router. All these partitions are stored on / (and /altroot ).

The show system storage command output is cluttered and contains more information than you normally care about. You can shorten by filtering out the installed software devices:

aviva@router1>

show system storage  except /dev/vn

Filesystem               Size         Used      Avail   Capacity    Mounted on
	/dev/ad0s1a               77M          39M        32M        55%   /
	devfs                     16K          16K         0B       100%   /dev/
	mfs:102                  1.5G         8.0K       1.4G         0%   /tmp
	/dev/ad0s1e               12M          16K        11M         0%   /config
	procfs                   4.0K         4.0K         0B       100%   /proc
	/dev/ad1s1f              9.4G        1013M       7.6G        11%   /var

or even more:

aviva@router1>

show system storage  match ad

/dev/ad0s1a               77M          39M        32M        55%   /
	/dev/ad0s1e               12M          16K        11M         0%   /config
	/dev/ad1s1f              9.4G        1013M       7.6G        11%   /var

If the router boots from the hard disk or if you manually reboot from the hard disk (take a fresh snapshot first, though), you'll notice that ad0 is still the flash disk and ad1 is still the hard disk, but the root filesystem is now on the hard disk because you're running on alternate media:

aviva@router1>

request system reboot media disk

aviva@router1>

show system storage

Filesystem                 Size       Used      Avail   Capacity    Mounted on
	/dev/ad1s1a                107M        37M        61M        38%   /
	.
	.
	.
	mfs:172                    1.9G       4.0K       1.8G         0%   /tmp
	/dev/ad1s1e                 12M        21K        11M         0%   /config
	procfs                     4.0K       4.0K         0B       100%   /proc
	/dev/ad1s1f                 25G       3.5G        19G        15%   /var

The request system reboot media disk command takes a fairly long time to complete, and you need to log back in to the router when it completes.

See Also

Recipe 1.20