Cookbooks


Volume Manager Initialization

The vxinstall utility provides a menu driven interface to configure VERITAS Volume Manager (VxVM). If you install the VERITAS Volume Manager software package using the operating system's package administration commands, you can run vxinstall to configure VxVM for initial use on your system

 # vxinstall
  VxVM uses license keys to control access.  If you have a SPARCstorage
  Array (SSA) controller or a Sun Enterprise Network Array (SENA) controller
  attached to your system, then VxVM will grant you a limited use license
  automatically.  The SSA and/or SENA license grants you unrestricted use
  of disks attached to an SSA or SENA controller, but disallows striping,
  RAID-5, and DMP on non-SSA and non-SENA disks.  If you are not running an
  SSA or SENA controller, then you must obtain a license key to operate.

  Licensing information:
    System host ID: 80f7cd50
    Host type: SUNW,Ultra-80
    SPARCstorage Array or Sun Enterprise Network Array: No arrays found
  No valid licenses found.

  VM lite/full license(s) is needed to proceed with vxinstall.
  See VERITAS Volume Manager Installation Guide for more details
  on obtaining and installing the license keys.

Are you prepared to enter a license key [y,n,q] (default: y)

VERITAS License Manager vxlicinst utility version 3.02.005
Copyright (C) 1996-2004 VERITAS Software Corp. All Rights reserved.

Enter your license key : xxxx-xxxx-xxxx-xxxx-xxxx-xxxx

License key successfully installed for VERITAS Storage Foundation Standard
License key successfully installed for VERITAS Volume Manager
License key successfully installed for VERITAS File System
License key successfully installed for VERITAS SANPoint Control

Do you wish to enter another license key [y,n,q] (default: n) n

Do you want to use enclosure based names for all disks ?
[y,n,q,?] (default: n)

    Starting the cache deamon, vxcached.

Do you want to setup a system wide default disk group?
[y,n,q,?] (default: y)

Which disk group [<group>,list,q,?] list

NAME STATE ID

Which disk group [<group>,list,q,?] defdg

  The installation is successfully completed.


Cook-book to create a RAID5 Volume using vxmake

Scenario: We have 3 vmdisks named disk01, disk02 and disk03. We have to create a RAID5 volume with 2 column and a stripe width of 32k. Raid 5 layout will have 2 plexes in it. One for striping and the another one for the log. So we have to create two plexes.

01. Create 3 subdisks called disk01-02, disk02-02, disk03-02 (2 column & 1 log)

  # vxmake sd disk01-02 disk01,500000,100m
  # vxmake sd disk02-02 disk02,500000,100m
  # vxmake sd disk03-02 disk03,500000,100m

02. Create a plex called raidplex with 2 subdisks for striping

 # vxmake plex  raidplex  layout=raid5 stwidth=32 ncolumn=2 sd=disk01-02,disk02-01

03. Create one more plex called logplex with one subdisk for log

 # vxmake plex logplex  sd=disk03-02

04. Create a volume raidvol associating both plexes. Make sure the usage type is raid5

 # vxmake -U raid5 vol raidvol plex=raidplex,logplex

05. Initialize the RAID5 volume

 # vxvol start raidvol  (If facing any problem, ten initialize with b option)
 # vxvol init zero reaidvol

06. Building a VxFS Filesystem:

 # /usr/lib/fs/vxfs/mkfs -F vxfs -o largefiles /dev/vx/rdsk/exampledg/vol01
 version 4 layout
 35363560 sectors, 4420445 blocks of size 4096, log size 256 blocks
 unlimited inodes, largefiles supported
 4420445 data blocks, 4419853 free data blocks
 135 allocation units of 32768 blocks, 32768 data blocks
 last allocation unit has 29533 data blocks

07. To fsck the Vxfs file system

 # fsck -F vxfs -o full,nolog /dev/vx/rdsk/exampledg/vol01


Unencapsulating Your Root Disk

There are two methods for this. The preferable choice is to use the command "vxunroot". If you can�t do this for some reason, or you need to repair a system that has crashed, you can manually un-encapsulate the disk using the following steps:

