Posts Tagged ‘setup’

SnapMirror Setup Script

March 14th, 2010

I had the task of replicating an existing customers filer to their new DR system. This was quite a large system, and as much as creating SnapMirrors isn’t particularly complex, it is time consuming. So as with many things I do, I wrote a script to help my achieve this task quicker, and go have yet another coffee.

You’ll need pre-shared keys setup (as ever), but the rest is prompted for. There’s no data validation (no surprise). The script will output 4 text files, one for creating/restricting all the volumes, one for the “snapmirror.conf”, on to be used in place of “snapmirror.conf” while you are doing the baseline initialization, and finally one to actually initialize the snapmirrors. There’s no intelligence around concurrent streams, so initialization is still a bit of a juggling act and waiting game.

Please let me know if you find this useful.


echo “Please enter the name of the PRIMARY filer: ”

echo “Please enter the name of the DR filer: ”

ConnectString=”ssh -c 3des”


echo “” > ${DR_FILER}_filer_volumes.txt
echo “” > ${DR_FILER}_snapmirror.conf
echo “” > ${DR_FILER}_sm_initialize.txt
echo “” > ${DR_FILER}_snapmirror_init.conf

for AGGR in `${ConnectString} $PRI_FILER “aggr status” | awk ‘$2!~/State/{print $1}’`
 SIZE=`${ConnectString} $PRI_FILER “df -Ah $AGGR” | sed ‘s/\([0-9][KMGT]\)B/\1/g’ | awk ‘$1!~/.snapshot|Aggregate/{print $2}’`
 for VOL in `${ConnectString} $PRI_FILER “aggr show_space $AGGR” | awk ‘$1!~/Space/{print $0}’ | awk ‘$4~/volume|file|none/{print $1}’`
  echo “vol create ${VOL} -s none ${AGGR} ${SIZE} ” >> ${DR_FILER}_filer_volumes.txt
  echo “vol restrict ${VOL}” >> ${DR_FILER}_filer_volumes.txt
  echo “snapmirror initialize -S ${PRI_FILER}:${VOL} ${DR_FILER}:${VOL}” >> ${DR_FILER}_sm_initialize.txt
  echo “${PRI_FILER}:${VOL} ${DR_FILER}:${VOL} – ${SnapMirrorMinute} ${SnapMirrorHour} * *” >> ${DR_FILER}_snapmirror.conf
  echo “${PRI_FILER}:${VOL} ${DR_FILER}:${VOL} – – – – -” >> ${DR_FILER}_snapmirror_init.conf

  SnapMirrorMinute=`expr $SnapMirrorMinute + $SnapMirrorStagger`

Command Line , , , ,


July 7th, 2009

Table of Contents


setup – update filer configuration




setup queries the user for the filer configuration parameters such as hostname, IP address, and timezone. It installs new versions of /etc/rc, /etc/hosts, /etc/exports, /etc/resolv.conf, /etc/hosts.equiv, and /etc/dgateways to reflect the new configuration. When setup completes, the configuration files have been been updated, but their new contents do not take effect until the filer is rebooted (see reboot ). The old contents of the configuration files are saved in rc.bak, exports.bak, resolv.conf.bak, hosts.bak, hosts.equiv.bak, and dgateways.bak.

One piece of information that setup requests is the name and IP address for adminhost. In /etc/exports, adminhost is granted root access to / so that it can access and modify the configuration files in /etc. All other NFS clients are granted access only to /home. If no adminhost is specified, then all clients are granted root access to /. This is not recommended for sites where security is a concern.

If an adminhost is specified, then an additional line is added to the /etc/hosts file to point the default mailhost to the adminhost. This is used by the autosupport daemon (see autosupport ) to send email notification.

If a default gateway is provided to setup, it will be used in /etc/rc to specify a default route (see route ), and will also be used as the first entry in /etc/dgateways.

The hostname that is provided to setup is used to construct default names for all of the configured network interfaces. Ethernet interfaces are given names host_name-0, hostname-1, and so on.


directory of filer configuration and administration files
system initialization command script
directories exported by the server
host name data base
list of hosts and users with rsh permission
list of DNS name servers
list of preferred default gateways for routed /etc/nsswitch.conf list of preferred name services


After a takeover, you can enter the setup command in partner mode to configure the failed filer. However, only the network interfaces on the failed filer that were taken over appear in the prompts displayed by setup. For example, if the e1 interface on the failed filer was not configured and taken over by the live filer, the setup command does not prompt you for the IP address of the e1 interface.


When run from a vfiler context, (e.g. via the vfiler run command), setup operates on the concerned vfiler. If the vfiler is not vfiler0, setup only allows the configuration of a subset of parameters that are meaningful for a vfiler. Specifically, the operator is prompted for the IP address bindings of the vfiler, the name and IP address of the vfiler’s adminhost, the vfiler’s DNS configuration and its NIS configuration. The command allows the configuration of the password of the root user of the vfiler. Running this command also sets up default versions of the /etc/exports, /etc/hosts and /etc/hosts.equiv files. A command line version of setup can also be used in the context of a vfiler. This version has the form:

setup [-e <ifname>:<ipaddress>:<netmask>, …] [-d <DNS domaname>:<DNS server IP 1>:…] [-n <NIS domainname>:<NIS server1>:…] [-a <ipaddress> | <name>:<ipaddress>] [-p <root password>]

The -e option allows the bindings of the IP addresses of the vfiler to be created. The -d option allows the specification of a DNS domain name and the IP addresses of one or more DNS servers. The -n option allows the specification of an NIS domain name and the IP addresses of one or more NIS servers (or the use of broadcast discovery by using * as the NIS server name). The -a option allows the admin hosts name and IP address to be specified. Finally, the -p option allows the password of the root user of this vfiler to be set.


ifconfig , partner , reboot , vfiler , dgateways , exports , hosts , hosts.equiv , resolv.conf , rc , autosupport


Some Ethernet boards determine the media type automatically. It is not necessary to specify the media type for them, but it is best to do so anyway in case the board is replaced with one that does not determine media type automatically.

As the /etc/rc file is rewritten after running the setup command in vfiler0, all vlans and aliases configured earlier in the /etc/rc file will be lost. If these aliases and vlans are required, they will have to be added to the /etc/rc file again.

Table of Contents

7-mode Manual Pages , , , ,

This site is not affiliated or sponsored in anyway by NetApp or any other company mentioned within.