Monday, February 22, 2016

project add


Change the soft limit
become a user, add the following value on user profile
vi .profile
ulimit -Sn 1024
or
vi .bash_profile
ulimit -Sn 1024

# projadd -U oinstall -p 101 -c "Oracle Oinstall" user.oinstall
# projmod -sK "process.max-file-descriptor=(privileged,65536,deny)" user.oinstall
# projects -l
# projmod -sK "project.max-shm-memory=(privileged,17179869184,deny)" user.oinstall
# projmod -sK "project.max-sem-nsems=(privileged,810,deny)" user.oinstall
# projects -l
# vi /etc/project
  515  projmod -sK "process.max-sem-nsems=(privileged,810,deny)" user.oinstall
  516  projects -l
  517  vi /etc/project
  518  history
[root@sinf-db-p03]#

user.grid
        projid : 100
        comment: "Oracle Grid Infra"
        users  : grid
        groups : (none)
        attribs: process.max-file-descriptor=(privileged,65536,deny)
                 process.max-sem-nsems=(privileged,810,deny)
                 project.max-sem-ids=(privileged,1024,deny)
                 project.max-shm-ids=(privileged,1024,deny)
                 project.max-shm-memory=(privileged,68719476736,deny)
user.oinstall
        projid : 101
        comment: "Oracle Oinstall"
        users  : oinstall
        groups : (none)
        attribs: process.max-sem-nsems=(privileged,810,deny)
                 project.max-sem-ids=(privileged,1024,deny)
                 project.max-shm-ids=(privileged,1024,deny)
                 project.max-shm-memory=(privileged,17179869184,deny)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

From man page.
Example 1: Adding a Project
     The following command creates  the  project  salesaudit  and
     sets  the resource controls specified as arguments to the -K
     option.
     projadd -p 111 -G sales,finance -c "Auditing Project" \
        -K "rcap.max-rss=10GB" \
        -K "process.max-file-size=(priv,50MB,deny)" \
        -K "task.max-lwps=(priv,100,deny)" salesaudit
     This  command  would  produce   the   following   entry   in
     /etc/project:
     salesaudit:111:Auditing Project::sales,finance: \
     process.max-file-size=(priv,52428800,deny); \
     rcap.max-rss=10737418240;task.max-lwps=(priv,100,deny)
     Note  that  the  preceding  would  appear  as  one  line  in
     /etc/project.
     Comparing  the  projadd  command  and  resulting  output  in
     /etc/project,  note  the effect of the scaling factor in the
     resource cap (rcap.max-rss=10GB) and  the  resource  control
     (process.max-file-size=(priv,50MB,deny)). Modifiers, such as
     B,  KB,  and  MB,  and  scaling  factors  are  specified  in
     resource_controls(5).
EXIT STATUS
     The following exit values are returned:
     0        Successful completion.
     2        The command syntax was invalid. A usage message for
              projadd is displayed.
     3        An invalid argument was provided to an option.
     4        The projid given with the -p option is  already  in
              use.
     5        The project files contain an error. See project(4).
     6        The project to be added, group, user,  or  resource
              does not exist.
     9        The project is already in use.
     10       Cannot update the /etc/project file.
FILES
     /etc/project            System project file

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc35889.1570/doc/html/jon1265068889138.html
Adaptive Server Enterprise 15.7 > Installation Guide Adaptive Server Enterprise 15.7 for Sun Solaris > Preparing to Install Adaptive Server

Adjusting the Operating System Shared Memory Parameters

Adjust shared memory segments if Adaptive Server cannot obtain large memory as a single segment or if Backup Server stripes fail due to insufficient segments.

Depending on the number and types of devices used for backup (dump) and recovery (load), you may need to adjust the shared memory segment parameter in the operating system configuration file to accommodate concurrent Backup Server processes. There are six default shared memory segments available for process attachments.
If any reconfiguration through sp_configure requires additional memory, Adaptive Server allocates shared memory segments after start-up. To account for these additional segments, allocate the maximum memory available to Adaptive Server by using the allocate max shared memory configuration parameter. See the System Administration Guide.
1.Adjust the operating system shared memory parameter.

Solaris 10 has shifted to a new method of controlling system resources. For this reason shminfo_shmmax is technically obsolete. If you still have an entry for it in /etc/system it will work. However, the new method requires an additional entry to the file /etc/project. For example:project-sybase:200:For use by Sybase:sybase:sybase:
project.max-shm-memory=\(privileged,17179869184,deny)
The new parameter is project.max-shm-memory=(privileged,17179869184,deny) — replaces the old parameter shminfo-shmmax. “Privilege” is a threshold value on a resource control that constitutes a point at which local actions are triggered or global actions such as logging into a machine can occur.
Privilege levels: ?
Basic – can be modified by the owner of the calling process.
 ?
Privilege – can be modified by privileged callers.
 ?
System – is fixed for the duration of the operating system instance.

In specifying the threshold value of “privilege”, you can use the abbreviation “priv” For example:project.max-shm-memory=(priv, 17179869184,deny)
?
"17179869184" – is the threshold value (16GB) on the resource control.
?
deny – denies attempts to use more than 16GB.

The default value for project.max-shm-memory is 25% of the physical memory on the system. The maximum value is UINT64_MAX, which works out to 18446744073709551615 bytes, so is limited only by the size of the physical memory.
To set the project.max-shm-memory while the system is running use the prctl command. The rctladm command sets the configuration permanently.
2.If the installer cannot update for Solaris 10 patch ID 120012-14, edit your /etc/user_attr file with:
 sybase::::type=normal;project=project-sybase
