Return to Solaris Home Page.


Removing Volumes - (Using Solaris 9 Volume Manager Commands)

by Jeff Hunter, Sr. Database Administrator

Contents

  1. Overview
  2. Examining the Disks In Our Example
  3. Removing a State Database Replica
  4. Removing a Stripe - (RAID 0)
  5. Removing a Concatenation - (RAID 0)
  6. Removing Mirrors - (RAID 1)
  7. Removing a RAID5 Volume - (RAID 5)
  8. Removing a Hot Spare

Overview

This article provides a comprehensive overview for removing Volume Manager components (volumes, disk sets, state database replicas, hot spare pools) using the Solaris 9 Volume Manager command-line tools. Most of the information can also be found in the "Solaris 9 Volume Manager Administration Guide" (Part No: 816-4519-10, April 2003).

Examining the Disks In Our Example

This article is all about providing definitions and examples of Volume Manager's command line tools.

If you followed the examples in the article, "Creating Volumes - (Using Solaris 9 Volume Manager Commands)", most of the disk configuration described below should already exist.

For all examples in this document, I will be utilizing a Sun Blade 150 connected to a Sun StorEdge D1000 Disk Array containing twelve 9GB / 10000 RPM / UltraSCSI disk drives for a total disk array capacity of 108GB. The disk array is connected to the Sun Blade 150 using a Dual Differential Ultra/Wide SCSI (X6541A) Host Adapter. In the Sun StorEdge D1000 Disk Array, the system identifies the drives as follows:

Controller 1Controller 2
c1t0d0   -    (d0) c2t0d0   -    (d0)
c1t1d0   -    (d0) c2t1d0   -    (d1)
c1t2d0   -    (d1) c2t2d0   -    (d1)
c1t3d0   -    (d20) c2t3d0   -    (d20)
c1t4d0   -    (d3) c2t4d0   -    (d3)
c1t5d0   -    (d3) c2t5d0   -    (d4)

d0 : RAID 0 - Stripe
d1 : RAID 0 - Concatenation
d20 : RAID 1 - Mirror
d3 : RAID 5
d4 : Hot Spare

Removing a State Database Replica

# metadb -d c2t4d0s7
The -d deletes all replicas that are located on the specified slice. The /etc/lvm/mddb.cf file is automatically updated with the new information.

To remove ALL of the database replica with one command, you will need to use the -f option. The following example will remove all database state replicas from all twelve drives:

# metadb -f -d /dev/dsk/c1t0d0s7 /dev/dsk/c1t1d0s7 /dev/dsk/c1t2d0s7 \
               /dev/dsk/c1t3d0s7 /dev/dsk/c1t4d0s7 /dev/dsk/c1t5d0s7 \
               /dev/dsk/c2t0d0s7 /dev/dsk/c2t1d0s7 /dev/dsk/c2t2d0s7 \
               /dev/dsk/c2t3d0s7 /dev/dsk/c2t4d0s7 /dev/dsk/c2t5d0s7

Removing a Stripe - (RAID 0)

The process for removing a RAID 0 Striped Volume is fairly easy and straightforward. The same method can be used for a concatenated and RAID 5 volumes as well.

The following example unmounts the file system from the mount point, /db0, and then uses the metaclear command to permanently remove the volume from the system. Keep in mind that this example will remove the volume d0 from the system and all data stored on it!

  1. First unmount the file system:
    # umount /db0

  2. Next, remove the entry you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d0 volume:
    /dev/md/dsk/d0       /dev/md/rdsk/d0      /db0  ufs     2       yes     -

  3. Now remove the directory (/db0) that was used to mount the file system:
    # rmdir /db0

  4. Finally, to remove the striped volume, use the metaclear command as follows:
    # metaclear d0
    d0: Concat/Stripe is cleared

  5. You can now use the metastat command to verify that the striped volume was removed:
    # metastat d0
    metastat: alex: d0: unit not set up

Removing a Concatenation - (RAID 0)

The process for removing a Concatenated Volume is fairly easy and straightforward. The same method can be used for a RAID 0 striped or RAID 5 volume as well.

