Thursday, July 28, 2016

Hoy to copy a file from Solaris Global Zone to a Kernel Zone without a network

I posted this Tweet on twitter a while ago
Damn wish there was a way to copy a file from global zone to a kernel zone with out going over network.
and Darren Moffat pointed out a /system/shared which is read only from the zone but is writeable from the global zone. Here is a quick example:

Hoy to copy a file from Solaris Global Zone to a Kernel Zone without a network

I posted this Tweet on twitter a while ago
Damn wish there was a way to copy a file from global zone to a kernel zone with out going over network.
and Darren Moffat pointed out a /system/shared which is read only from the zone but is writeable from the global zone.
solaris-kz# ls /system/shared/
solaris-kz# touch /system/shared/ReadOnly
touch: cannot create /system/shared/ReadOnly: Read-only file system

solaris-kz# df /system/shared/
/system/shared     (/dev/kz/sdir/shared@0):296322344 blocks 28136253 files


global-zone# zoneadm list -vc
  ID NAME        STATUS   PATH  BRAND      IP   
   0 global      running  /     solaris    shared
   1 solaris-kz  running  -     solaris-kz excl 


global-zone# ls /system/volatile/zones/solaris-kz/zonepath/root/shared/
global-zone# touch /system/volatile/zones/mysqlsrv/zonepath/root/shared/myfile   

solaris-kz# ls /system/shared/
myfile

Monday, July 11, 2016

Compile GEOS geometry library on Solaris 11 using Oracle Developer Studio 12.5

This is a follow on from my posts about installing PostGIS in those posts I used GNU compilers, but I have managed to get parts to compile with Developer Studio 12.5.

If you are looking for the GNU version then it is here: Compile PostgreGIS (GEOS geometry library) on Solaris 11 (11.3) using gcc

Compile Proj4 reprojection library on Solaris 11 using Oracle Developer Studio 12.5

This is a follow on from my posts about installing PostGIS in those posts I used GNU compilers, but I have managed to get parts to compile with Developer Studio 12.5.

If you are looking for the GNU version then it is here: Compile PostgreGIS (Proj4 reprojection library) on Solaris 11 (11.3) using gcc

Monday, July 04, 2016

Install PostGIS on Solaris 11 (11.3)

I said I would install PostGIS for a student project but I wish I never said yes, since it has taken over a week to compile it.

As you may guess there are not many working instruction out in the wild!

I will break down this step-by-step guide into different blogs entries otherwise it will get very long.
I had to compile all software using GCC since Solaris Studio gave to many problems:

Compile PostgreGIS (GDAL) on Solaris 11 (11.3)

Before you install PostGIS you will need to install some of the requirements.

GDAL. is a translator library for raster and vector geospatial data format.

Compile PostgreGIS (GEOS geometry library) on Solaris 11 (11.3)

Before you install PostGIS you will need to install some of the requirements.

GEOS geometry library, version 3.3 or greater, but GEOS 3.5+ is recommended to take full advantage of all the new functions and features.

Compile PostgreGIS (Proj4 reprojection library) on Solaris 11 (11.3)

Before you install PostGIS you will need to install some of the requirements.

Proj4 reprojection library is used to provide coordinate reprojection support within PostGIS.

Compile PostgreSQL on Solaris 11 (11.3)

I know PostgreSQL is available as a binary from http://www.postgresql.org and to be honest I have always used it but just in case you need to go down the PostGIS route then you may need to recompile it.

References: PostgreSQL 9.5.3 Documentation

# pkg install developer/gcc-45 build/gnu-make
# export PATH=/usr/gcc/4.5/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/lib:/usr/gnu/bin:
# bzip2 -dc postgresql-9.5.3.tar.bz2 | tar xf -
# cd postgresql-9.5.3

Tuesday, June 28, 2016

Install PostgreSQL on Solaris 11 (11.3)

Here are some quick instruction on how to install PostgreSQL on Solaris 11.3.
  • PostgreSQL 9.5: http://www.postgresql.org/

Add a user

At this time  postgres user exists on Solaris, so I am going to use that, but just in case then:

# groupadd -g 90 postgres
# useradd -u 90 -S files -s /usr/bin/pfksh -d / -g postgres postgres
# grep postgres /etc/passwd  /etc/group
/etc/passwd:postgres:x:90:90:PostgreSQL Reserved UID:/:/usr/bin/pfksh
/etc/group:postgres::90:

Setup

Tuesday, June 21, 2016

Convert Oracle Solaris 11.3 Native (Non-Global) Zone to a Kernel Zone

