Sunday, January 30, 2011

Removing disk from Veritas control and taking it offline

Removing disk from veritas DG's. These two disks were part of the DG's that were destroyed.

(MyHost:/)# vxprint -g MyZone-Mydbdb -d
TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dm disk         emc0_0536    -        35289088 -        -        -       -
(MyHost:/)# vxprint -g MyZone-Mydb -d
TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dm disk         emc0_0535    -        35289088 -        -        -       -
(MyHost:/)#

DG's destroyed
(MyHost:/)#
(MyHost:/)# vxdg destroy MyZone-Mydbdb
(MyHost:/)# vxdg destroy MyZone-Mydb
(MyHost:/)#
(MyHost:/)#
(MyHost:/)# vxdg list | grep Mydb
(MyHost:/)#

Taking the disk out of veritas setup
(MyHost:/)#
(MyHost:/)# /etc/vx/bin/vxdiskunsetup emc0_0536
(MyHost:/)# /etc/vx/bin/vxdiskunsetup emc0_0535

Listing the disk details. Now it has removed the veritas information of the disk.
(MyHost:/)#
(MyHost:/)# vxdisk list emc0_0536
Device:    emc0_0536
devicetag: emc0_0536
type:      auto
info:      format=none
flags:     online ready private autoconfig invalid
pubpaths:  block=/dev/vx/dmp/emc0_0536s2 char=/dev/vx/rdmp/emc0_0536s2
guid:      -
udid:      EMC%5FSYMMETRIX%5F000290104444%5F44536000
site:      -
Multipathing information:
numpaths:   2
c4t5006048452A91F17d63s2        state=enabled
c2t5006048452A91F18d63s2        state=enabled
(MyHost:/)# vxdisk list emc0_0535
Device:    emc0_0535
devicetag: emc0_0535
type:      auto
info:      format=none
flags:     online ready private autoconfig invalid
pubpaths:  block=/dev/vx/dmp/emc0_0535s2 char=/dev/vx/rdmp/emc0_0535s2
guid:      -
udid:      EMC%5FSYMMETRIX%5F000290104444%5F44535000
site:      -
Multipathing information:
numpaths:   2
c4t5006048452A91F17d62s2        state=enabled
c2t5006048452A91F18d62s2        state=enabled
(MyHost:/)#
(MyHost:/)#

Removing the disk from veritas control
(MyHost:/)# vxdisk rm c4t5006048452A91F17d63s2
(MyHost:/)# vxdisk rm c4t5006048452A91F17d62s2
(MyHost:/)#

No more disk details in veritas database.
(MyHost:/)#
(MyHost:/)# vxdisk -o alldgs -e list | grep emc0_0536
(MyHost:/)# vxdisk -o alldgs -e list | grep emc0_0535
(MyHost:/)#
(MyHost:/)#

Take the disk offline and make sure not accessible by the system.
(MyHost:/)#
(MyHost:/)# luxadm -e offline /dev/rdsk/c4t5006048452A91F17d63s2
(MyHost:/)# luxadm -e offline /dev/rdsk/c2t5006048452A91F18d63s2
(MyHost:/)#
(MyHost:/)# luxadm -e offline /dev/rdsk/c4t5006048452A91F17d62s2
(MyHost:/)# luxadm -e offline /dev/rdsk/c2t5006048452A91F18d62s2
(MyHost:/)#
(MyHost:/)#

Destroying a DiskGroup

Destroying the Disk Group after deleting the volumes


List the DG
(MyHost:/)# vxdg list | grep Mydb
MyZone-Mydb enabled,cds 1268406643.62.MyHost
MyZone-Mydbdb enabled,cds 1268406894.68.MyHost
(MyHost:/)#



Check if there is any fs mounted inside the zone
(MyHost:/)# df -kZ 2>/dev/null | grep MyZone-Mydb
(MyHost:/)# df -kZ 2>/dev/null | grep MyZone-Mydbdb
(MyHost:/)#

List the disk & volumes in the DG
(MyHost:/)# vxprint -g MyZone-Mydb -d
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
dm disk emc0_0535 - 35289088 - - - -
(MyHost:/)# vxprint -g MyZone-Mydb -v
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
v Mydb fsgen ENABLED 3407872 - ACTIVE - -
v Mydbbim fsgen ENABLED 102400 - ACTIVE - -
v Mydbbo fsgen ENABLED 8388608 - ACTIVE - -
(MyHost:/)#
(MyHost:/)# vxprint -g MyZone-Mydbdb -d
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
dm disk emc0_0536 - 35289088 - - - -
(MyHost:/)#
(MyHost:/)# vxprint -g MyZone-Mydbdb -v
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
v Mydbdbs fsgen ENABLED 3604480 - ACTIVE - -
v Mydbdbsarch fsgen ENABLED 1024000 - ACTIVE - -
v Mydbdbsdata fsgen ENABLED 2924544 - ACTIVE - -
v Mydbdbsindex fsgen ENABLED 204800 - ACTIVE - -
(MyHost:/)#



