UNIX Consulting and Expertise
Golden Apple Enterprises Ltd. » Posts for tag 'disksuite'

Solaris SVM metasets Comments Off on Solaris SVM metasets

The Solaris disk management/virtualisation tools have gone through many name changes – ODS, SDS, SVM – but the basic tools have remained the same. With the introduction of Sun Cluster, Sun needed to come up with a way to share storage between cluster nodes. Obviously this functionality needed to be added to SVM, and they came up with the idea of metasets.

Normally, metadevices are local to a host. When encapsulating disk slices into metadevices, you first have to dedicate a disk slice to store the metadatabase (with them metadb command). You can then create replicas of the metadb, and scatter them across slices, to ensure they don’t get corrupt and you lose all your metadevice information.

metasets are, in a nutshell, a collection of metadevices that have their own metadb state databases.

This works well in a cluster – the metaset metadevices, along with their metadbs, can be moved around, existing on the node which needs to mount their filesystems.

It also makes things easy for use when mounting LUNs from a SAN. If we can encapsulate the LUNs within metadevices, in their own metaset, then if our host dies we can just re-import everything on another host. Think of it as very basic – but very quick and easy – disaster recovery.

Think of metasets as being very similar to disk groups in Veritas Volume Manager.

Creating the metaset is a simple process. First of all we define our metaset and add our host to it.

bash-3.00# metaset -s test -a -h avalon

Syntax is pretty straightforward:

  • -s is used to specify which metaset we’re using
  • -a is the add flag. Guess what -d does?
  • -h specifies the hostname which owns this metaset

All metasets are owned by at least one host (it’s how they track who can access them). If you’re in a cluster environment, multiple hosts will own the metaset, allowing the cluster software to move the metadevices between nodes.

For a single hosted metaset, however, we just need to add one host, and we need to make sure that it will automatically take ownership and import the metaset on boot.

All we have to do to make this happen is enable the autotake flag on the metaset:

bash-3.00# metaset -s test -A enable

And that completes the setup of the metaset. We then just select which LUNs we’re interested in, and add them in to the metaset:

bash-3.00# metaset -s test -a c7t60060E80141189000001118900001A10d0 \
c7t60060E80141189000001118900001A17d0 \
c7t60060E80141189000001118900001A17d0 \
c7t60060E80141189000001118900001A19d0

Note that when we add devices to a metaset (disks or LUNs) we need to only specify the device name – not slices, and not s2 (the Solaris way to reference an entire disk by a single reserved slice).

Normally, when you create a metadevice, you are encapsulation a slice that already exists on disk. This means the data stays intact. This is not the case when importing a disk into a metaset.

The act of importing a disk re-partitions it. All existing partitions are deleted, with a tiny slice on s7 being created to store the metadb replica, and the rest given over to s0. Note that s2 – the usual way of addressing a disk in Solaris – is also removed.

Here’s what the partitions look like on our root disk:

bash-3.00# prtvtoc /dev/dsk/c1t0d0s2
* /dev/dsk/c1t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     107 sectors/track
*      27 tracks/cylinder
*    2889 sectors/cylinder
*   24622 cylinders
*   24620 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00    8389656  23071554  31461209
       1      3    01          0   8389656   8389655
       2      5    00          0  71127180  71127179
       5      7    00   31461210  20974140  52435349
       6      0    00   52435350  18625383  71060732
       7      0    00   71060733     66447  71127179

And here’s what they look like on a LUN that’s part of the metaset:

bash-3.00# prtvtoc /dev/dsk/c7t60060E80141189000001118900001A10d0s0
* /dev/dsk/c7t60060E80141189000001118900001A10d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     512 sectors/track
*      15 tracks/cylinder
*    7680 sectors/cylinder
*   13653 cylinders
*   13651 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      4    00      15360 104824320 104839679
       7      4    01          0     15360     15359

We can query the metaset and have a look at it’s contents, to check everything is OK:


bash-3.00# metaset -s test

Set name = test, Set number = 5

Host Owner
avalon Yes (auto)

Drive Dbase

/dev/dsk/c7t60060E80141189000001118900001A10d0 Yes

/dev/dsk/c7t60060E80141189000001118900001A17d0 Yes

/dev/dsk/c7t60060E80141189000001118900001A18d0 Yes

/dev/dsk/c7t60060E80141189000001118900001A19d0 Yes

Once we’ve populated our metaset, we create metadevices as normal. The only extras we need when using the metainit command is that we need to specify which metaset we’re using, and that we’ll always be using s0.

Let’s create a single metadevice striped across all 4 LUNs in our metaset:

bash-3.00# metainit -s test d100 1 4 /dev/dsk/c7t60060E80141189000001118900001A10d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A17d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A18d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A19d0s0

metainit works in the same way it’s always done – we need to specify the full path to the slice we’re using – but with the additional -s flag to tell metainit which metaset we want to add the metadevice to.

We can use the summary flag to metastat (sorry, Solaris 10 only) to show us the summary of what we’ve just configured:

bash-3.00# metastat -c -s test
dbt/d100     s  199GB /dev/dsk/c7t60060E80141189000001118900001A10d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A17d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A18d0s0 \
/dev/dsk/c7t60060E80141189000001118900001A19d0s0

metasets are an easy way to group together storage and filesystems in Solaris, especially where the storage is external to your host, and you’d like the flexibility of importing it to another host in the future – for example, as part of some DR work if the host fails.