--------------------
To confirm that the update to this patch, use either of these commands:# projects -d sybase
project-sybase
# id -p sybase
uid=204409(sybase) gid=1(other) projid=200(project-sybase)
This update allows changes to shared-memory parameters within Solaris 10.
3.Adjust shared memory segments.

Depending on the number and types of devices used for backup (dump) and recovery (load), you may need to adjust the shared memory segment parameter in the operating system configuration file to accommodate concurrent Backup Server processes. The default number of shared memory segments available for process attachments is 6.
Adaptive Server may allocate shared memory segments after start-up if any reconfiguration through sp_configure requires additional memory. You may need to account for these additional segments. Allocate the maximum memory available to Adaptive Server, by using the allocate max shared memory configuration parameter. See the System Administration Guide for more information.
To adjust shared memory segments of the operating system, add the following line to the configuration file where x is the number of shared memory segments./etc/system:set shmsys:shminfo_shmseg=x


Parent topic: Preparing to Install Adaptive Server

--------------------------------------------------------------------------------
Created June 28, 2012. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

https://durgaprasad.wordpress.com/2007/03/20/projects-in-solaris/
https://docs.oracle.com/cd/E23824_01/html/821-1460/rmctrls.task-33.html
https://blogs.oracle.com/gjl/entry/a_simple_way_to_increase
https://docs.oracle.com/database/121/SSDBI/app_manual.htm#SSDBI7871


Projects in Solaris
March 20, 2007 at 12:47 pm (solaris)

When I was reading an interesting blog about prstat behavior, I read about projects in Solaris. After reading about projects, I came to know that they are mainly used for controlling resources used by process[es]. Suppose, if we want to control the CPU/disc/memory usages, then we create a project [using projadd, projmod] and in /etc/project, we have to modify resource control field. Then we can create/attach processes into this project [using newtask]. Once the process is created/attached in this project, all resource constraints will apply to that process. Suppose if the resource constraint name is process.max-file-descriptor and the value is 10, a process in that project can not have more that 10 file descriptors. Moreover, using prstat -J command, we can clearly see the resources used for projects. I felt this is a very good way to control resources used by specific processes, but I don’t know if the similar thing exists on other platforms like Linux. Some good links that I have referred are here & here.




# create project for mysql user
 projadd user.mysql
 # current max open file descriptors
 prctl -n process.max-file-descriptor $$
 # change it
 projmod -sK “process.max-file-descriptor=(basic,8192,deny)” user.mysql
 # current max shared memory
 prctl -n project.max-shm-memory $$
 # change it
 projmod -sK “project.max-shm-memory=(privileged,3221225472,deny)” user.mysql
 # view current project attribs
 projects -l user.mysql
 # or
 grep user.mysql /etc/project
 # view user’s current projects
 /usr/bin/projects
 It gives:
 default user.mysql



 3.
Luis Flores said,
August 20, 2009 at 8:35 pm
I know this posting is old, but just in case someone else has the same question: the problem here is that you never assigned the newly created project to any user. a project has been created, and that is it. a project by itself is meaningless unless a process/userID/username is assigned to it. at this point all you have it this:
 # projects -l user.mysql
user.mysql
 projid : 100
 comment: “”
users : (none)
 groups : (none)
 attribs: process.max-file-descriptor=(basic,8192,deny)
project.max-shm-memory=(privileged,3221225472,deny)
you see, there is not users or groups assigned to the projects. you need to add something to it like:
 projmod -U mysql user.mysql
then you will see the following:
# projects -l user.mysql
user.mysql
 projid : 100
 comment: “”
users : mysql
 groups : (none)
 attribs: process.max-file-descriptor=(basic,8192,deny)
project.max-shm-memory=(privileged,3221225472,deny)
and if you “su – myql” then you will see
$ projects
 default user.mysql
now mysql is has a project applied to it.
 hope this helps
 -Luis

https://docs.oracle.com/cd/E19044-01/sol.containers/817-1592/rmtaskproj.task-10/index.html
http://rc.quest.com/topics/howto/rbac/

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

system:0::::
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
user.oradev:221::oradev:dba:
process.max-file-descriptor=(priv,65536,deny)
process.max-sem-nsems=(priv,810,deny);
project.max-sem-ids=(priv,512,deny);
project.max-shm-ids=(priv,512,deny);
project.max-shm-memory=(priv,5368709120,deny);


[root@ora-serv-25]# projadd -p 101 -U oratest -G dba -c "Oracle Test user" \
> -K "process.max-sem-nsems=(priv,810,deny)" \
> -K "project.max-sem-ids=(priv,512,deny)" \
> -K "project.max-shm-ids=(priv,512,deny)" \
> -K "project.max-shm-memory=(priv,5368709120,deny)" \
> -K "process.max-file-descriptor=(priv,65535,deny)" user.oratest
[root@ora-serv-25]# projects -l
system
        projid : 0
        comment: ""
        users  : (none)
        groups : (none)
        attribs:
user.root
        projid : 1
        comment: ""
        users  : (none)
        groups : (none)
        attribs:
noproject
        projid : 2
        comment: ""
        users  : (none)
        groups : (none)
        attribs:
default
        projid : 3
        comment: ""
        users  : (none)
        groups : (none)
        attribs:
group.staff
        projid : 10
        comment: ""
        users  : (none)
        groups : (none)
        attribs:
user.oratest
        projid : 101
        comment: "Oracle Test user"
        users  : oratest
        groups : dba
        attribs: process.max-file-descriptor=(priv,65535,deny)
                 process.max-sem-nsems=(priv,810,deny)
                 project.max-sem-ids=(priv,512,deny)
                 project.max-shm-ids=(priv,512,deny)
                 project.max-shm-memory=(priv,5368709120,deny)
[root@ora-serv-25]#

 

shared mem