The following example unmounts the file system from the mount point, /db1, and then uses the metaclear command to permanently remove the volume from the system. Keep in mind that this example will remove the volume d1 from the system and all data stored on it!

  1. First unmount the file system:
    # umount /db1

  2. Next, remove the entry you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d1 volume:
    /dev/md/dsk/d1       /dev/md/rdsk/d1      /db1  ufs     2       yes     -

  3. Now remove the directory (/db1) that was used to mount the file system:
    # rmdir /db1

  4. Finally, to remove the concatenated volume, use the metaclear command as follows:
    # metaclear d1
    d1: Concat/Stripe is cleared

  5. You can now use the metastat command to verify that the concatenated volume was removed. Notice that the d1 volume no longer exists:
    # metastat d1
    metastat: alex: d1: unit not set up

Removing a Mirror - (RAID 1)

This section will contain the following four examples for unmirroring / removing mirrors:

  1. Unmirror a File System that Can be Unmounted
  2. Unmirror a File System that Cannot be Unmounted
  3. Unmirror swap
  4. Unmirror root (/)

Unmirror a File System that Can be Unmounted

The process for unmirroring a regular file system (one that can be unmounted) is fairly easy and straightforward.

In this example, I have a two-way mirrored volume named d20. It consists of two submirrors d21 and d22. This two-way mirror was created from an already existing UFS file system mounted on /dev/dsk/c1t3d0s7. For the purpose of this example, I want to unmirror the file system while preserving the data, remove all volumes that were involved in the mirrored volume, and return the file system back to normal to where it existed; mounted on /dev/dsk/c1t3d0s7.

The following example unmounts the file system (/db20) from the mirrored volume, d20. We then need to detach both submirrors (d21 and d22) from the mirror using the metadetach command. Finally, we use the metaclear command to permanently remove all volume components from the system. Keep in mind that this example will remove the mirrored volume d20 (plus the submirrors d21 and d22) but will preserve the data that exists on /dev/dsk/c1t3d0s7 - it just will not be mirrored!

  1. First unmount the file system:
    # umount /db20

  2. Next, remove the entry (or comment it out) you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d20 volume. Then put the entry that mounted the /dev/dsk/c1t3d0s7 slice / file system back in the /etc/vfstab file that mounted it to /db20:
    /dev/dsk/c1t3d0s7       /dev/rdsk/c1t3d0s7      /db20   ufs     2       yes     -
    # /dev/md/dsk/d20       /dev/md/rdsk/d20        /db20   ufs     2       yes     -

  3. Now lets check the mirror (d20) to determine how many submirrors it contains and what their names are:
    # metastat d20
    d20: Mirror
        Submirror 0: d21
          State: Okay
        Submirror 1: d22
          State: Okay
        Pass: 1
        Read option: roundrobin (default)
        Write option: parallel (default)
        Size: 17470215 blocks
    
    d21: Submirror of d20
        State: Okay
        Size: 17470215 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c1t3d0s7                3591     Yes   Okay
    
    
    d22: Submirror of d20
        State: Okay
        Size: 17470215 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c2t3d0s7                3591     Yes   Okay

  4. To remove the mirror volume and submirrors, use the metadetach and metaclear commands as follows:
    # metadetach d20 d22
    d20: submirror d22 is detached
    
    # metadetach d20 d21
    metadetach: alex: d20: attempt to detach last running submirror
    
    # metaclear d22
    d22: Concat/Stripe is cleared
    
    # metaclear d20
    d20: Mirror is cleared
    
    # metaclear d21
    d21: Concat/Stripe is cleared

  5. You can now use the metastat command to verify that the mirrored and contactenated volumes were removed:
    # metastat d20 d21 d22
    metastat: alex: d20: unit not set up
    
    metastat: alex: d21: unit not set up
    
    metastat: alex: d22: unit not set up

  6. You should now be able to mount the file system on /dev/dsk/c1t3d0s7 back to /db20. Keep in mind, that all data has been preserved, but will no longer be mirrored.
    # mount /db20
Unmirror a File System that Cannot be Unmounted
The process for unmirroring a file system (one that cannot be unmounted) is fairly easy and straightforward. Keep in mind that this process can be used for the /usr, /opt, var, and swap file systems.