Remove the volume
(MyHost:/)#
(MyHost:/)# vxassist -g MyZone-Mydbdb remove volume Mydbdbsindex
(MyHost:/)# vxassist -g MyZone-Mydbdb remove volume Mydbdbsdata
(MyHost:/)# vxassist -g MyZone-Mydbdb remove volume Mydbdbsarch
(MyHost:/)# vxassist -g MyZone-Mydbdb remove volume Mydbdbs
(MyHost:/)# vxprint -g MyZone-Mydbdb -v
(MyHost:/)#



Destroy the volume
(MyHost:/)#
(MyHost:/)# vxdg destroy MyZone-Mydbdb
(MyHost:/)# vxdg destroy MyZone-Mydb
(MyHost:/)#
(MyHost:/)#
(MyHost:/)# vxdg list | grep Mydb
(MyHost:/)#

Removing a filesystem from zonecfg

zonecfg to remove the filesystem added in the zone configuration fie. This will remove the fs entry from the zone.xml file.

(MyHost:/)# zonecfg -z MyZone info fs | grep Mydb
        dir: /Mydb
        special: /dev/vx/dsk/MyZone-Mydb/Mydb
        raw: /dev/vx/rdsk/MyZone-Mydb/Mydb
        dir: /Mydb/bim
        special: /dev/vx/dsk/MyZone-Mydb/Mydbbim
        raw: /dev/vx/rdsk/MyZone-Mydb/Mydbbim
        dir: /Mydb/bo
        special: /dev/vx/dsk/MyZone-Mydb/Mydbbo
        raw: /dev/vx/rdsk/MyZone-Mydb/Mydbbo
        dir: /Mydb/dbs
        special: /dev/vx/dsk/MyZone-Mydbdb/Mydbdbs
        raw: /dev/vx/rdsk/MyZone-Mydbdb/Mydbdbs
        dir: /Mydb/dbs/index
        special: /dev/vx/dsk/MyZone-Mydbdb/Mydbdbsindex
        raw: /dev/vx/rdsk/MyZone-Mydbdb/Mydbdbsindex
        dir: /Mydb/dbs/arch
        special: /dev/vx/dsk/MyZone-Mydbdb/Mydbdbsarch
        raw: /dev/vx/rdsk/MyZone-Mydbdb/Mydbdbsarch
(MyHost:/)#
(MyHost:/)# zonecfg -z MyZone
zonecfg:MyZone> remove fs dir=/Mydb/dbs/arch
zonecfg:MyZone> remove fs dir=/Mydb/dbs/index
zonecfg:MyZone> remove fs dir=/Mydb/dbs
zonecfg:MyZone> remove fs dir=/Mydb/bo
zonecfg:MyZone> remove fs dir=/Mydb/bim
zonecfg:MyZone> remove fs dir=/Mydb
zonecfg:MyZone>
zonecfg:MyZone> commit
zonecfg:MyZone> exit
(MyHost:/)#
(MyHost:/)# zonecfg -z MyZone info fs | grep Mydb
(MyHost:/)#
(MyHost:/)#

NFSv4 style ACL - Adding and Removing Permissions

ACL allows to set more finer permissions on a file or directory apart from the standard permissions(uog)
POSIX ACL's use setfacl and getfacl functions to set ACL permissions. POSIX style ACL doesn't work on ZFS filesystem.

NFSv4 style ACL is an upgrade over the old model and use chmod to set permissions. getfacl and setfacl are obsolete in ZFS. This provides more finer permissions including permission only to append on a file.


NFSv4 style ACL's are set on the directories
==================================================