Change ulimit for user
vi .profile
ulimit -n 1024

to change the value for the shared memory,
vi /etc/project
and change the value
value is on byte
if you have to add 2GB then its going to be
2*1024*1024*1024 = 2147483648
so 2147483648 byte.

#
#
#if [ $USER = "oinstall" ]; then
#  if [ $SHELL = "/bin/ksh" ]; then
#    ulimit -p 16384
#    ulimit -n 65536
#  else
#    ulimit -u 16384 -n 65536
#  fi
#fi

To change soft limit
ulimit -Sn 1024

To view the limit
ulimit -Sn
ulimit -Hn

 

Solaris 10 - sudo su - sudo: must be setuid root


unable to sudo to root. logged in as normal user and become root using su -.
checked the sudo permission and worked after changing the permission of sudo file with setuid.

$ sudo su -
sudo: must be setuid root
# which sudo
/usr/sbin/sudo
# ls -l /usr/sbin/sudo
lrwxrwxrwx   1 root     root          19 Feb 22 09:39 /usr/sbin/sudo -> /usr/local/bin/sudo

# ls -l /usr/local/bin/sudo
-rwxrwxr-x   1 root     root       94982 Dec  6  2011 /usr/local/bin/sudo

# chmod 2111 /usr/local/bin/sudo

#  ls -l /usr/local/bin/sudo
---x--s--x   1 root     root       94982 Dec  6  2011 /usr/local/bin/sudo
$ sudo su -
sudo: must be setuid root

# chmod u+s,g-s /usr/local/bin/sudo

$ ls -l /usr/local/bin/sudo /usr/sbin/sudo
---s--x--x   1 root     root       94982 Dec  6  2011 /usr/local/bin/sudo

$ sudo su -
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have new mail.
#

 

Thursday, February 18, 2016

Solaris 10 zone, root fs mirroring and detaching


root_disk_mirroring_and_detaching

on control domain,
# echo | format | grep -i 02a5
# ldm add-vdsdev /dev/dsk/c0t6000D310006D640000000000000002A5d0s2 DL23@primary-vds0
# ldm add-vdisk VDL23 DL23@primary-vds0  <LDOM>


On LDOM

# zpool attach rpool2 c0d0s0 c0d1s0
# zpool status
# zpool detach rpool2 c0d0s0
# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0d1s0
# zpool scrub rpool2
# zpool set autoexpand=on rpool2


1. Verify use-nvramrc = true value is set.
# eeprom use-nvramrc?
# eeprom use-nvramrc?=true
# echo | format
       2. c0d2 <COMPELNT-CompellentVol-0605 cyl 49898 alt 2 hd 8 sec 394>
          /virtual-devices@100/channel-devices@200/disk@2

# grep '/virtual-devices@100/channel-devices@200/disk@2' /etc/path_to_inst
2. Creating device alias
# ls -l /dev/dsk/c0d2s0
lrwxrwxrwx   1 root     root          62 Dec  6  2013 /dev/dsk/c0d2s0 -> ../../devices/virtual-
devices@100/channel-devices@200/disk@2:a

Note: The “a” at the end of the physical device output stands for slice 0.
Slice 1 would have a “b”,
slice 2 would have a “c”, and so on.
To verify other slice, just use the ls -l command with the particular slice
# ls -l /dev/dsk/c0d2s[0-7]
# eeprom nvramrc="devalias priboot /virtual-devices@100/channel-devices@200/disk@2"

# eeprom boot-device
boot-device=disk net
# eeprom boot-device="priboot disk net"
# eeprom boot-device
boot-device=priboot disk net

at the ok prompt, you can verify the information
# init 0
{0}ok printenv nvramrc
{0}ok devalias
if you want to set, use show-disk command
{0}ok show-disk


3. Detach the old LUN (disk)
# zpool status rpool2
# zpool detach rpool2 c0d0s0
# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/alt09252015  59G    11G   6.8G    63%    /

# zpool scrub rpool2
# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/alt09252015  59G    11G   6.8G    63%    /
# zpool set autoexpand=on rpool2
# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/alt09252015  73G    11G   6.8G    63%    /

4. Install bootboot
# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0d2s0

now, reboot


 

Friday, February 12, 2016

Redhat: Create Multiple Users

Here is my "add-users" Linux/bash script, for whatever it is worth.
(Constructive comments and improvement suggestions always welcome.)-Wayne#!/bin/bash -
# Script to add many student accounts at once.  This is the
# Fedora version.  Run as root only.
# See also the "disable-user" script to disable accounts before
# permanently removing them with 'remove-user'.
# TODO: currently invalid inputs abort program.  This should be
# changed to a loop to try 'n' times (say 3) before aborting.
#
#  $Id: add-users,v 1.6 2009/02/20 18:31:53 wayne Exp $
#
# Originally written 2002 by Wayne _____________.PATH=/bin:/sbin:/usr/bin:/usr/sbinPROG=${0##*/}
HOST=$(uname -n)
INSTRUCTOR=""
CREATE_ADDITIONAL_GRP="n"
ADD_INST_TO_ADDITIONAL_GRP="n"
ADD_INST_TO_STUTENT_GRPS="n"md5crypt()
{
    echo "$1" |openssl passwd -1 -stdin
}# A fancy separator line with optional centered title,
# of 68 characters ("-") wide.drawLine()
{
    local num line title
    title="$1"
    let "num = ( 68 - ${#title} ) / 2"
    line=$(perl -e "print \"-\" x $num;")
    echo
    echo -n "$line"
    [ "$1" ] && echo -n " $1 "
    echo "$line"
    echo
}getInst()
{
    local CURR_USER instructor    if [ -x /usr/bin/logname ]
    then CURR_USER=`logname`
    else CURR_USER=`id -run`
    fi
    echo "What is your account name (default: $CURR_USER)? " >/dev/tty
    read instructor
    if [ "$instructor" = "" ]
    then instructor=$CURR_USER
    fi
    if ! grep -e "^$instructor:" /etc/passwd >/dev/null 2>&1
    then
        echo "No user account \"$instructor\" found!" >&2
        echo "Exiting..." >&2
        exit 2
    fi
    echo "$instructor"
}if [ "`id -u`" != "0" ]
then echo "You must be root to run this script.  (Try \"sudo $PROG\".)"
    exit 1
