Friday, 6 December 2013

Solaris 11 Boot environments


1)listing boot environments
R – Active on reboot.
N – Active now.
NR – Active now and active on reboot.
- – Inactive.
! – Unbootable boot environments in a non-global zone

i)-a – Lists all available information about the boot environment. This information includes subordinate datasets and snapshots.
root@solaris1:~# beadm list -a
BE/Dataset/Snapshot               Active Mountpoint Space  Policy Created
-------------------               ------ ---------- -----  ------ -------
solaris
   rpool/ROOT/solaris             NR     /          2.26G  static 2013-11-01 16:22
   rpool/ROOT/solaris/var         -      /var       99.24M static 2013-11-01 16:22
   rpool/ROOT/solaris/var@install -      -          1.49M  static 2013-11-01 16:46
   rpool/ROOT/solaris@install     -      -          7.24M  static 2013-11-01 16:46

ii))-d – Lists information about all subordinate datasets that belong to the boot environment.
root@solaris1:~# beadm list -d
BE/Dataset                Active Mountpoint Space  Policy Created
----------                ------ ---------- -----  ------ -------
solaris
   rpool/ROOT/solaris     NR     /          2.26G  static 2013-11-01 16:22
   rpool/ROOT/solaris/var -      /var       99.24M static 2013-11-01 16:22

iii))-s – Lists information about the snapshots of the boot environment.
root@solaris1:~# beadm list -s
BE/Snapshot        Space Policy Created
-----------        ----- ------ -------
solaris
   solaris@install 7.24M static 2013-11-01 16:46

iv))-H – Lists information in machine-parseable format. Each field in the output is separated by a semicolon.
root@solaris1:~# beadm list -H
solaris;092d808e-a0a1-eb6a-f710-8c82e74ff6a7;NR;/;2541666816;static;1383322929
2)To create Boot environment
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
root@solaris1:~# beadm create test1
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test1   -      -          71.0K static 2013-12-06 16:43

3)To mount Boot Environment
root@solaris1:~# beadm mount test1 /test
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test1   -      /test      71.0K static 2013-12-06 16:43
root@solaris1:~# df -h /test
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/test1       9.8G   2.2G       4.4G    33%    /test

root@solaris1:~# df -h
Filesystem             Size   Used  Available Capacity  Mounted on
rpool/ROOT/solaris     9.8G   2.2G       4.4G    33%    /
/devices                 0K     0K         0K     0%    /devices
/dev                     0K     0K         0K     0%    /dev
ctfs                     0K     0K         0K     0%    /system/contract
proc                     0K     0K         0K     0%    /proc
mnttab                   0K     0K         0K     0%    /etc/mnttab
swap                   3.5G   2.2M       3.5G     1%    /system/volatile
objfs                    0K     0K         0K     0%    /system/object
sharefs                  0K     0K         0K     0%    /etc/dfs/sharetab
fd                       0K     0K         0K     0%    /dev/fd
rpool/ROOT/solaris/var
                       9.8G    98M       4.4G     3%    /var
swap                   3.5G     0K       3.5G     0%    /tmp
rpool/VARSHARE         9.8G    63K       4.4G     1%    /var/share
rpool/export           9.8G    32K       4.4G     1%    /export
rpool/export/home      9.8G    31K       4.4G     1%    /export/home
rpool                  9.8G    73K       4.4G     1%    /rpool
rpool/ROOT/test1       9.8G   2.2G       4.4G    33%    /test
rpool/ROOT/test1/var   9.8G    98M       4.4G     3%    /test/var

4)to install a required pkgs on mounted boot env
# pkg -R /test install package-name

5)to unmount BE
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test1   -      /test      71.0K static 2013-12-06 16:43
root@solaris1:~# beadm unmount test1
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test1   -      -          80.0K static 2013-12-06 16:43

6)To destroy BE
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test1   -      -          80.0K static 2013-12-06 16:43
root@solaris1:~# beadm destroy test1
Are you sure you want to destroy test1?  This action cannot be undone(y/[n]): y
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22

7)To activate specific BE
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
root@solaris1:~# beadm create test
beadm list
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris NR     /          2.37G static 2013-11-01 16:22
test    -      -          71.0K static 2013-12-06 16:50
root@solaris1:~# beadm activate test
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris N      /          47.0K static 2013-11-01 16:22
test    R      -          2.37G static 2013-12-06 16:50

8)To deactivate test BE on next Reboot
root@solaris1:~# beadm list
BE      Active Mountpoint Space Policy Created
--      ------ ---------- ----- ------ -------
solaris N      /          47.0K static 2013-11-01 16:22
test    R      -          2.37G static 2013-12-06 16:50
root@solaris1:~# beadm activate solaris
root@solaris1:~# beadm list
BE      Active Mountpoint Space  Policy Created
--      ------ ---------- -----  ------ -------
solaris NR     /          2.37G  static 2013-11-01 16:22
test    -      -          261.0K static 2013-12-06 16:50