1. Boot off the cdrom

 # boot cdrom -sw

2. Mount the root file system. Your root slice could be different.

 # mount /dev/dsk/c0t0d0s0 /a

3. Edit /a/etc/system
Using "*" comment out the lines between VXVM BEGIN and VXVM END
NOTE: There might be a file /a/etc/system.prevm That could be used. The lines look like the following:

 *rootdev:/pseudo/vxio@0:0
 *set vxio:vol_rootdev_is_volume=1

4. Edit /a/etc/vfstab
Need to comment out the line that references the Volume Manager volumes.
NOTE: There might be a file /a/etc/vfstab.prevm

4a. Using the information in the vfstab file change the root device to system root disk. ie.

 /dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -

There are lines within the vfstab starting with "NOTE:" that indicates the original boot device. Use this information to recreate the original vfstab file. There are line similar to this:

 #NOTE: volume rootvol (/) encapsulated partition c0t0d0s0

4b. Do the same thing for the other encapsulated volumes (ie. /usr , /opt, ..etc)

5. If the install-db file exists, the VxVM daemons will not start on bootup:

 # touch /a/etc/vx/reconfig.d/state.d/install-db

6. The root-done file indicates that the root disk has been encapsulated. Remove it now:

 # rm /a/etc/vx/reconfig.d/state.d/root-done 

7. Unmount /a, and reboot.

Replacing a failed boot device

01. Boot the system from the mirror device "vx-rootmirror":

 ok boot vx-rootmirror

02. Check extent of failures. Logs into the system and checks the status of the system. Note that the device c0t0d0s2 is listed as "failed", and the all plexes on that device are listed as DISABLED/NODEVICE".

 # vxdisk list
 DEVICE       TYPE      DISK         GROUP        STATUS
 c0t1d0s2     sliced    rootmirror   rootdg       online
 -            -         rootdisk     rootdg       failed was:c0t0d0s2

 # vxprint -ht
 Disk group: rootdg

 dg rootdg       default      default  0        1035555399.1025.pegasus

 dm rootdisk     -            -        -        -        NODEVICE
 dm rootmirror   c0t1d0s2     sliced   3359     17690400 -

 v  rootvol      -            ENABLED  ACTIVE   13423200 ROUND     -        root
 pl rootvol-01   rootvol      DISABLED NODEVICE 13423200 CONCAT    -        RW
 sd rootdisk-B0  rootvol-01   rootdisk 17690399 1        0         -        NDEV
 sd rootdisk-02  rootvol-01   rootdisk 0        13423199 1         -        NDEV
 pl rootvol-02   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
 sd rootmirror-01 rootvol-02  rootmirror 0      13423200 0         c0t1d0   ENA

 v  swapvol      -            ENABLED  ACTIVE   2100000  ROUND     -        swap
 pl swapvol-01   swapvol      DISABLED NODEVICE 2100000  CONCAT    -        WO
 sd rootdisk-01  swapvol-01   rootdisk 13423199 2100000  0         -        NDEV
 pl swapvol-02   swapvol      ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-02 swapvol-02  rootmirror 13423200 2100000 0        c0t1d0   ENA

 v  var          -            ENABLED  ACTIVE   2100000  ROUND     -        fsgen
 pl var-01       var          DISABLED NODEVICE 2100000  CONCAT    -        WO
 sd rootdisk-03  var-01       rootdisk 15523199 2100000  0         -        NDEV
 pl var-02       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-03 var-02      rootmirror 15523200 2100000 0        c0t1d0   ENA

03. Replace failed disk and restore redundancy. The administrator replaces the failed disk with a new disk of the same geometry. Depending on the system model, the disk replacement may require that the system be powered down. Once the operating system can "see" the new disk c0t0d0 via the format command, the administrator tells Veritas volume manager to rescan the system via the "vxdctl enable" command.

 # vxdctl enable

 # vxdisk list
 DEVICE       TYPE      DISK         GROUP        STATUS
 c0t0d0s2     sliced    -            -            error
 c0t1d0s2     sliced    rootmirror   rootdg       online
 -            -         rootdisk     rootdg       failed was:c0t0d0s2