In this example, I will unmirror the /usr file system. The twist here is that the /usr file system (just like /opt and swap) cannot be unmounted during normal system usage. The /usr file system is currently mounted on a two-way mirrored volume named d20 that consists of two submirrors d21 and d22. Before I created this two-way mirror for the /usr file system, the file system was mounted on the slice /dev/dsk/c0t0d0s6. For the purpose of this example, I want to unmirror the file system while preserving the data for the /usr file system, remove all volumes that were involved in the mirrored volume, and return the file system back to normal to where it existed; mounted on /dev/dsk/c0t0d0s6. The second part of the mirror (submirror2) is /dev/dsk/c2t3d0s7 and will be made available for other uses after it is no longer part of the mirror.

  1. First, run the metastat command to verify that at least one submirror is in the "Okay" state.
    # metastat d20
    d20: Mirror
        Submirror 0: d21
          State: Okay
        Submirror 1: d22
          State: Okay
        Pass: 1
        Read option: roundrobin (default)
        Write option: parallel (default)
        Size: 16781040 blocks
    
    d21: Submirror of d20
        State: Okay
        Size: 16781040 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c0t0d0s6                   0     No    Okay
    
    
    d22: Submirror of d20
        State: Okay
        Size: 17470215 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c2t3d0s7                3591     Yes   Okay

  2. Next, run the metadetach command on the mirror that contains the /usr file system. In this case, I will detach d22 to make a one-way mirror:
    # metadetach d20 d22
    d20: submirror d22 is detached

  3. Next, remove the entry (or comment it out) you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d20 volume. Then put the entry that mounted the /dev/dsk/c0t0d0s6 slice back in the /etc/vfstab file that mounted it to /usr. Keep in mind that this step can be used for /usr, /opt, var, and swap file systems. For the root / file system, you would use the metaroot command.
    /dev/dsk/c0t0d0s6     /dev/rdsk/c0t0d0s6      /usr    ufs     1       no      -
    # /dev/md/dsk/d20 /dev/md/rdsk/d20        /usr    ufs     1       no      -

  4. Reboot the system
    # reboot

  5. To remove the mirror volume and submirrors, use the metaclear command as follows:
    # metaclear -r d20
    d20: Mirror is cleared
    d21: Concat/Stripe is cleared
    
    # metaclear d22
    d22: Concat/Stripe is cleared

  6. You can now use the metastat command to verify that the mirrored and contactenated volume were removed:
    # metastat d20 d21 d22
    metastat: alex: d20: unit not set up
    
    metastat: alex: d21: unit not set up
    
    metastat: alex: d22: unit not set up
Unmirror swap
The process for unmirroring the swap file system (one that cannot be unmounted) is fairly easy and straightforward. Keep in mind that this process can be used for the /usr, /opt, var, and swap file systems.

In this example, I will unmirror the swap file system. The twist here is that the swap file system (just like /opt and /var) cannot be unmounted during normal system usage. The swap file system is currently mounted on a two-way mirrored volume named d20 that consists of two submirrors d21 and d22. Before I created this two-way mirror for the swap file system, the file system was mounted on the slice /dev/dsk/c0t0d0s3. For the purpose of this example, I want to unmirror the swap file system, remove all volumes that were involved in the mirrored volume, and return the file system back to normal to where it existed; mounted on /dev/dsk/c0t0d0s3. The second part of the mirror (submirror2) is /dev/dsk/c2t3d0s7 and will be made available for other uses after it is no longer part of the mirror.

  1. First, run the metastat command to verify that at least one submirror is in the "Okay" state.
    # metastat d20
    d20: Mirror
        Submirror 0: d21
          State: Okay
        Submirror 1: d22
          State: Okay
        Pass: 1
        Read option: roundrobin (default)
        Write option: parallel (default)
        Size: 2101200 blocks
    
    d21: Submirror of d20
        State: Okay
        Size: 2101200 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c0t0d0s3                   0     No    Okay
    
    
    d22: Submirror of d20
        State: Okay
        Size: 17470215 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c2t3d0s7                3591     Yes   Okay

  2. Next, run the metadetach command on the mirror that contains the swap file system. In this case, I will detach d22 to make a one-way mirror:
    # metadetach d20 d22
    d20: submirror d22 is detached

  3. Next, remove the entry (or comment it out) you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d20 volume. Then put the entry that mounted the /dev/dsk/c0t0d0s6 slice back in the /etc/vfstab file that mounted it to /usr. Keep in mind that this step can be used for /usr, /opt, var, and swap file systems. For the root / file system, you would use the metaroot command.
    /dev/dsk/c0t0d0s3       -       -       swap    -       no      -
    # /dev/md/dsk/d20       -       -       swap    -       no      -

  4. Reboot the system
    # reboot

  5. Verify that the swap file system is mounted on the original slice /dev/dsk/c0t0d0s3:
    # swap -l
    swapfile             dev  swaplo blocks   free
    /dev/dsk/c0t0d0s3   136,3      16 2101184 2101184

  6. To remove the mirror volume and submirrors, use the metaclear command as follows:
    # metaclear -r d20
    d20: Mirror is cleared
    d21: Concat/Stripe is cleared
    
    # metaclear d22
    d22: Concat/Stripe is cleared

  7. You can now use the metastat command to verify that the mirrored and contactenated volume were removed:
    # metastat d20 d21 d22
    metastat: alex: d20: unit not set up
    
    metastat: alex: d21: unit not set up
    
    metastat: alex: d22: unit not set up