I think more and more people will start using Kernel Zone and I have a feeling that will soon be the only zone that Solaris will offer soon. So, I thought I would show how to convert a none-global zone into a kernel zone.

References:

Create archive of existing zone

# zoneadm list -vc
  ID NAME       STATUS     PATH             BRAND      IP   
   0 global     running    /                solaris    shared
   1 helios     running    /zones/helios    solaris    excl 
   2 artemis    running    /zones/artemis   solaris    excl 

# archiveadm create -z artemis /var/tmp/artemis.uar
Initializing Unified Archive creation resources...
Unified Archive initialized: /var/tmp/artemis.uar
Logging to: /system/volatile/archive_log.7907
Executing dataset discovery...
Dataset discovery complete
Creating install media for zone(s)...
Media creation complete
Preparing archive system image...
Beginning archive stream creation...
Archive stream creation complete
Beginning final archive assembly...
Archive creation complete
# archiveadm info -v /var/tmp/artemis.uar
Archive Information
          Creation Time:  2016-06-21T12:30:51Z
            Source Host:  atlas
           Architecture:  i386
       Operating System:  Oracle Solaris 11.3 X86
       Recovery Archive:  No
              Unique ID:  bd4c3056-52f6-4d74-b049-9039aad4aa22
        Archive Version:  1.0

Deployable Systems
         'artemis'
             OS Version:  0.5.11
              OS Branch:  0.175.3.3.0.5.0
              Active BE:  solaris-7
                  Brand:  solaris
            Size Needed:  3.6GB
              Unique ID:  b9cc8f53-6260-4372-99ba-ede593895a90
               AI Media:  0.175.3_ai_i386.iso
              Root-only:  Yes

Create new Kernel Zone

Create the zone configuration file and alter it to your liking:
# zonecfg -z apollo create -t SYSsolaris-kz
I used the above to get a skeleton and then modified it to get what I wanted:
  • Bare metal host is using link aggregation (lower-link=trunk0)
  • Bare metal host uses VLAN so I let the zone do all the work (set vlan-id=29)  
  • Using ISCSI as my root disk (set storage=iscsi, set bootpri=0, set id=0)
  • Adding another ISCSI disk to this zone (set storage=iscsi, set id=1)
  • Capping memory and cpus ( set physical=12G, set ncpus=4)
# zonecfg -z apollo export
create -b
set brand=solaris-kz
set autoboot=false
set autoshutdown=shutdown
set hostid=0x778c5d85
add anet
set lower-link=trunk0
set allowed-address=193.x.x.x/24
set configure-allowed-address=true
set defrouter=193.x.x.245
set link-protection=mac-nospoof
set mac-address=random
set vlan-id=29
set id=0
end
add device
set storage=iscsi:///target.iqn.2016-04.uk.ac.bbk.dcs:dss.lv0009,lun.0
set bootpri=0
set id=0
end
add device
set storage=iscsi:///target.iqn.2016-04.uk.ac.bbk.dcs:dss.lv0010,lun.0
set id=1
end
add capped-memory
set physical=12G
set pagesize-policy=largest-available
end
add virtual-cpu
set ncpus=4
end
Start the install:
  • "-x install-size=24G" The size of the rpool it will create for Solaris
  • "-c /tmp/apollo.xml" get the system configuration settings from the profile file (see sysconfig)
  • add "-x force-zpool-create=rpool" if this NOT your first attempt to install this zone. Which tells the system that YES there is a zone already on this disk and YES I want to overwrite it.
