Thursday, August 29, 2013

How to remove the last disk in a disk group and use it in another disk group in VERITAS Volume Manager 2.x

In order to remove the last disk in a disk group to be used in another disk group, the volumes must first be removed. 

NOTE: The procedure outlined will result in data loss on the disk that is being removed.   

# vxprint -g datadg -ht
DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg datadg       default      default  122000   955057397.1251.kt

dm datadg01     c1t11d0s2    sliced   1089     8921650  -

v  datavol      fsgen        ENABLED  ACTIVE   2097152  SELECT    -
pl datavol-01   datavol      ENABLED  ACTIVE   2097160  CONCAT    -        RW
sd datadg01-01  datavol-01   datadg01 0        2097160  0         c1t11d0  ENA

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    test04       testdg       online
c1t9d0s2     sliced    test01       testdg       online
c1t10d0s2    sliced    test02       testdg       online
c1t11d0s2    sliced    datadg01     datadg       online

# vxedit -g datadg -rf rm datavol

# vxprint -g datadg -ht
DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg datadg       default      default  122000   955057397.1251.kt

dm datadg01     c1t11d0s2    sliced   1089     8921650  -

NOTE: Trying to remove the disk at this point will result in an error since it is the last disk in the disk group.

# 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
8      Enable access to (import) a disk group
9      Remove access to (deport) a disk group
10     Enable (online) a disk device
11     Disable (offline) a disk device
12     Mark a disk as a spare for a disk group
13     Turn off the spare flag on a disk
list   List disk information


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

Select an operation to perform: 3

Remove a disk
Menu: VolumeManager/Disk/RemoveDisk

Use this operation to remove a disk from a disk group. This operation takes a disk name as input. This is the same name that was given to the disk when the disk was added to the disk group.

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

Disk group: rootdg

DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

dm rootdisk     c0t0d0s2     sliced   2015     16839647 -

Disk group: datadg

DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

dm datadg01     c1t11d0s2    sliced   1089     8921650  -

Disk group: testdg

DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE

dm test01       c1t9d0s2     sliced   1089     8921650  -
dm test02       c1t10d0s2    sliced   1089     8921650  -
dm test04       c1t8d0s2     sliced   1089     8921650  -

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

Disk datadg01 cannot be removed from disk group datadg because it is the last disk in the disk group. It is advisable to remove the disk group instead. To remove the disk group, quit this operation and select "Disable access to (deport) a disk group" from the main disk operations menu.

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

So, in order to remove the disk from the disk group to be used by another disk group, access to the diskgroup must be disabled.  (The disk group must be deported.)

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
8      Enable access to (import) a disk group
9      Remove access to (deport) a disk group
10     Enable (online) a disk device
11     Disable (offline) a disk device
12     Mark a disk as a spare for a disk group
13     Turn off the spare flag on a disk
list   List disk information


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

Select an operation to perform: 9

Remove access to (deport) a disk group Menu: VolumeManager/Disk/DeportDiskGroup

Use this menu operation to remove access to a disk group that is currently enabled (imported) by this system. Deport a disk group to move the disks in a disk group to another system. Also, deport a disk group to use all of the disks remaining in a disk group.

A prompt will ask for the name of a disk group. It will also ask if the disks should be disabled (offlined). For removable disk devices on some systems, it is important to disable all access to the disk before removing the disk.

Enter name of disk group [<group>,list,q,?] (default: list) list

GROUP        DISK/VOLUME         DEVICE/STATE LENGTH

datadg       disk   datadg01     c1t11d0s2    8921650

testdg       disk   test01       c1t9d0s2     8921650
testdg       disk   test02       c1t10d0s2    8921650
testdg       disk   test04       c1t8d0s2     8921650
testdg       volume testvol      ENABLED      2097160
testdg       volume vol01        ENABLED      2097152


Enter name of disk group [<group>,list,q,?] (default: list) datadg

The requested operation is to disable access to the removable disk group named datadg. This disk group is stored on the following disks:

       datadg01 on device c1t11d0s2

Access to these disks can be disabled (also known as "offline"). This may be necessary to prevent errors if any of the disks are actually removed from the system.

Disable (offline) the indicated disks? [y,n,q,?] (default: n) y

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

Removal of disk group datadg was successful.

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

# vxprint -ht
Disk group: rootdg

DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg rootdg       default      default  0        936308190.1025.dot

dm rootdisk     c0t0d0s2     sliced   2015     16839647 -

sd rootdiskPriv -            rootdisk 16536240 2015     PRIVATE   c0t0d0   ENA

v  rootvol      root         ENABLED  ACTIVE   16536240 ROUND     -
pl rootvol-01   rootvol      ENABLED  ACTIVE   16536240 CONCAT    -        RW
sd rootdisk-B0  rootvol-01   rootdisk 16536239 1        0         c0t0d0   ENA
sd rootdisk-02  rootvol-01   rootdisk 0        16536239 1         c0t0d0   ENA

v  swapvol      swap         ENABLED  ACTIVE   301392   ROUND     -
pl swapvol-01   swapvol      ENABLED  ACTIVE   301392   CONCAT    -        RW
sd rootdisk-01  swapvol-01   rootdisk 16538255 301392   0         c0t0d0   ENA

Disk group: testdg

DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX

PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg testdg       default      default  10000    952101973.1171.kt

dm test01       c1t9d0s2     sliced   1089     8921650  -
dm test02       c1t10d0s2    sliced   1089     8921650  -
dm test04       c1t8d0s2     sliced   1089     8921650  -

v  testvol      fsgen        ENABLED  ACTIVE   2097160  SELECT    -
pl vol01-02     testvol      ENABLED  ACTIVE   2097160  CONCAT    -        RW
sd test01-01    vol01-02     test01   0        2097160  0         c1t9d0   ENA

v  vol01        fsgen        ENABLED  ACTIVE   2097152  SELECT    -
pl vol01-01     vol01        ENABLED  ACTIVE   2097160  CONCAT    -        RW
sd test04-01    vol01-01     test04   0        2097160  0         c1t8d0   ENA

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    test04       testdg       online
c1t9d0s2     sliced    test01       testdg       online
c1t10d0s2    sliced    test02       testdg       online
c1t11d0s2    sliced    -            -            offline

The disk can now be used in another disk group as follows:

# 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
8      Enable access to (import) a disk group
9      Remove access to (deport) a disk group
10     Enable (online) a disk device
11     Disable (offline) a disk device
12     Mark a disk as a spare for a disk group
13     Turn off the spare flag on a disk
list   List disk information


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

Select an operation to perform: 1

Add or initialize disks
Menu: VolumeManager/Disk/AddDisks

Use this operation to add one or more disks to a disk group. It is possible to add the selected disks to an existing disk group or to a new disk group that will be created as a part of the operation. The selected disks may also be added to a disk group as spares. The selected disks may also be initialized without adding them to a disk group leaving the disks available for use as replacement disks.

More than one disk or pattern may be entered at the prompt. Here are some disk selection examples:

 all:          all disks
 c3 c4t2:      all disks on both controller 3 and controller 4, target 2
 c3t4d2:       a single disk

Select disk devices to add:                                          
[<pattern-list>,all,list,q,?] list

DEVICE       DISK         GROUP        STATUS
c0t0d0       rootdisk     rootdg       online
c1t8d0       test04       testdg       online
c1t9d0       test01       testdg       online
c1t10d0      test02       testdg       online
c1t11d0      -            -            offline

Select disk devices to add:                                          
[<pattern-list>,all,list,q,?] c1t11d0

Here is the disk selected.  Output format: [Device_Name]

 c1t11d0

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

This disk can be added to an existing disk group, a new disk group, or left available for use by future add or replacement operations.  To create a new disk group, select a disk group name that does not yet exist. To leave the disk available for future use, specify a disk group name of "none".

Which disk group [<group>,none,list,q,?] (default: rootdg) testdg

Use a default disk name for the disk? [y,n,q,?] (default: y) n

Add disk as a spare disk for testdg? [y,n,q,?] (default: n) n

The selected disks will be added to the disk group testdg with disk names that you will specify interactively.

 c1t11d0

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

Access is disabled for the following disk.
 Output format: [Device_Name]

 c1t11d0

Enable access for this device? [y,n,q,?] (default: y) y

This disk is listed as added to a disk group. The disk group is not currently enabled (imported). If importing from the disk group, quit from this operation and select "Enable access to (import) a disk group" from the main disk operations menu.
Output format: [Device_Name,Disk_Access_Name,Disk_Group]

 [c1t11d0,c1t11d0s2,datadg]

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