fidrawLine "Class Account Creation Wizard"echo
cat <<EOF
Created accounts have the form <prefix><number>
(e.g. "rab01", "rab02", ...Enter class prefix(es) (e.g.: ua ub uc)
EOF
echo -n "A good choice is the first few letters of"
echo -n " the instructor's name: "
read CLASSES
set -- $CLASSES
if [ $# = 0 ]
then    echo "No classes entered, good-bye!"
        exit 1
fidrawLine "Number of Accounts"echo "Enter number of accounts to create per class (e.g.: 25)."
echo "(Note that one additional account (numbered \"00\") will be"
echo "created for the instructor to use, as a demo for example.)"
echo
echo -n "How many student accounts should be created? "
read NUM JUNK
if [ -z "$NUM" ]
then    echo "No value entered, good-bye!"
        exit 1
fi
if [ "$JUNK" ]
then    echo "Only enter a single value, good-bye!"
        exit 1
fishopt -s extglob  # Allow extended pattern matching in bash
case "$NUM" in
+([0-9])) if [ "$NUM" -eq 0 ]
          then echo "You must create at least one account, good-bye!"
               exit 1
          elif [ "$NUM" -gt 40 ]
          then echo -n "$NUM are a lot of accounts, are you sure? "
               read ANS
               if [ "$ANS" != 'y' ]
               then  echo "Good-bye!"
                     exit 1
               fi
          fi
          ;;
*)        echo "You must enter a positive number, good-bye!"
          exit 1
          ;;
esacdrawLine "Additional Group Setup"echo "An additional group can be created for each class, named"
echo "for the class prefix.  Each student can be added as a member"
echo "of this group, so students will be members of two groups."
echo
echo -n "Do you wish to create an additional group per class (y/n)? "
read answer
if [ "$answer" = "y" ]
then
    CREATE_ADDITIONAL_GRP="y"
    echo
    echo -n "Do you want to add yourself to this group as well (y/n)? "
    read answer
    if [ "$answer" = "y" ]
    then
        INSTRUCTOR=$(getInst)
        ADD_INST_TO_ADDITIONAL_GRP="y"
    fi
fidrawLine "Instructor Access"echo "The system umask of \"027\" allows full access by a file's"
echo "owner, read access by group members, and no access for others."
echo "By adding the instructor as a group member, for each student's"
echo "group (there is one group per account), the instructor is"
echo "given read access to all student files, facilitating grading and"
echo "support."
echo
echo "Configure so the instructor has read access to all"
echo -n "created account home directories (y/n)? "
read answer
if [ "$answer" = "y" ]
then ADD_INST_TO_STUTENT_GRPS="y"
     [ -z "$INSTRUCTOR" ] && INSTRUCTOR=$(getInst)
fidrawLine "Account Locking"TODAY=$(date +%D)
echo "For security accounts are created locked (disabled)."
echo -n "Enter the date the accounts should be unlocked (e.g. \"$TODAY\"): "
read UnlockDate JUNK
if [ -z "$UnlockDate" -o -n "$JUNK" ]
then echo "You must enter a date such as \"mm/dd/yy\".  Good-bye!"
     exit 1
fi
CANONIZED_DATE=$(date --date="$UnlockDate" +%D) || exit 2# Check to make sure the date entered is not in the past:
Today_stamp=`date --date="$TODAY" +%s`
Canon_stamp=`date --date="$CANONIZED_DATE" +%s`
if [ "$Canon_stamp" -lt "$Today_stamp" ]
then
    echo "You must enter today's date, or some date in the future!"
    exit 2
fiif [ "$TODAY" = "$CANONIZED_DATE" ]
then pwPrefix=""
     echo "Accounts will be created unlocked (enabled)!"
else pwPrefix="!"
     echo "Accounts will be unlocked at midnight on $CANONIZED_DATE."
fidrawLine "Initial Passwords"echo "For highest security, accounts can be created with default"
echo "passwords.  If you chose this option the account names and"
echo "their passwords will be emailed to you.  If not, accounts"
echo "will not have passwords (users are be forced to change the"
echo "passwords when they first login, regardless."
echo
echo -n "Create accounts with initial passwords? (y/n)"
read REPLY
case "$REPLY" in
  [yY]*) GenPW=yes
         echo
         echo -n "Enter email address to send password report to: "
         read INST_EMAIL JUNK
         echo "Passwords will be sent to $INST_EMAIL"
         ;;
  *)     GenPW=no
         echo "No passwords will be generated!"
         ;;
esacecho
if [ "$NUM" -lt 10 ]
then DISP_NUM="0$NUM"
else DISP_NUM="$NUM"
fidrawLine "Configuration Summary"# Show summary information for confirmation:if [ $# -gt 1 ]
then
    echo -n "Creating $# classes of $((NUM + 1)) accounts each "
    echo "(\"${1}00\" - \"${1}$DISP_NUM\", ...)."
else
    echo -n "Creating 1 class of $((NUM + 1)) accounts "
    echo "(\"${1}00\" - \"${1}$DISP_NUM\")."