# zoneadm -z apollo install -a /var/tmp/artemis.uar -x install-size=24G -c /tmp/apollo.xml
Progress being logged to /var/log/zones/zoneadm.20160621T145705Z.apollo.install
[Connected to zone 'apollo' console]
Boot device: cdrom2  File and args: /platform/i86pc/kernel/amd64/unix -B install=true -B aimanifest=/system/shared/ai.xml -B profile=/system/shared/sysconfig/
reading module /platform/i86pc/amd64/boot_archive...done.
reading kernel file /platform/i86pc/kernel/amd64/unix...done.
SunOS Release 5.11 Version 11.3 64-bit
Copyright (c) 1983, 2016, Oracle and/or its affiliates. All rights reserved.
Jun 21 14:57:27 auditd[15]: getaddrinfo() failed[node name or service name not known].
Jun 21 14:57:27 auditd[15]: adt_get_local_address couldn't get 26 addrlist socket: Address family not supported by protocol family: Bad file number.
Jun 21 14:57:27 auditd[15]: adt_get_local_address failed, no Audit IP address available, faking loopback for  and error Network is down.
Remounting root read/write
Probing for device nodes ...
Jun 21 14:57:28 auditd[35]: getaddrinfo() failed[node name or service name not known].
Jun 21 14:57:28 auditd[35]: adt_get_local_address failed, no Audit IP address available, faking loopback for  and error Network is down.
Jun 21 14:57:29 auditd[46]: getaddrinfo() failed[node name or service name not known].
Jun 21 14:57:29 auditd[46]: adt_get_local_address failed, no Audit IP address available, faking loopback for  and error Network is down.
Jun 21 14:57:30 auditd[52]: getaddrinfo() failed[node name or service name not known].
Jun 21 14:57:30 auditd[52]: adt_get_local_address failed, no Audit IP address available, faking loopback for  and error Network is down.
Jun 21 14:57:30 auditd[56]: getaddrinfo() failed[node name or service name not known].
Jun 21 14:57:30 auditd[56]: adt_get_local_address failed, no Audit IP address available, faking loopback for  and error Network is down.
Preparing image for use
Done mounting image
Configuring devices.
Hostname: solaris
Using specified install manifest : /system/shared/ai.xml
Using specified configuration profile(s):  /system/shared/sysconfig/

solaris console login:
Automated Installation started
The progress of the Automated Installation will be output to the console
Detailed logging is in the logfile at /system/volatile/install_log
Press RETURN to get a login prompt at any time.

14:57:50    Install Log: /system/volatile/install_log
14:57:50    Using XML Manifest: /system/volatile/ai.xml
14:57:50    Using profile specification: /system/volatile/profile
14:57:50    Starting installation.
14:57:50    0% Preparing for Installation
14:57:50    100% manifest-parser completed.
14:57:50    100% None
14:57:51    0% Preparing for Installation
14:57:51    1% Preparing for Installation
14:57:51    2% Preparing for Installation
14:57:51    3% Preparing for Installation
14:57:52    4% Preparing for Installation
14:57:52    5% archive-1 completed.
14:57:52    6% install-env-configuration completed.
14:57:52    9% target-discovery completed.
14:57:53    Pre-validating manifest targets before actual target selection
14:57:53    Selected Disk(s) : c1d0
14:57:54    Pre-validation of manifest targets completed
14:57:54    Validating combined manifest and archive origin targets
14:57:54    Selected Disk(s) : c1d0
14:57:54    9% target-selection completed.
14:57:54    10% ai-configuration completed.
14:57:54    10% var-share-dataset completed.
14:57:58    10% target-instantiation completed.
14:57:58    10% Beginning archive transfer
14:57:58    Commencing transfer of stream: b9cc8f53-6260-4372-99ba-ede593895a90-0.zfs to rpool
14:58:06    18% Transferring contents
14:58:08    23% Transferring contents
14:58:15    28% Transferring contents
14:58:17    37% Transferring contents
14:58:21    40% Transferring contents
14:58:23    43% Transferring contents
14:58:29    50% Transferring contents
14:58:31    51% Transferring contents
14:58:33    56% Transferring contents
14:58:35    64% Transferring contents
14:58:39    68% Transferring contents
14:58:41    76% Transferring contents
14:58:45    80% Transferring contents
14:58:47    88% Transferring contents
14:58:48    Completed transfer of stream: 'b9cc8f53-6260-4372-99ba-ede593895a90-0.zfs' from file:///system/shared/uafs/OVA
14:58:51    Archive transfer completed
14:59:00    89% generated-transfer-1234-1 completed.
14:59:00    89% Beginning IPS transfer
14:59:00    Setting post-install publishers to:
14:59:00        solaris
14:59:00            origin:  http://pkgs.xx.xx.xx.uk/
14:59:00    89% generated-transfer-1234-2 completed.
14:59:00    Changing target pkg variant. This operation may take a while
15:02:52    90% apply-pkg-variant completed.
15:02:52    90% update-dump-adm completed.
15:02:52    90% setup-swap completed.
15:02:52    90% device-config completed.
15:02:53    91% apply-sysconfig completed.
15:02:53    91% transfer-zpool-cache completed.
15:02:57    96% boot-archive completed.
15:02:58    Setting boot devices in firmware
15:02:58    98% boot-configuration completed.
15:02:59    98% update-filesystem-owner-group completed.
15:02:59    98% transfer-ai-files completed.
15:03:00    98% cleanup-archive-install completed.
15:03:00    100% create-snapshot completed.
15:03:00    100% None
15:03:00    Automated Installation succeeded.
15:03:00    You may wish to reboot the system at this time.
Automated Installation finished successfully
The system can be rebooted now
Please refer to the /system/volatile/install_log file for details
After reboot it will be located at /var/log/install/install_log