Scripts and Tools Comments Off on Scripts and Tools

This is a collection of scripts and tools developed by us, which are freely available for download.

All scripts and tools are copyright © G.A.E. Ltd
You may distribute under the terms of the GNU General Public License with the exception that it cannot be placed on a CD-ROM or similar media for commercial distribution without the prior approval of the author.
This code is provided with no warranty of any kind, and is used entirely at your own risk.

More tools, FAQs, and information can be found on SiliconBunny, our Silicon Graphics information site.

ods_breakage.ksh

Description: Used on hosts with Solaris Disksuite volume management. The script parses metastat output and checks the status of metadevices. Any errors are collated and a status report is emailed.
Platform: Solaris
Installation: Edit the SYSADMINS variable, changing it to an email address where you want alerts sent.
Usage: Run from cron every hour, takes no command line options
Download: ods_breakage.ksh

ce_settings.ksh

Description: Sun’s Cassini Ethernet (ce) cards are available in either 100mb or 1gb versions. The same driver is used for both. Problems arise because speed and duplex settings cannot be set from within /etc/system. Instead, a configuration file must be used. The syntax is cryptic and prone to mistakes – at the worst case, a poorly written configuration file can cause a kernel panic on bootup. This script will parse /etc/path_to_inst and generate a ce.conf configuration file, forcing 100mb ce cards to 100mb/full duplex, and letting 1gb cards auto-negotiate.
Platform: Solaris
Installation: Copy the script somewhere. Edit the PATH_TO_INST and OUTPUT variables to point to /etc/path_to_inst and where you want your ce.conf to be placed (usually somewhere like /kernel/drv/ce.conf)
Usage: Once the above variables have been set, run the script. A new ce.conf file will be generated, and the settings will take effect the next time the machine is booted.
Download: ce_settings.ksh

mem_dis.ksh

Description: During performance testing on F15k domains, it was required to remove memory from several system boards to gauge relative performance when increasing CPU count, memory, and both together. Rather than physically removing the boards, this script was developed. It uses the Sunfire’s DR to unconfigured memory from selected system boards.
The operation of the script is very simple, and can be used as the basis to automate many DR commands on Sunfire machines.
Platform: Solaris
Installation: Place the script somewhere in a Sunfire domain. Must have root privileges to run.
Usage: Run the script. It will display a listing of memory on system boards, and ask you what you want to disable. Enter the details, and the script calls cfgadm to disable that memory.
Download: mem_dis.ksh

if_check.sh

Description: Before IP MultiPathing (IPMP) came along in Solaris 8, it was difficult to have 2 ethernet interfaces connecting your host to the same LAN in a failover configuration. This script pings a highly-available source (usually your default router or switch) and calls ifconfig to down an interface and up the spare if the ping fails. Your two interfaces should be connected to seperate switches for maximum availability.
Platform: Solaris, ideally pre-8
Installation: Copy the script somewhere, and run from root’s crontab every 5 or 10 minutes, depending on how much of a delay you can handle when an interface fails.
Usage: The script takes one argument, the IP address to ping.
Download: if_check.sh

clone_root_disk.ksh

Description: While IRIX comes with the XLV volume manager, the license to mirror (plex) your volumes is an expensive extra. This script allows you to clone the root disk, creating a bootable spare which is not normally mounted, allowing easy root disk recovery.
Platform: IRIX
Installation: Copy the script somewhere and run from root’s crontab. You may need to edit the disk device names to match your machine’s configuration.
Usage: Run from root’s crontab. The script takes no arguments.
Download: clone_root_disk.ksh

int_check.ksh

Description: Tired of remembering and typing in the ndd variables to check the speed and duplex settings of an ethernet port? This script automates the drudge work – just give it an interface type (hme, ce, bge) and an instance number, and it will tell you how that port is configured.
Platform: Solaris
Installation: Place the script on your host and run as root.
Usage: Run as root. It will take two command line arguments – the interface type, and the instance number.
Download: int_check.ksh

kstat_check.ksh

Description: kstat can return a lot of useful information about the state of your ethernet interfaces. However, the syntax can be confusing and difficult to remember. This script functions as a wrapper around kstat – tell it the interface type and instance number, and it will return configuration details. It’s important to note that older cards, like hme, will return less information than newer cards, like ce. This is due to driver improvements as opposed to deficiencies in kstat.
Platform: Solaris
Installation: Place the script on your host and run as root.
Usage: Run as root. It will take two command line arguments – the interface type, and the instance number.
Download: kstat_check.ksh

split.ksh

Description: This script is an example of what can be done with EMC’s Symcli tools and Symmetrix Business Continuance Volumes (BCVs). In this example, an Oracle database is running on the main Symmetrix disks. The BCVs are mounted on another host, which contains a datawarehouse. The script unmounts the BCV volumes, mirrors them to the main disks, and then splits them off again, remounting them on the host. You then have a hot copy of your live Oracle database which can be imported into your datawarehouse without any impact on the production system.
Note that there are many variables involved (volume types, hosts, Oracle database, etc.) and so this script should be taken as an example of what it is possible to do.
Platform: Solaris host with Veritas Volume Manager, connected to an EMC Symmetrix, with Symcli installed
Installaton and Usage: Don’t! Read the script, understand what it does, and then use that as the basis for your own scripts, customised for your own needs.
Download: split.ksh

Top of page / Subscribe to new Entries (RSS)