Unmirror root (/)
The process for unmirroring the root file system (keeping in mind that it cannot be unmounted) is fairly easy and straightforward. Keep in mind that this process is very similar to that used for the /usr, /opt, var, and swap file systems.

In this example, I will unmirror the root (/) file system. The twist here is that the root file system (just like /opt and swap) cannot be unmounted during normal system usage. The root file system is currently mounted on a two-way mirrored volume named d20 that consists of two submirrors d21 and d22. Before I created this two-way mirror for the root file system, the file system was mounted on the slice /dev/dsk/c0t0d0s0. For the purpose of this example, I want to unmirror the file system while preserving the data for the root file system, remove all volumes that were involved in the mirrored volume, and return the file system back to normal to where it existed; mounted on /dev/dsk/c0t0d0s0. The second part of the mirror (submirror2) is /dev/dsk/c0t2d0s0 and will be made available for other uses after it is no longer part of the mirror.

  1. First, run the metastat command to verify that at least one submirror is in the "Okay" state.
    # metastat d20
    d20: Mirror
        Submirror 0: d21
          State: Okay
        Submirror 1: d22
          State: Okay
        Pass: 1
        Read option: roundrobin (default)
        Write option: parallel (default)
        Size: 4198320 blocks
    
    d21: Submirror of d20
        State: Okay
        Size: 4198320 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c0t0d0s0                   0     No    Okay
    
    
    d22: Submirror of d20
        State: Okay
        Size: 10489680 blocks
        Stripe 0:
            Device              Start Block  Dbase State        Hot Spare
            c0t2d0s0                   0     No    Okay

  2. Next, run the metadetach command on the mirror that contains the root file system. In this case, I will detach d22 to make a one-way mirror:
    # metadetach d20 d22
    d20: submirror d22 is detached

  3. The metaroot command is then run, using the rootslice that the system is going to boot from. This edits the /etc/system and /etc/vfstab files to remove information specifying the mirroring of root (/):
    # metaroot /dev/dsk/c0t0d0s0

  4. Reboot the system
    # reboot

  5. To remove the mirror volume and submirrors, use the metaclear command as follows:
    # metaclear -r d20
    d20: Mirror is cleared
    d21: Concat/Stripe is cleared
    
    # metaclear d22
    d22: Concat/Stripe is cleared

  6. You can now use the metastat command to verify that the mirrored and contactenated volume were removed:
    # metastat d20 d21 d22
    metastat: alex: d20: unit not set up
    
    metastat: alex: d21: unit not set up
    
    metastat: alex: d22: unit not set up

Removing a RAID5 Volume - (RAID 5)

The process for removing a RAID5 Volume is fairly easy and straightforward. The same method can be used for a sriped and concatenated volume as well.

The following example unmounts the file system from the newly created volume, /d3, and then uses the metaclear command to permanently remove the volume from the system. Keep in mind that this example will remove the volume /d3 from the system and all data stored on it!

  1. First unmount the file system:
    # umount /db3

  2. Next, remove the entry you made to the /etc/vfstab file for automatically mounting the /dev/md/dsk/d0 volume:
    /dev/md/dsk/d3       /dev/md/rdsk/d3      /db3  ufs     2       yes     -

  3. Now remove the directory (/db3) that was used to mount the file system:
    # rmdir /db3

  4. Finally, to remove the RAID5 volume, use the metaclear command as follows:
    # metaclear d3
    d3: RAID is cleared

  5. You can now use the metastat command to verify that the RAID5 volume was removed:
    # metastat d3
    metastat: alex: d3: unit not set up

Removing a Hot Spare



Last modified on: Saturday, 18-Sep-2010 18:23:37 EDT
Page Count: 77181