[NOTICE: Zone halted]
[Connection to zone 'apollo' console closed]
        Done: Installation completed in 353.178 seconds. 
# zoneadm list -vc
  ID NAME      STATUS     PATH            BRAND      IP   
   0 global    running    /               solaris    shared
   1 filesrv   running    -               solaris-kz excl 
   2 mailer2   running    /zones/mailer2  solaris    excl 
   - apollo    installed  -               solaris-kz excl 

# zoneadm -z apollo boot
# zlogin -C -e\@ apollo
[Connected to zone 'apollo' console]
Loading smf(5) service descriptions: 65/65
Configuring devices.
WARNING: fastboot_update_config failed, disabling deferred dump
Hostname: artemis
apollo console login: @.

The following show you are on a bare-metal machine that can run kernel zones:
# virtinfo
NAME            CLASS    
non-global-zone supported
kernel-zone     supported
 


# zlogin apollo
apollo:# format < /dev/null
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1d0
          /zvnex/zvblk@0
       1. c1d1
          /zvnex/zvblk@1

apollo:# zfs list
NAME                              USED  AVAIL  REFER  MOUNTPOINT
rpool                            12.8G  10.4G  33.5K  /rpool
rpool/ROOT                       4.59G  10.4G    31K  legacy
rpool/ROOT/solaris-7             4.59G  10.4G  2.43G  /
rpool/ROOT/solaris-7/var         2.09G  10.4G  2.09G  /var
rpool/VARSHARE                   2.52M  10.4G  2.43M  /var/share
rpool/VARSHARE/pkg                 63K  10.4G    32K  /var/share/pkg
rpool/VARSHARE/pkg/repositories    31K  10.4G    31K  /var/share/pkg/repositories
rpool/VARSHARE/zones               31K  10.4G    31K  /system/zones
rpool/dump                       6.19G  10.6G  6.00G  -
rpool/export                     99.5K  10.4G    32K  /export
rpool/export/home                67.5K  10.4G    32K  /export/home
rpool/export/home/rootuser       35.5K  10.4G  35.5K  /export/home/rootuser
rpool/swap                       2.06G  10.5G  2.00G  -

A quick way to find out what type of zone you are in:
apollo:# virtinfo
NAME            CLASS    
kernel-zone     current  
non-global-zone supported
I know it is a quick step-by-step quide, but hope it helps others.




Friday, November 13, 2015

Oracle Solaris 11.3: SMB 2.1 will it make a difference

As you will be aware Oracle Solaris 11.3 supports SMB 2.1 which brings improvements over SMB/Samba 3.6 version on Solaris 11.2:
  • Reduces the previous number of SMB 1.0 commands and sub commands from over a hundred to just 19 commands.
  • Supports a new caching model called Lease. This model enables the client to have multiple opens on a single file which helps in holding on to the cache.
  • Provides more scalable performance for high-speed networks and includes the following performance benefits:
    • SMB payload requests can scale up to 1MB instead of 64K.
    • Reduces CPU utilization on the server and client.
    • SMB clients gain the performance benefit of not losing local caching when the same file is opened multiple times.
Comparing SMB versions(dialect):
SMB 3.02: Windows 2012 R2
SMB 3.00: Windows 2012    , Samba 4.1
SMB 2.10: Windows 2008 R2 , Solaris 11.3
SMB 2.00: Windows 2008    , Samba 3.6 (dialect=1.5)
SMB 1.00:                 , Solaris 11.2 (dialect=1.5)

I decided to run some test on Windows 7 clients using IOzone Filesystem Benchmark to measure file performance (What you're really testing is your system's buffer cache + disk cache + disk speed combo) using a collection of different servers.

Friday, February 06, 2015

Oracle Solaris 11 Derived Manifest and modifying the boot system

This is a follow on from last last blog entry "Oracle Solaris 11 Derived Manifest with Automated Installation", where I mentioned that I could not examine the disk partitions of the new system since the aiuser does not have permission to run fdisk.

Quote: "The derived manifest script can run commands to read system attributes. AI runs the script as role aiuser. The aiuser role has all the privileges of a non-privileged user plus the following additional privileges: solaris.network.autoconf.read, solaris.smf.read.* 

The aiuser role is non-privileged except that it can read more information from the system than other non-privileged users. The aiuser role cannot change the system."