9)To rename BE
root@solaris1:~# beadm rename test newtest
root@solaris1:~# beadm list
BE      Active Mountpoint Space  Policy Created
--      ------ ---------- -----  ------ -------
newtest -      -          261.0K static 2013-12-06 16:50
solaris NR     /          2.37G  static 2013-11-01 16:22

10)To create Snapshot
root@solaris1:~# beadm create newtest@snap1
root@solaris1:~# beadm list -s
BE/Snapshot                    Space Policy Created
-----------                    ----- ------ -------
newtest
   newtest@snap1               0     static 2013-12-06 16:54
solaris
   solaris@2013-12-06-16:50:05 0     static 2013-12-06 16:50
   solaris@install             7.24M static 2013-11-01 16:46

11)to create new BE from existing Snapshot
root@solaris1:~# beadm create -e newtest@snap1 test2
root@solaris1:~# beadm list
BE      Active Mountpoint Space  Policy Created
--      ------ ---------- -----  ------ -------
newtest -      -          400.0K static 2013-12-06 16:50
solaris NR     /          2.37G  static 2013-11-01 16:22
test2   -      -          61.0K  static 2013-12-06 16:56

12)now -->BE -->snap BE--->cloned BE ===> now delete snap BE??? (if i delete cloned be my snapshot also deleted)
root@solaris1:~# beadm create -e newtest newtest@snap1
root@solaris1:~# beadm create -e newtest@snap1 test2
root@solaris1:~# beadm destroy newtest@snap1
Are you sure you want to destroy newtest@snap1?  This action cannot be undone(y/[n]): y
be_destroy_snapshot: failed to destroy snapshot newtest@snap1: snapshot is cloned
Unable to destroy newtest@snap1.
BE exists.
root@solaris1:~# beadm list -s
BE/Snapshot                    Space Policy Created
-----------                    ----- ------ -------
newtest
   newtest@snap1               68.0K static 2013-12-06 16:58
solaris
   solaris@2013-12-06-16:50:05 0     static 2013-12-06 16:50
   solaris@install             7.24M static 2013-11-01 16:46
test2
root@solaris1:~# beadm destroy test2
Are you sure you want to destroy test2?  This action cannot be undone(y/[n]): y
root@solaris1:~# beadm list -s
BE/Snapshot                    Space Policy Created
-----------                    ----- ------ -------
newtest
solaris
   solaris@2013-12-06-16:50:05 0     static 2013-12-06 16:50
   solaris@install             7.24M static 2013-11-01 16:46
13)To create BE on anoter zPool
root@solaris1:~# zpool create testpool c2d7
root@solaris1:~# beadm create -p testpool testbe
Now starts copying rpool data to testpool
root@solaris1:~# zpool iostat -lv testpool 5
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
testpool     460M  19.4G      0     12  1.03K  2.80M
  c2d7       460M  19.4G      0     12  1.03K  2.80M
----------  -----  -----  -----  -----  -----  -----

root@solaris1:~# zpool iostat -lv  5
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
rpool       5.26G  4.67G      1      3   123K  28.6K
  c2d1s0    5.26G  4.67G      1      3   123K  28.6K
----------  -----  -----  -----  -----  -----  -----
testpool     492M  19.4G      0     12    995  2.81M
  c2d7       492M  19.4G      0     12    995  2.81M
----------  -----  -----  -----  -----  -----  -----
;
;
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
rpool       5.26G  4.67G     36      0  2.82M      0
  c2d1s0    5.26G  4.67G     36      0  2.82M      0
----------  -----  -----  -----  -----  -----  -----
testpool     844M  19.1G      0     11      0  3.75M
  c2d7       844M  19.1G      0     11      0  3.75M
----------  -----  -----  -----  -----  -----  -----
;
;
;
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
rpool       4.27G  5.67G      0      0      0      0
  c2d1s0    4.27G  5.67G      0      0      0      0
----------  -----  -----  -----  -----  -----  -----
testpool    2.25G  17.6G      0      0      0      0
  c2d7      2.25G  17.6G      0      0      0      0
----------  -----  -----  -----  -----  -----  -----
root@solaris1:~# beadm list
BE      Active Mountpoint Space  Policy Created
--      ------ ---------- -----  ------ -------
newtest -      -          261.0K static 2013-12-06 16:50
solaris NR     /          2.37G  static 2013-11-01 16:22
testbe  -      -          2.35G  static 2013-12-06 17:04
root@solaris1:~# beadm mount testbe /mnt
root@solaris1:~# cd /mnt
root@solaris1:/mnt# ls
b         dev       home      mnt       platform  sbin      tmp
bin       devices   kernel    net       proc      system    usr
boot      etc       lib       nfs4      root      test      var
core      export    media     opt       rpool     testpool
root@solaris1:/mnt# cd

root@solaris1:~# beadm umount testbe
root@solaris1:~# beadm destroy testbe
Are you sure you want to destroy testbe?  This action cannot be undone(y/[n]): y
root@solaris1:~# zpool list
NAME       SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool     9.94G  4.27G  5.67G  42%  1.00x  ONLINE  -
testpool  19.9G   233K  19.9G   0%  1.00x  ONLINE  -


 

No comments:

Post a Comment