Return to Solaris Home Page.


Removing Metadevices - (Using DiskSuite 4.2.1 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 Trans Metadevice
  9. Removing a Hot Spare

Overview

This article provides a comprehensive overview for removing DiskSuite metadevices (stripes, concatenations, mirrors, trans metadevices, and hot spares) using the DiskSuite command-line tools. Most of the information in this article was taken directly from the "Solstice DiskSuite 4.2.1 User's Guide" (Part Number 806-3205-10).

Examining the Disks In Our Example

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

If you followed the examples in the article, "Creating Metadevices - (Using DiskSuite 4.2.1 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/system file is automatically updated with the new information and the /etc/lvm/mddb.cf file is updated.

Removing a Stripe - (RAID 0)

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

The following example unmounts the file system from the metadevice, /d0, and then uses the metaclear command to permanently remove the metadevice from the system. Keep in mind that this example will remove the metadevice /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 metadevice, 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 metadevice was removed:
    # metastat d0
    metastat: alex: d0: unit not set up

Removing a Concatenation - (RAID 0)

The process for removing a Concatenated Metadevice is fairly easy and straightforward. The same method can be used for a striped and RAID 5 metadevice as well.

The following example unmounts the file system from the metadevice, /d1, and then uses the metaclear command to permanently remove the metadevice from the system. Keep in mind that this example will remove the metadevice /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 striped metadevice, 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 striped metadevice was removed. Notice that the d1 metadevice 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 metadevice 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 metadevices that were involved in the mirrored metadevice, 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 metadevice, 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 metadevices from the system. Keep in mind that this example will remove the mirrored metadevice 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 metadevice 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 metadevice 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 metadevice 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 metadevices that were involved in the mirrored metadevice, 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 metadevice 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 metadevice 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 metadevice 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 metadevices that were involved in the mirrored metadevice, 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 metadevice 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 metadevice 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 metadevice 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 metadevices that were involved in the mirrored metadevice, 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 metadevice 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 metadevice 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 Metadevice is fairly easy and straightforward. The same method can be used for a sriped and concatenated metadevice as well.

The following example unmounts the file system from the newly created metadevice, /d3, and then uses the metaclear command to permanently remove the metadevice from the system. Keep in mind that this example will remove the metadevice /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 metadevice, 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 metadevice was removed:
    # metastat d3
    metastat: alex: d3: unit not set up

Removing a Trans Metadevice

When you remove a Trans Metadevice, you remove logging from the appropriate file systems. The underlying data (and possibly a metadevice, if the master consists of one) on the file systems is still preserved, unless you also remove that metadevice or remove the slice.

Any information pertaining to the master device is rolled from the log device prior to removing the trans metadevice.

This section will contain the following two examples for removing Trans Metadevices:

  1. Remove a Trans Metadevice From a File System That Can Be Unmounted
  2. Remove a Trans Metadevice From a File System That Cannot Be Unmounted

Remove a Trans Metadevice From a File System That Can Be Unmounted

  1. For this example, I have a Trans Metadevice named d5 that I want to remove. The Trans Metadevice, d5 was created to log the UFS file system, (master device), /db0. This is a file system that can be unmounted during normal operation. The logging device will be /dev/dsk/c1t0d0s0. Keep in mind that the file system mounted on /db0 is really a stripped metadevice d0. For the purpose of this example, I want to preserve the data in the file system - I only want to remove logging from it.

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

  3. Remove the Trans Metadevice, d5:
    # metaclear d5
    d5: Trans is cleared

  4. Next, remove the entry you made to the /etc/vfstab file for automatically mounting the Trans Metadevice, /dev/md/dsk/d5. In this example, I want to preserve the data that was in the original file system, the stripped metadevice, /dev/md/dsk/d0:
    /dev/md/dsk/d0  /dev/md/rdsk/d0 /db0    ufs     2       yes     -
    # /dev/md/dsk/d5        /dev/md/rdsk/d5 /db0    ufs     2       yes     -

  5. Verify that the Trans Metadevice was removed:
    # metastat d5
    metastat: alex: d5: unit not set up

  6. Run the fsck command. Because the file system is no longer a logging device, you must run fsck before you can mount it. You run fsck either on the raw metadevice or raw device for the slice, depending on the configuration of the master device. Answer y to the following prompt:
    # fsck /dev/md/rdsk/d0
    ** /dev/md/rdsk/d0
    ** Last Mounted on /db0
    ** 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
    
    2 files, 9 used, 25801767 free (15 frags, 3225219 blocks,  0.0% fragmentation)

  7. Mount the original file system:
    # mount /db0

  8. The file system, /db0, is no longer being logged!
Remove a Trans Metadevice From a File System That Cannot Be Unmounted
  1. For this example, I have a Trans Metadevice named d6 that I want to remove. The Trans Metadevice, d6 was created to log the UFS file system, (master device), /usr. This is a file system that cannot be unmounted during normal operation. The logging device will be /dev/dsk/c1t1d0s0. For the purpose of this example, I need to preserve the data in the /usr file system - I only want to remove logging from it.

  2. Detach the Trans Metadevice, d6:
    # metadetach -f d6
    d6: logging device c1t1d0s0 will be detached at unmount or reboot

  3. Reboot the system.
    # reboot
    ...
    The /usr file system (/dev/md/rdsk/d6) is being checked.
    /dev/md/rdsk/d6: 38070 files, 791155 used, 7469602 free
    /dev/md/rdsk/d6: (5058 frags, 933068 blocks,  0.0% fragmentation)
    ...

  4. Next, remove (or comment out) the entry you made to the /etc/vfstab file for automatically mounting the Trans Metadevice, /dev/md/dsk/d6. In this example, I need to preserve the data that was in the original /usr file system bound to /dev/dsk/c0t0d0s6:
    /dev/dsk/c0t0d0s6    /dev/rdsk/c0t0d0s6      /usr    ufs     1       no      -
    # /dev/md/dsk/d6     /dev/md/rdsk/d6   /usr    ufs     1       no      -

  5. Reboot the system again.
    # reboot

  6. Remove the Trans Metadevice d6:
    # metaclear d6
    d6: Trans is cleared

  7. Verify that the Trans Metadevice was removed:
    # metastat d6
    metastat: alex: d6: unit not set up

  8. The file system, /usr, is no longer being logged!

Removing a Hot Spare



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