zone1:/root# ls -lv /opt/slw/bea/app/ines/bulk
total 161
drwxrwxrwx+  2 myuser  slw          108 Oct 21 17:07 error
     0:everyone@:delete_child/write_attributes/write_acl:deny
     1:group@:delete_child/write_attributes/write_acl:deny
     2:group@:read_attributes/read_acl/synchronize:allow
     3:group@:write_attributes/write_acl:deny
     4:user:slw9:write_attributes/write_acl:deny
     5:user:slw9::deny
     6:user:slw9:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/execute/delete_child/read_attributes
         /read_acl/synchronize:allow
     7:user:slw9:write_attributes/write_acl:deny
     8:user:slw:write_attributes/write_acl:deny
     9:user:slw::deny
     10:user:slw:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute/delete_child/read_attributes/read_acl
         /synchronize:allow
     11:user:slw:write_attributes/write_acl:deny
     12:owner@::deny
     13:owner@:delete_child/read_attributes/write_attributes/read_acl
         /write_acl/synchronize:allow
     14:everyone@:read_attributes/read_acl/synchronize:allow
     15:owner@::deny
     16:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     17:group@::deny
     18:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     19:everyone@:write_xattr/write_attributes/write_acl/write_owner:deny
     20:everyone@:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
drwxrwxrwx+  2 myuser  slw            8 Jan 25 13:39 input
     0:group:slw:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data:allow
     1:everyone@:delete_child/write_attributes/write_acl:deny
     2:group@:delete_child/write_attributes/write_acl:deny
     3:group@:read_attributes/read_acl/synchronize:allow
     4:group@:write_attributes/write_acl:deny
     5:user:slw9:write_attributes/write_acl:deny
     6:user:slw9::deny
     7:user:slw9:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/execute/delete_child/read_attributes
         /read_acl/synchronize:allow
     8:user:slw9:write_attributes/write_acl:deny
     9:user:slw:write_attributes/write_acl:deny
     10:user:slw::deny
     11:user:slw:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute/delete_child/read_attributes/read_acl
         /synchronize:allow
     12:user:slw:write_attributes/write_acl:deny
     13:owner@::deny
     14:owner@:delete_child/read_attributes/write_attributes/read_acl
         /write_acl/synchronize:allow
     15:everyone@:read_attributes/read_acl/synchronize:allow
     16:owner@::deny
     17:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     18:group@::deny
     19:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     20:everyone@:write_xattr/write_attributes/write_acl/write_owner:deny
     21:everyone@:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
drwxrwxr-x+  2 myuser  slw            3 Jan 26 11:00 processing 
<..........>



As with standard ACL, the '+' sign implies that ACL permissions are set on the directories
==============================================================================
zone1:/root# cd /opt/slw/bea/app/ines/bulk
zone1:/opt/slw/bea/app/ines/bulk# ls -l
total 161
drwxrwxrwx+  2 myuser  slw          108 Oct 21 17:07 error
drwxrwxrwx+  2 myuser  slw            8 Jan 25 13:39 input
drwxrwxr-x+  2 myuser  slw            3 Jan 26 11:00 processing
drwxrwxrwx+  2 myuser  slw            2 Jul 20  2010 retry
drwxrwxrwx+  2 myuser  slw          145 Oct 21 17:02 success


Adding an ACL entry onto a directory
============================================================

zone1:/opt/slw/bea/app/ines/bulk# mkdir TEST
zone1:/opt/slw/bea/app/ines/bulk#
zone1:/opt/slw/bea/app/ines/bulk# chown myuser:slw TEST
zone1:/opt/slw/bea/app/ines/bulk#
zone1:/opt/slw/bea/app/ines/bulk#
zone1:/opt/slw/bea/app/ines/bulk# ls -l
total 164
drwxr-xr-x   2 myuser  slw            2 Jan 26 11:32 TEST


zone1:/opt/slw/bea/app/ines/bulk# chmod
A02=owner@:list_directory/read_data/add_file/write_data/add_subdirectory/append_data/write_xattr/execute/write_attributes/write_acl/write_owner:allow TEST


zone1:/opt/slw/bea/app/ines/bulk# ls -dv TEST
drwxr-xr-x+  2 myuser  slw            2 Jan 26 11:32 TEST
     0:owner@::deny
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     2:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     3:group@:list_directory/read_data/execute:allow
     4:everyone@:add_file/write_data/add_subdirectory/append_data/write_xattr
         /write_attributes/write_acl/write_owner:deny
     5:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

