Solaris Volume Manager Administration Guide

Maintaining Transactional Volumes

How to Check the State of Transactional Volumes

    To check the status of a transactional volume, use one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then view the status of the volumes. Right-click a transactional volume and choose Properties for more detailed status information. For more information, see the online help.

    • Use the metastat command.

      For more information, see the metastat(1M) man page.

Example—Checking the Status of Transactional Volumes

Here is sample transactional volume output from the metastat command:


# metastat
d20: Trans
    State: Okay        
    Size: 102816 blocks
    Master Device: c0t3d0s4
    Logging Device: c0t2d0s3
 
        Master Device       Start Block  Dbase
        c0t3d0s4                   0     No  
 
c0t2d0s3: Logging device for d0
    State: Okay        
    Size: 5350 blocks
 
        Logging Device      Start Block  Dbase
        c0t2d0s3                 250     No 

The metastat command also shows master devices and log devices. For each device, the following information is displayed:

The following table explains transactional volume states and possible actions to take.

Table 18–1 Transactional Volume States

State 

Meaning 

Action 

Okay 

The device is functioning properly. If mounted, the file system is logging and will not be checked at boot. 

None. 

Attaching 

The log device will be attached to the transactional volume when the volume is closed or unmounted. When this occurs, the device transitions to the Okay state. 

None.  

Detached 

The transactional volume does not have a log device. All benefits from UFS logging are disabled. 

The fsck command automatically checks the device at boot time. See the fsck(1M) man page.

Detaching 

The log device will be detached from the transactional volume when the volume is closed or unmounted. When this occurs, the device transitions to the Detached state. 

None. 

Hard Error 

A device error or panic has occurred while the device was in use. An I/O error is returned for every read or write until the device is closed or unmounted. The first open causes the device to transition to the Error state. 

Fix the transactional volume. See How to Recover a Transactional Volume With a Panic, or How to Recover a Transactional Volume With Hard Errors.

Error 

The device can be read and written to. The file system can be mounted read-only. However, an I/O error is returned for every read or write that actually gets a device error. The device does not transition back to the Hard Error state, even when a later device error occurs. 

Fix the transactional volume. See How to Recover a Transactional Volume With a Panic, or How to Recover a Transactional Volume With Hard Errors. Successfully completing the fsck or newfs commands transitions the device into the Okay state. When the device is in the Hard Error or Error state, the fsck command automatically checks and repairs the file system at boot time. The newfs command destroys whatever data might be on the device.

How to Attach a Log Device to a Transactional Volume

  1. Check Prerequisites for Creating Solaris Volume Manager Elements and Background Information for Transactional Volumes.

  2. Unmount the UFS file system for which you want to enable logging.

  3. Attach a log device to the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Properties. For more information, see the online help.

    • Use the following form of the metattach command:


      metattach master-volume logging-volume 
      

      master-volume is the name of the transactional volume that contains the file system to be logged.

      logging-volume is the name of the volume or slice that should contain the log.

      See the metattach(1M) man page for more information.


    # metattach d1 d23
    
  4. Remount the file system.

Example—Attaching a Log Device to a Transactional Volume

This example shows a log device, the slice (c1t1d0s1), being attached to the transactional volume d1, which is mounted on /fs2.


# umount /fs2
# metattach d1 c1t1d0s1
d1: log device d0c1t1d0s1 is attached
# mount /fs2

How to Detach a Log Device from a Transactional Volume

  1. Check Prerequisites for Creating Solaris Volume Manager Elements and Background Information for Transactional Volumes.

  2. Unmount the UFS file system for which you want to disable logging or change the log device.

  3. Detach the log device from the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Properties. For more information, see the online help.

    • Use the following form of the metadetach command:


      metadetach master-volume 
      

      master-volume is the name of the transactional volume that contains the file system that is being logged.

      See the metadetach(1M) man page for more information.

  4. Remount the file system.

Example—Detaching a Log Device from a Transactional Volume

This example show a log device, the slice (c1t1d0s1), being detached from the transactional volume d1, which is mounted on /fs2.


# umount /fs2
# metadetach d1
d1: log device c1t1d0s1 is detached
# mount /fs2

How to Expand a Transactional Volume


Note –

You can expand a master device within a transactional volume only when the master device is a volume (RAID 0, RAID 1, or RAID 5).


  1. Check Prerequisites for Creating Solaris Volume Manager Elements and Background Information for Transactional Volumes.

  2. If the master device is a volume (rather than a basic slice), attach additional slices to the master device by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Properties, then the Components panel. For more information, see the online help.

    • Use the following form of the metattach command:


      metattach master-volume component
      

      master-volume is the name of the transactional volume that contains the file system to be logged.

      component is the name of the volume or slice that should be attached.

      See the metattach(1M) man page for more information.


      Note –

      If the master device is a mirror, you need to attach additional slices to each submirror.


  3. If the master device is a slice, you cannot expand it directly. Instead, you must do the following:

    • Clear the existing transactional volume.

    • Put the master device's slice into a volume.

    • Recreate the transactional volume.

    Once you have completed this process, you can expand the master device as explained in the previous steps of this procedure.