fiif [ "$pwPrefix" = "" ]
then echo "Accounts will be created unlocked."
else echo "Accounts will be unlocked at midnight on $CANONIZED_DATE."
fiif [ "$GenPW" = "yes" ]
then echo "Password list will be emailed to \"$INST_EMAIL\"."
else echo "Accounts will NOT have initial passwords."
fiif [ "$CREATE_ADDITIONAL_GRP" = "y" ]
then echo "Creating an additional group per class."
     if [ "$ADD_INST_TO_ADDITIONAL_GRP" = "y" ]
     then echo "    $INSTRUCTOR will be included in this group."
     fi
fiif [ "$ADD_INST_TO_STUTENT_GRPS" = "y" ]
then echo "$INSTRUCTOR will have read access to all account files."
fiecho
echo -n "OK to proceed? (y/n)? "
read answer
if [ "$answer" != "y" ]
then
    echo "You ARE the weakest link...good-bye!"
    exit 1
fi# Create pipe to email message (password list):
[ "$GenPW" = "yes" ] && \
    exec 3> >(/bin/mail -s "New $HOST Account Passwords" "$INST_EMAIL")for CLASS in $CLASSES
do
    if grep "^$CLASS[0-9]" /etc/passwd >/dev/null 2>&1
    then echo "Class \"$CLASS\" already exists, skipping..."
         logger -p warn -t "add-users" \
             "Skipping account creation for $CLASS, already exists."
         continue
    fi    logger -t "add-users" "Creating new user accounts with prefix $CLASS."    if [ "$CREATE_ADDITIONAL_GRP" = "y" ]
    then echo "Creating new group \"$CLASS\"..."
         groupadd "$CLASS"
         if [ "$ADD_INST_TO_ADDITIONAL_GRP" = "y" ]
         then
             gpasswd -a "$INSTRUCTOR" "$CLASS"
        fi
    fi    for i in $(seq -f "%02.0f" 0 $NUM)
    do
        User="$CLASS$i"
        echo -n "Adding user $User..."
        # Create group account for user:
        groupadd "$User"        if [ "$ADD_INST_TO_STUTENT_GRPS" = "y" ]
        then
            gpasswd -a "$INSTRUCTOR" "$User"
        fi        # Set the password: "" = no pw, unlocked, "!" = no pw, locked,
        # "Xy1Abc" = pw and unlocked, and "!Xy1Abc" = pw, locked.
        PASSWORD="$pwPrefix"
        if [ "$GenPW" = "yes" ]
        then
            # pronouncable with at least one digit and capital leter:
            pass=$(pwgen -cn1)
            crypt=$(md5crypt "$pass")
            PASSWORD="$pwPrefix$crypt"
            echo -e "$User\t$pass" >&3  # Append name, password to email.
        fi        # Create user: -m means create home dir and copy /etc/skel,
        #              -p '!' means create NULL (no) password for Linux
        #                 but initially lock (disable) the account,
        #              -g $User means put the user in his/her own group        useradd -m -p "$PASSWORD" -g "$User" -K UMASK=027 "$User"        # This forces the password to be change every 150 days, and
        # sets the date of last change to be 1/1/1970.  Thus a user
        # is forced to set a password the first time they log in, and
        # that password should be valid for one semester (plus a few
        # extra weeks).
        chage -M 150 -d 1 "$User"  #Linux cmd, Solaris uses passwd        # Set the quotas for the user:
        setquota -u "$User" 6000 12000 2000 3000 /home
        setquota -u "$User" 1000 1500 100 200 /var
        setquota -u "$User" 1000 1500 100 200 /tmp        # Add user to additional group:
        if [ "$CREATE_ADDITIONAL_GRP" = "y" ]
        then
            gpasswd -a "$User" "$CLASS" >/dev/null
        fi        echo "done!"
    done
done# Close the pipe to mail (which will send the email):
[ "$GenPW" = "yes" ] && exec 3>&-# Create an "at" job to unlock accounts on the specified date
# if necessary:
if [ "$pwPrefix" = '!' ]
then
at midnight $CANONIZED_DATE >/dev/null 2>&1 <<-EOF
        for c in $CLASSES
        do
            for i in `seq -s ' ' -f "%02.0f" 0 $NUM`
            do
                usermod -U "\$c\$i"
            done
        done >/dev/null 2>&1
        logger -t "add-users" "Enabling $CLASSES student accounts."
        EOF
fi

https://groups.google.com/forum/#!topic/comp.unix.solaris/CswDAKGjHA4

resize zfs fs


Request a new Large size LUN

Storage team allocated ID/LUN --> 029b /10

Login to your control domain and assign new LUN with bigger size to LDOM.

[root@physical-p01]# echo | format | grep 029b
          /scsi_vhci/ssd@g6000d310006d6400000000000000029b
[root@physical-p01]# echo | format | grep -i 029b
c0t6000D310006D6400000000000000029Bd0: configured with capacity of 75.00GB
       6. c0t6000D310006D6400000000000000029Bd0 <COMPELNT-CompellentVol-0605 cyl 49898 alt 2 hd 8 sec 394>
          /scsi_vhci/ssd@g6000d310006d6400000000000000029b