Now the administrator can make use of "vxdiskadm" to manage the process of replacing the boot disk volumes.

 # vxdiskadm

 Volume Manager Support Operations
 Menu: VolumeManager/Disk

  1      Add or initialize one or more disks
  2      Encapsulate one or more disks
  3      Remove a disk
  4      Remove a disk for replacement
  5      Replace a failed or removed disk
  6      Mirror volumes on a disk
  7      Move volumes from a disk
  .........
  .........
 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

 Select an operation to perform: 4


 Remove a disk for replacement
 Menu: VolumeManager/Disk/RemoveForReplace

  Use this menu operation to remove a physical disk from a disk
  group, while retaining the disk name.  This changes the state
  for the disk name to a "removed" disk.  If there are any
  initialized disks that are not part of a disk group, you will be
  given the option of using one of these disks as a replacement.

 Enter disk name [<disk>,list,q,?] list

 Disk group: rootdg

  DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

  dm rootdisk     -            -        -        -        NODEVICE
  dm rootmirror   c0t1d0s2     sliced   3359     17690400 -

 Enter disk name [<disk>,list,q,?] rootdisk

   The following volumes will lose mirrors as a result of this
   operation:

        rootvol swapvol var

   No data on these volumes will be lost.

   The requested operation is to remove disk rootdisk from disk group
   rootdg.  The disk name will be kept, along with any volumes using
   the disk, allowing replacement of the disk.

   Select "Replace a failed or removed disk" from the main menu
   when you wish to replace the disk.

 Continue with operation? [y,n,q,?] (default: y) y

   Removal of disk rootdisk completed successfully.

 Remove another disk? [y,n,q,?] (default: n) n

 Volume Manager Support Operations
 Menu: VolumeManager/Disk

 Volume Manager Support Operations
 Menu: VolumeManager/Disk

  1      Add or initialize one or more disks
  2      Encapsulate one or more disks
  3      Remove a disk
  4      Remove a disk for replacement
  5      Replace a failed or removed disk
  6      Mirror volumes on a disk
  7      Move volumes from a disk
  .........
  .........

 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

 Select an operation to perform: 5


 Replace a failed or removed disk
 Menu: VolumeManager/Disk/ReplaceDisk

   Use this menu operation to specify a replacement disk for a disk
   that you removed with the "Remove a disk for replacement" menu
   operation, or that failed during use.  You will be prompted for
   a disk name to replace and a disk device to use as a replacement.
   You can choose an uninitialized disk, in which case the disk will
   be initialized, or you can choose a disk that you have already
   initialized using the Add or initialize a disk menu operation.

 Select a removed or failed disk [<disk>,list,q,?] list

 Disk group: rootdg

 DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

 dm rootdisk     -            -        -        -        REMOVED


 Select a removed or failed disk [<disk>,list,q,?] rootdisk

 Select disk device to initialize [<address>,list,q,?] list

 DEVICE       DISK         GROUP        STATUS
 c0t0d0       -            -            error
 c0t1d0       rootmirror   rootdg       online

 Select disk device to initialize [<address>,list,q,?] c0t0d0

   The following disk device has a valid VTOC, but does not appear to have
   been initialized for the Volume Manager.  If there is data on the disk
   that should NOT be destroyed you should encapsulate the existing disk
   partitions as volumes instead of adding the disk as a new disk.
   Output format: [Device_Name]

   c0t0d0

 Encapsulate this device? [y,n,q,?] (default: y) n

   c0t0d0

 Instead of encapsulating, initialize? [y,n,q,?] (default: n) y

   The requested operation is to initialize disk device c0t0d0 and
   to then use that device to replace the removed or failed disk
   rootdisk in disk group rootdg.

 Continue with operation? [y,n,q,?] (default: y) 

   Replacement of disk rootdisk in group rootdg with disk device
   c0t0d0 completed successfully.

 Replace another disk? [y,n,q,?] (default: n) n