The following disk selected for use appears to already have been initialized for the volume manager. If the disk has already been initialized for the volume manager, then there is no need to reinitialize the disk device.
Output format: [Device_Name]

 c1t11d0

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

 Initializing device c1t11d0.

Enter disk name for c1t11d0 [<name>,q,?] (default: testdg01) test03

 Adding disk device c1t11d0 to disk group testdg with disk
 name test03.

Add or initialize other disks? [y,n,q,?] (default: n) n

# vxprint -ht
Disk group: rootdg

DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg rootdg       default      default  0        936308190.1025.dot

dm rootdisk     c0t0d0s2     sliced   2015     16839647 -

sd rootdiskPriv -            rootdisk 16536240 2015     PRIVATE   c0t0d0   ENA

v  rootvol      root         ENABLED  ACTIVE   16536240 ROUND     -
pl rootvol-01   rootvol      ENABLED  ACTIVE   16536240 CONCAT    -        RW
sd rootdisk-B0  rootvol-01   rootdisk 16536239 1        0         c0t0d0   ENA
sd rootdisk-02  rootvol-01   rootdisk 0        16536239 1         c0t0d0   ENA

v  swapvol      swap         ENABLED  ACTIVE   301392   ROUND     -
pl swapvol-01   swapvol      ENABLED  ACTIVE   301392   CONCAT    -        RW
sd rootdisk-01  swapvol-01   rootdisk 16538255 301392   0         c0t0d0   ENA

Disk group: testdg

DG NAME         NCONFIG      NLOG     MINORS   GROUP-ID
DM NAME         DEVICE       TYPE     PRIVLEN  PUBLEN   STATE
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dg testdg       default      default  10000    952101973.1171.kt

dm test01       c1t9d0s2     sliced   1089     8921650  -
dm test02       c1t10d0s2    sliced   1089     8921650  -
dm test03       c1t11d0s2    sliced   1089     8921650  -
dm test04       c1t8d0s2     sliced   1089     8921650  -

v  testvol      fsgen        ENABLED  ACTIVE   2097160  SELECT    -
pl vol01-02     testvol      ENABLED  ACTIVE   2097160  CONCAT    -        RW
sd test01-01    vol01-02     test01   0        2097160  0         c1t9d0   ENA

v  vol01        fsgen        ENABLED  ACTIVE   2097152  SELECT    -
pl vol01-01     vol01        ENABLED  ACTIVE   2097160  CONCAT    -        RW
sd test04-01    vol01-01     test04   0        2097160  0         c1t8d0   ENA

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    test04       testdg       online
c1t9d0s2     sliced    test01       testdg       online
c1t10d0s2    sliced    test02       testdg       online
c1t11d0s2    sliced    test03       testdg       online

To do this procedure from the command line:

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    testdg03     testdg       online
c1t9d0s2     sliced    testdg04     testdg       online
c1t10d0s2    sliced    testdg01     testdg       online
c1t11d0s2    sliced    datadg01     datadg       online

# vxdg deport datadg

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    testdg03     testdg       online
c1t9d0s2     sliced    testdg04     testdg       online
c1t10d0s2    sliced    testdg01     testdg       online
c1t11d0s2    sliced    -            -            online

# vxdiskunsetup c1t11d0  

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    testdg03     testdg       online
c1t9d0s2     sliced    testdg04     testdg       online
c1t10d0s2    sliced    testdg01     testdg       online
c1t11d0s2    sliced    -            -            error

# vxdisksetup -i c1t11d0  
# vxdisk list

DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    testdg03     testdg       online
c1t9d0s2     sliced    testdg04     testdg       online
c1t10d0s2    sliced    testdg01     testdg       online
c1t11d0s2    sliced    -            -            online

# vxdg -g testdg adddisk testdg02=c1t11d0s2

# vxdisk list
DEVICE       TYPE      DISK         GROUP        STATUS
c0t0d0s2     sliced    rootdisk     rootdg       online
c1t8d0s2     sliced    testdg03     testdg       online
c1t9d0s2     sliced    testdg04     testdg       online
c1t10d0s2    sliced    testdg01     testdg       online
c1t11d0s2    sliced    testdg02     testdg       online

No comments:

Post a Comment