zone1:/opt/slw/bea/app/ines/bulk# chmod
A6=user:slw9:list_directory/read_data/add_file/write_data/add_subdirectory/append_data/execute/delete_child/read_attributes/read_acl/synchronize:allow TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A7=user:slw9:write_attributes/write_acl:deny TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A8=user:slw:write_attributes/write_acl:deny TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A9=user:slw::deny TEST
zone1:/opt/slw/bea/app/ines/bulk#
zone1:/opt/slw/bea/app/ines/bulk# ls -dv TEST
dr-xr-xr-x+  2 myuser  slw            2 Jan 26 11:32 TEST
     0:everyone@:delete_child/write_attributes/write_acl:deny
     1:group@:delete_child/write_attributes/write_acl:deny
     2:group@:read_attributes/read_acl/synchronize:allow
     3:group@:write_attributes/write_acl:deny
     4:user:slw9:write_attributes/write_acl:deny
     5:user:slw9::deny
     6:user:slw9:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/execute/delete_child/read_attributes
         /read_acl/synchronize:allow
     7:user:slw9:write_attributes/write_acl:deny
     8:user:slw:write_attributes/write_acl:deny
     9:user:slw::deny
     10:everyone@:add_file/write_data/add_subdirectory/append_data/write_xattr
         /write_attributes/write_acl/write_owner:deny
     11:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow


Removing the ACL entry set on a directory
=====================================================

zone1:/opt/slw/bea/app/ines/bulk# chmod A9- TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A8- TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A7- TEST
zone1:/opt/slw/bea/app/ines/bulk# chmod A6- TEST
zone1:/opt/slw/bea/app/ines/bulk#
zone1:/opt/slw/bea/app/ines/bulk# ls -dv TEST
drwxrwxr-x   2 myuser  slw            2 Jan 26 11:32 TEST
     0:owner@::deny
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     2:group@::deny
     3:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     4:everyone@:add_file/write_data/add_subdirectory/append_data/write_xattr
         /write_attributes/write_acl/write_owner:deny
     5:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

=====================================================

Removing the ACL's one by one

=====================================================


zone2:/opt/slw/bea/app/ines/bulk# ls -dv retry
drwxrwxrwx+  2 myuser  slw            2 Jul  8  2010 retry
     0:group:slw:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data:allow
     1:everyone@:delete_child/write_attributes/write_acl:deny
     2:everyone@:read_attributes/read_acl/synchronize:allow
     3:group@:delete_child/write_attributes/write_acl:deny
     4:group@:read_attributes/read_acl/synchronize:allow
     5:group@:write_attributes/write_acl:deny
     6:user:slw9:write_attributes/write_acl:deny
     7:user:slw9::deny
     8:user:slw9:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/execute/delete_child/read_attributes
         /read_acl/synchronize:allow
     9:user:slw9:write_attributes/write_acl:deny
     10:user:slw:write_attributes/write_acl:deny
     11:user:slw::deny
     12:user:slw:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute/delete_child/read_attributes/read_acl
         /synchronize:allow
     13:user:slw:write_attributes/write_acl:deny
     14:owner@::deny
     15:owner@:delete_child/read_attributes/write_attributes/read_acl
         /write_acl/synchronize:allow
     16:owner@::deny
     17:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     18:group@::deny
     19:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     20:everyone@:write_xattr/write_attributes/write_acl/write_owner:deny
     21:everyone@:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
zone2:/opt/slw/bea/app/ines/bulk#
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# chmod A0- retry
zone2:/opt/slw/bea/app/ines/bulk# ls -dv retry
drwxrwxrwx   2 myuser  slw            2 Jul  8  2010 retry
     0:owner@::deny
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     2:group@::deny
     3:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     4:everyone@:write_xattr/write_attributes/write_acl/write_owner:deny
     5:everyone@:list_directory/read_data/add_file/write_data
         /add_subdirectory/append_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
zone2:/opt/slw/bea/app/ines/bulk# chmod 775 retry
zone2:/opt/slw/bea/app/ines/bulk# ls -dv retry
drwxrwxr-x   2 myuser  slw            2 Jul  8  2010 retry
     0:owner@::deny
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/write_xattr/execute/write_attributes/write_acl
         /write_owner:allow
     2:group@::deny
     3:group@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/execute:allow
     4:everyone@:add_file/write_data/add_subdirectory/append_data/write_xattr
         /write_attributes/write_acl/write_owner:deny
     5:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
zone2:/opt/slw/bea/app/ines/bulk# ls -l
total 251
drwxrwxr-x   2 myuser  slw          152 Jan 21 09:30 error
drwxrwxrwx+  2 myuser  slw          152 Jan 21 09:30 error.old
drwxrwxr-x   2 myuser  slw            2 Jan 21 09:30 input
drwxrwxr-x+  2 myuser  slw            2 Jan 21 09:30 input.old
drwxrwxrwx+  2 myuser  slw            2 Jan 21 09:30 processing
drwxrwxr-x   2 myuser  slw            2 Jul  8  2010 retry
drwxrwxrwx+  2 myuser  slw          200 Jan 20 16:08 success