Example—Expanding a RAID 1 Master Device Within a Transactional Volume


# metastat d10
d10: Trans
    State: Okay        
    Size: 102816 blocks
    Master Device: d0
    Logging Device: d1
d0: Mirror
    Submirror 0: d11
      State: Okay
...
    Submirror 1: d12
      State: Okay        
...
# metattach d11 c0t2d0s5
d11: component is attached
# metattach d12 c0t3d0s5
d12: component is attached

This example shows the expansion of a transactional device, d10, whose master device consists of a two-way RAID 1 volume, d0, which contains two submirrors, d11 and d12. The metattach command is run on each submirror. The system confirms that each slice was attached.

Where to Go From Here

For a UFS, run the growfs command on the transactional volume (not the master device). See How to Grow a File System.

An application, such as a database, that uses the raw volume must have its own way of growing the added space.

How to Remove a Transactional Volume

  1. Check Prerequisites for Creating Solaris Volume Manager Elements and Background Information for Transactional Volumes.

  2. Unmount the UFS file system for which you want to remove the transactional volume and disable logging.


    # umount /filesystem
    
  3. Detach the log device from the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Properties. For more information, see the online help.

    • Use the following form of the metadetach command:


      metadetach master-volume 
      

      master-volume is the name of the transactional volume that contains the file system that is being logged.

      See the metadetach(1M) man page for more information.

  4. Remove (clear) the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Delete. For more information, see the online help.

    • Use the following form of the metaclear command:


      metaclear master-volume  
      

      See the metaclear(1M) man page for more information.

  5. If necessary, update /etc/vfstab to mount the underlying volume, rather than the transactional volume you just cleared.

  6. Remount the file system.

Example—Removing a Transactional Volume

This example shows the removal of a transactional volume d1, which was mounted on /fs2. The underlying slice, c1t1d0s1, is mounted directly after this procedure.


# umount /fs2
# metadetach d1
d1: log device d2 is detached
# metaclear d1 
d1: Trans is cleared

( Edit /etc/vfstab to update mount point for /fs2 to mount on c1t1d0s1, not d1)
# mount /fs2

How to Remove a Transactional Volume and Retain the Mount Device

This procedure works only for situations in which the transactional volume and the underlying device are both Solaris Volume Manager logical volumes.

  1. Check Prerequisites for Creating Solaris Volume Manager Elements and Background Information for Transactional Volumes.

  2. Unmount the UFS file system for which you want to remove the transactional volume and disable logging.

  3. Detach the log device from the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Properties. For more information, see the online help.

    • Use the following form of the metadetach command:


      metadetach master-volume 
      

      master-volume is the name of the transactional volume that contains the file system that is being logged.

      See the metadetach(1M) man page for more information.

  4. Exchange the name of the transactional volume with that of the master device.

  5. Remove (clear) the transactional volume by using one of the following methods:

    • From the Enhanced Storage tool within the Solaris Management Console, open the Volumes node, then choose the transactional volume from the listing. Right-click the volume, and choose Delete. For more information, see the online help.

    • Use the following form of the metaclear command:


      metaclear master-volume  
      

      See the metaclear(1M) man page for more information.

  6. Run the fsck command on the master device.

    When asked whether to fix the file system's state in the superblock, respond y.

  7. Remount the file system.

Example—Removing a Transactional Volume While Retaining the Mount Device

This example begins with a transactional volume, d1, that contains a mounted file system, and ends up with a file system that is mounted on the transactional volume`s underlying master device, which will be d1.


# metastat d1
d1: Trans
    State: Okay        
    Size: 5600 blocks
    Master Device: d21
    Logging Device: d0
 
d21: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay        
...
 
d0: Logging device for d1
    State: Okay        
    Size: 5350 blocks
# umount /fs2
# metadetach d1
d1: log device d0 is detached
# metarename -f -x d1 d21
d1 and d21 have exchanged identities
# metastat d21
d21: Trans
    State: Detached    
    Size: 5600 blocks
    Master Device: d1
 
d1: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay
# metaclear 21
# fsck /dev/md/dsk/d1
** /dev/md/dsk/d1
** Last Mounted on /fs2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
 
FILE SYSTEM STATE IN SUPERBLOCK IS WRONG; FIX? y
 
3 files, 10 used, 2493 free (13 frags, 310 blocks, 0.5%
fragmentation)
# mount /fs2

The metastat command confirms that the transactional volume, d1, is in the “Okay” state. The file system is unmounted before detaching the transactional volume's log device. The transactional volume and its mirrored master device are exchanged by using the -f (force) flag. Running the metastat command again confirms that the exchange occurred. The transactional volume and the log device (if desired) are cleared, in this case, d21 and d0, respectively. Next, the fsck command is run on the mirror, d1, and the prompt is answered with a y. After the fsck command is done, the file system is remounted. Note that because the mount device for /fs2 did not change, the /etc/vfstab file does not require editing.