Find the LUN #, under "Device Address 5000d310006d6433,a" you see a, which is on hex. Convert hex to decimal and you will get 10. Since hex start from 1-9 and starts from a-f and goes to number.
[root@physical-p01]# luxadm display /dev/rdsk/c0t6000D310006D6400000000000000029Bd0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c0t6000D310006D6400000000000000029Bd0s2
  Vendor:               COMPELNT
  Product ID:           Compellent Vol
  Revision:             0605
  Serial Num:           00006d64-0000029b
  Unformatted capacity: 76800.000 MBytes
  Read Cache:           Enabled
    Minimum prefetch:   0x1
    Maximum prefetch:   0xf000
  Device Type:          Disk device
  Path(s):
  /dev/rdsk/c0t6000D310006D6400000000000000029Bd0s2
  /devices/scsi_vhci/ssd@g6000d310006d6400000000000000029b:c,raw
   Controller           /devices/pci@400/pci@2/pci@0/pci@1/pci@0/pci@2/SUNW,qlc@0,1/fp@0,0
    Device Address              5000d310006d6433,a
    Host controller port WWN    21000024ff39f151
    Class                       primary
    State                       ONLINE
   Controller           /devices/pci@400/pci@2/pci@0/pci@1/pci@0/pci@2/SUNW,qlc@0/fp@0,0
    Device Address              5000d310006d6432,a
    Host controller port WWN    21000024ff39f150
    Class                       primary
    State                       ONLINE
   Controller           /devices/pci@400/pci@2/pci@0/pci@1/pci@0/pci@2/SUNW,qlc@0/fp@0,0
    Device Address              5000d310006d6434,a
    Host controller port WWN    21000024ff39f150
    Class                       primary
    State                       ONLINE
   Controller           /devices/pci@400/pci@2/pci@0/pci@1/pci@0/pci@2/SUNW,qlc@0,1/fp@0,0
    Device Address              5000d310006d6431,a
    Host controller port WWN    21000024ff39f151
    Class                       primary
    State                       ONLINE
[root@physical-p01]#

[root@physical-p01]# ldm list-services | grep  -i 029b
[root@physical-p01]# ldm list-bindings | grep -i DL10

[root@physical-p01]# ldm add-vdsdev /dev/dsk/c0t6000D310006D6400000000000000029Bd0s2 DL10@primary-vds0
[root@physical-p01]# ldm add-vdisk VDL10 DL10@primary-vds0 virtual-v01

1. Login to your LDOM
[root@virtual-v01]# df -h
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        59G    11G   1.1G    91%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                    22G   368K    22G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/platform/sun4v/lib/libc_psr/libc_psr_hwcap3.so.1
                        12G    11G   1.1G    91%    /platform/sun4v/lib/libc_psr.so.1
/platform/sun4v/lib/sparcv9/libc_psr/libc_psr_hwcap3.so.1
                        12G    11G   1.1G    91%    /platform/sun4v/lib/sparcv9/libc_psr.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                    22G     8K    22G     1%    /tmp
swap                    22G    48K    22G     1%    /var/run
rpool2/export           59G    32K   1.1G     1%    /export
rpool2/export/home      59G   8.9M   1.1G     1%    /export/home
rpool2                  59G   106K   1.1G     1%    /rpool
2. Get Control Domain info
[root@virtual-v01]# virtinfo
Domain role: LDoms guest
[root@virtual-v01]# virtinfo  -a
Domain role: LDoms guest
Domain name: virtual-v01
Domain UUID: 822634cd-3d47-67bd-da06-faf474607054
Control domain: physical-p01
Chassis serial#: 1151BDY12C

3. Request a new LUN
[root@virtual-v01]# echo | format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0d0 <COMPELNT-CompellentVol-0603 cyl 49930 alt 2 hd 8 sec 315>
          /virtual-devices@100/channel-devices@200/disk@0
Specify disk (enter its number): Specify disk (enter its number):
[root@virtual-v01]# echo | format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0d0 <COMPELNT-CompellentVol-0603 cyl 49930 alt 2 hd 8 sec 315>
          /virtual-devices@100/channel-devices@200/disk@0
       1. c0d1 <COMPELNT-CompellentVol-0605 cyl 49898 alt 2 hd 8 sec 394>
          /virtual-devices@100/channel-devices@200/disk@1
Specify disk (enter its number): Specify disk (enter its number):
[root@virtual-v01]# format c0d1
selecting c0d1
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 49898 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 49897       75.00GB    (49898/0/0) 157278496
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 49897       75.00GB    (49898/0/0) 157278496
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
partition> q

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
[root@virtual-v01]# zpool list
NAME     SIZE  ALLOC   FREE  CAP  HEALTH  ALTROOT
rpool2  59.5G  56.8G  2.66G  95%  ONLINE  -
[root@virtual-v01]# zpool add rpool2 c0d1
cannot label 'c0d1': EFI labeled devices are not supported on root pools.

[root@virtual-v01]# format -e c0d1
selecting c0d1
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 49898 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 49897       75.00GB    (49898/0/0) 157278496
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 49897       75.00GB    (49898/0/0) 157278496
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
partition> p
Current partition table (original):
Total disk cylinders available: 49898 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 49897       75.00GB    (49898/0/0) 157278496
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 49897       75.00GB    (49898/0/0) 157278496
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[0]:
Ready to label disk, continue? y
partition> q

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
[root@virtual-v01]# zpool add rpool2 c0d1
cannot label 'c0d1': EFI labeled devices are not supported on root pools.
[root@virtual-v01]# format -e c0d1
selecting c0d1
[disk formatted]

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 49898 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 49897       75.00GB    (49898/0/0) 157278496
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 49897       75.00GB    (49898/0/0) 157278496
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
partition> q

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        scsi       - independent SCSI mode selects
        cache      - enable, disable or query SCSI disk cache
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
[root@virtual-v01]# zpool add rpool2 c0d1
cannot label 'c0d1': EFI labeled devices are not supported on root pools.
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: resilvered 47.0G in 0h6m with 0 errors on Fri Dec  6 13:24:56 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          c0d0s0    ONLINE       0     0     0
errors: No known data errors
[root@virtual-v01]# zpool add rpool2 c0d1s0
cannot add to 'rpool2': root pool can not have multiple vdevs or separate logs
[root@virtual-v01]# format c0d0
selecting c0d0
[disk formatted]
/dev/dsk/c0d0s0 is part of active ZFS pool rpool2. Please see zpool(1M).
/dev/dsk/c0d0s2 is part of active ZFS pool rpool2. Please see zpool(1M).

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> p

PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 49930 + 2 (reserved cylinders)
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 49929       60.00GB    (49930/0/0) 125823600
  1 unassigned    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 49929       60.00GB    (49930/0/0) 125823600
  3 unassigned    wu       0                0         (0/0/0)             0
  4 unassigned    wu       0                0         (0/0/0)             0
  5 unassigned    wu       0                0         (0/0/0)             0
  6 unassigned    wu       0                0         (0/0/0)             0
  7 unassigned    wu       0                0         (0/0/0)             0
partition> q

FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
[root@virtual-v01]# zpool attach rpool2 c0d0s0 c0d1s0
Make sure to wait until resilver is done before rebooting.
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scan: resilver in progress since Mon Feb  8 15:15:46 2016
    2.27G scanned out of 56.8G at 66.3M/s, 0h14m to go
    2.27G resilvered, 3.99% done
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c0d0s0  ONLINE       0     0     0
            c0d1s0  ONLINE       0     0     0  (resilvering)
errors: No known data errors
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scan: resilver in progress since Mon Feb  8 15:15:46 2016
    55.3G scanned out of 56.8G at 135M/s, 0h0m to go
    55.3G resilvered, 97.32% done
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c0d0s0  ONLINE       0     0     0
            c0d1s0  ONLINE       0     0     0  (resilvering)
errors: No known data errors
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: resilvered 56.8G in 0h7m with 0 errors on Mon Feb  8 15:23:05 2016
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c0d0s0  ONLINE       0     0     0
            c0d1s0  ONLINE       0     0     0
errors: No known data errors
[root@virtual-v01]# zfs list
NAME                                  USED  AVAIL  REFER  MOUNTPOINT
rpool2                               57.5G  1.10G   106K  /rpool
rpool2/ROOT                          20.8G  1.10G    31K  legacy
rpool2/ROOT/aBE01252016              14.2G  1.10G  11.0G  /
rpool2/ROOT/aBE01252016@aBE01252016  3.20G      -  12.9G  -
rpool2/ROOT/pBE10202015              6.59G  1.10G  17.0G  /
rpool2/dump                          16.0G  1.10G  16.0G  -
rpool2/export                        8.98M  1.10G    32K  /export
rpool2/export/home                   8.95M  1.10G  8.95M  /export/home
rpool2/swap                          20.6G  1.73G  20.0G  -
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: resilvered 56.8G in 0h7m with 0 errors on Mon Feb  8 15:23:05 2016
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c0d0s0  ONLINE       0     0     0
            c0d1s0  ONLINE       0     0     0
errors: No known data errors

[root@virtual-v01]# zpool detach rpool2 c0d0s0
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: resilvered 56.8G in 0h7m with 0 errors on Mon Feb  8 15:23:05 2016
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          c0d1s0    ONLINE       0     0     0
errors: No known data errors
[root@virtual-v01]# installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c0d1s0
[root@virtual-v01]#
[root@virtual-v01]# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        59G    11G   1.1G    91%    /
[root@virtual-v01]# uname -a
SunOS virtual-v01 5.10 Generic_150400-30 sun4v sparc sun4v
[root@virtual-v01]# zpool scrub rpool2
[root@virtual-v01]# zpool status
  pool: rpool2
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: scrub in progress since Mon Feb  8 15:26:29 2016
    1.52G scanned out of 56.8G at 260M/s, 0h3m to go
    0 repaired, 2.68% done
config:
        NAME        STATE     READ WRITE CKSUM
        rpool2      ONLINE       0     0     0
          c0d1s0    ONLINE       0     0     0
errors: No known data errors
[root@virtual-v01]# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        59G    11G   1.1G    91%    /
[root@virtual-v01]# zpool set autoexpand=on rpool2
[root@virtual-v01]# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        73G    11G   1.1G    91%    /
[root@virtual-v01]# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        73G    11G    16G    42%    /
[root@virtual-v01]#

[root@virtual-v01]# df -h /
Filesystem             size   used  avail capacity  Mounted on
rpool2/ROOT/aBE01252016
                        73G    11G    16G    42%    /
[root@virtual-v01]# zfs list
NAME                                  USED  AVAIL  REFER  MOUNTPOINT
rpool2                               57.5G  15.9G   106K  /rpool
rpool2/ROOT                          20.8G  15.9G    31K  legacy
rpool2/ROOT/aBE01252016              14.2G  15.9G  11.0G  /
rpool2/ROOT/aBE01252016@aBE01252016  3.20G      -  12.9G  -
rpool2/ROOT/pBE10202015              6.59G  15.9G  17.0G  /
rpool2/dump                          16.0G  15.9G  16.0G  -
rpool2/export                        8.98M  15.9G    32K  /export
rpool2/export/home                   8.95M  15.9G  8.95M  /export/home
rpool2/swap                          20.6G  16.5G  20.0G  -
[root@virtual-v01]#

Now, initiate a reboot command
Verify you are rebooting right server.
[root@virtual-v01]# ifconfig -a
[root@virtual-v01]# init 6

Now, login to console for LDOM
[root@physical-p01]# ldm list virtual-v01
NAME             STATE      FLAGS   CONS    VCPU  MEMORY   UTIL  UPTIME
virtual-v01      active     -n----  5002    16    4G       2.9%  13d 22h 29m
[root@physical-p01]# telnet 0 5002
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
Connecting to console "virtual-v01" in group "virtual-v01" ....
Press ~? for control options ..