Now quit from the vxdiskadm. Having replaced the disk in Veritas volume manager, the disk device is now listed as "online", and VxVM is in the process of attaching the replacement plexes to the original volumes.

 # vxdisk list
 DEVICE       TYPE      DISK         GROUP        STATUS
 c0t0d0s2     sliced    rootdisk     rootdg       online
 c0t1d0s2     sliced    rootmirror   rootdg       online

 # vxprint -ht
 dg rootdg       default      default  0        1035555399.1025.pegasus

 dm rootdisk     c0t0d0s2     sliced   3359     17690400 -
 dm rootmirror   c0t1d0s2     sliced   3359     17690400 -

 v  rootvol      -            ENABLED  ACTIVE   13423200 ROUND     -        root
 pl rootvol-01   rootvol      ENABLED  STALE    13423200 CONCAT    -        WO
 sd rootdisk-05  rootvol-01   rootdisk 2100000  13423200 0         c0t0d0   ENA
 pl rootvol-02   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
 sd rootmirror-01 rootvol-02  rootmirror 0      13423200 0         c0t1d0   ENA

 v  swapvol      -            ENABLED  ACTIVE   2100000  ROUND     -        swap
 pl swapvol-01   swapvol      DISABLED RECOVER  2100000  CONCAT    -        WO
 sd rootdisk-06  swapvol-01   rootdisk 15523200 2100000  0         c0t0d0   ENA
 pl swapvol-02   swapvol      ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-02 swapvol-02  rootmirror 13423200 2100000 0        c0t1d0   ENA

 v  var          -            ENABLED  ACTIVE   2100000  ROUND     -        fsgen
 pl var-01       var          DISABLED RECOVER  2100000  CONCAT    -        WO
 sd rootdisk-04  var-01       rootdisk 0        2100000  0         c0t0d0   ENA
 pl var-02       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-03 var-02      rootmirror 15523200 2100000 0        c0t1d0   ENA

 # vxtask list
 TASKID  PTID TYPE/STATE    PCT   PROGRESS
    161           PARENT/R  0.00% 3/0(1) VXRECOVER rootdisk
    162   162     ATCOPY/R 01.22% 0/13423200/163680 PLXATT rootvol rootvol-01

After about an hour, all of the plexes have been synchronized, and full operating system redundancy has been restored:

 # vxtask list
 TASKID  PTID TYPE/STATE    PCT   PROGRESS

 # vxprint -ht
 Disk group: rootdg

 dg rootdg       default      default  0        1035555399.1025.pegasus

 dm rootdisk     c0t0d0s2     sliced   3359     17690400 -
 dm rootmirror   c0t1d0s2     sliced   3359     17690400 -

 v  rootvol      -            ENABLED  ACTIVE   13423200 ROUND     -        root
 pl rootvol-01   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
 sd rootdisk-05  rootvol-01   rootdisk 2100000  13423200 0         c0t0d0   ENA
 pl rootvol-02   rootvol      ENABLED  ACTIVE   13423200 CONCAT    -        RW
 sd rootmirror-01 rootvol-02  rootmirror 0      13423200 0         c0t1d0   ENA

 v  swapvol      -            ENABLED  ACTIVE   2100000  ROUND     -        swap
 pl swapvol-01   swapvol      ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootdisk-06  swapvol-01   rootdisk 15523200 2100000  0         c0t0d0   ENA
 pl swapvol-02   swapvol      ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-02 swapvol-02  rootmirror 13423200 2100000 0        c0t1d0   ENA

 v  var          -            ENABLED  ACTIVE   2100000  ROUND     -        fsgen
 pl var-01       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootdisk-04  var-01       rootdisk 0        2100000  0         c0t0d0   ENA
 pl var-02       var          ENABLED  ACTIVE   2100000  CONCAT    -        RW
 sd rootmirror-03 var-02      rootmirror 15523200 2100000 0        c0t1d0   ENA