virtual-v01 console login: kbhusal
Password:
Last login: Mon Feb  8 14:01:03 from 172.16.253.250
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
[kbhusal@virtual-v01]$ sudo su -
Feb  8 15:29:20 virtual-v01 sudo:  kbhusal : TTY=console ; PWD=/export/home/kbhusal ; USER=root ; C               OMMAND=/usr/bin/su -
Feb  8 15:29:20 virtual-v01 su: 'su root' succeeded for kbhusal on /dev/console
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
You have new mail.
[root@virtual-v01]# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
vnet0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.222.102.48 netmask ffffff80 broadcast 10.222.102.127
        ether 0:14:4f:fb:f0:11
[root@virtual-v01]# init 6
[root@virtual-v01]# svc.startd: The system is coming down.  Please wait.
svc.startd: 80 system services are now being stopped.
syncing file systems... done
rebooting...
Resetting...

SPARC T4-4, No Keyboard
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.34.2.a, 4096 MB memory available, Serial #83537352.
Ethernet address 0:14:4f:fa:ad:c8, Host ID: 84faadc8.

Boot device: disk  File and args:
detached mirror
Can't mount root
Evaluating:
The file just loaded does not appear to be executable.
{0} ok boot -L

SPARC T4-4, No Keyboard
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.34.2.a, 4096 MB memory available, Serial #83537352.
Ethernet address 0:14:4f:fa:ad:c8, Host ID: 84faadc8.

Boot device: /virtual-devices@100/channel-devices@200/disk@0  File and args: -L
detached mirror
Can't mount root
Evaluating:
The file just loaded does not appear to be executable.
{0} ok boot /virtual-devices@100/channel-devices@200/disk@0

SPARC T4-4, No Keyboard
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.34.2.a, 4096 MB memory available, Serial #83537352.
Ethernet address 0:14:4f:fa:ad:c8, Host ID: 84faadc8.

Boot device: /virtual-devices@100/channel-devices@200/disk@0  File and args:
detached mirror
Can't mount root
Evaluating:
The file just loaded does not appear to be executable.
{0} ok printenv
Variable Name           Value                          Default Value
ttya-rts-dtr-off        false                          false
ttya-ignore-cd          true                           true
keyboard-layout
reboot-command
security-mode           none                           No default
security-password                                      No default
security-#badlogins     0                              No default
verbosity               min                            min
diag-switch?            false                          false
local-mac-address?      true                           true
fcode-debug?            false                          false
scsi-initiator-id       7                              7
oem-logo                                               No default
oem-logo?               false                          false
oem-banner                                             No default
oem-banner?             false                          false
ansi-terminal?          true                           true
screen-#columns         80                             80
screen-#rows            34                             34
ttya-mode               9600,8,n,1,-                   9600,8,n,1,-
output-device           virtual-console                virtual-console
input-device            virtual-console                virtual-console
auto-boot-on-error?     false                          false
load-base               16384                          16384
auto-boot?              false                          true
network-boot-arguments
boot-command            boot                           boot
boot-file
boot-device             disk net                       disk net
multipath-boot?         false                          false
boot-device-index       0                              0
use-nvramrc?            false                          false
nvramrc
error-reset-recovery    boot                           boot
{0} ok boot disk1

SPARC T4-4, No Keyboard
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.34.2.a, 4096 MB memory available, Serial #83537352.
Ethernet address 0:14:4f:fa:ad:c8, Host ID: 84faadc8.

Boot device: /virtual-devices@100/channel-devices@200/disk@0  File and args: disk1
detached mirror
Can't mount root
Evaluating:
The file just loaded does not appear to be executable.
{0} ok show-disks
a) /virtual-devices@100/channel-devices@200/disk@1
b) /virtual-devices@100/channel-devices@200/disk@0
c) /iscsi-hba/disk
q) NO SELECTION
Enter Selection, q to quit: a
/virtual-devices@100/channel-devices@200/disk@1 has been selected.
Type ^Y ( Control-Y ) to insert it in the command line.
e.g. ok nvalias mydev ^Y
         for creating devalias mydev for /virtual-devices@100/channel-devices@200/disk@1
{0} ok nvalias altboot1 /virtual-devices@100/channel-devices@200/disk@1
{0} ok boot altboot1

SPARC T4-4, No Keyboard
Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
OpenBoot 4.34.2.a, 4096 MB memory available, Serial #83537352.
Ethernet address 0:14:4f:fa:ad:c8, Host ID: 84faadc8.

Boot device: /virtual-devices@100/channel-devices@200/disk@1  File and args:
SunOS Release 5.10 Version Generic_150400-30 64-bit
Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.
Hostname: virtual-v01
McAfee HIP Kernel Module (12/15/13 16:05:24) initializing.
NOTICE: mcafee_hip loaded
Configuring devices.

virtual-v01 console login:

[root@virtual-v01]# df -h /
[root@virtual-v01]# eeprom boot-device="altboot1 disk net"

Now, go to Control domain and remove old LUN

[root@physical-p01]# ldm remove-vdisk VDL23 virtual-v01
[root@physical-p01]# ldm remove-vdsdev DL23@primary-vds0

[root@physical-p01]# ldm list-bindings virtual-v01 | grep -i disk
    boot-device=altboot1 disk net
    nvramrc=devalias altboot1 /virtual-devices@100/channel-devices@200/disk@1
DISK
    VDL10            DL10@primary-vds0                1    disk@1  primary
[root@physical-p01]# ldm list-services | grep -i DL10
                                      DL10                                           /dev/dsk/c0t6000D310006D6400000000000000029Bd0s2
[root@physical-p01]#