Przejdź do treści

🌐 Solaris Userland Differences

Solaris userland differs significantly from other Unix systems due to its enterprise heritage and Oracle's enhancements. Understanding these differences is crucial for effective Solaris administration.


🎯 Core Philosophy Differences

Enterprise-Focused Design

Solaris prioritizes enterprise requirements over desktop usability:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Enterprise features built-in
# - Advanced resource management
# - Comprehensive monitoring tools
# - Enterprise service management (SMF)
# - Robust security frameworks
# - Scalable architecture

# Compare with other Unix systems
# Linux: Community-driven, flexible
# BSD: Security-focused, minimalist
# Solaris: Enterprise-focused, integrated

Standards Compliance

Solaris balances POSIX compliance with enterprise needs:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# POSIX compliance
# Most standard utilities available
# Some extensions beyond POSIX

# System V heritage
# Traditional SysV init system (pre-Solaris 10)
# SMF (Service Management Facility) in modern versions
# SysV IPC mechanisms

# Solaris extensions
# DTrace for dynamic tracing
# ZFS filesystem
# Zones for OS-level virtualization

🔧 Command Line Tools

Enhanced System Utilities

Solaris provides enterprise-grade system utilities:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Process management
prstat              # Enhanced top-like utility
ptree               # Process tree viewer
pargs               # Process arguments
pmap                # Process memory map
plimit              # Process resource limits

# System monitoring
sar                 # System activity reporter
iostat              # I/O statistics
vmstat              # Virtual memory statistics
mpstat              # Per-processor statistics
netstat             # Network statistics

# File system tools
zfs                 # ZFS management
zpool               # ZFS pool management
fsck                # File system check
df                  # Disk space usage
du                  # Disk usage

# Network tools
snoop               # Packet sniffer
dladm               # Data link administration
ipadm               # IP address management
flowadm             # Flow management

Traditional vs Enhanced Commands

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Traditional commands with Solaris enhancements
ps -ef              # Standard format
ps -eo pid,ppid,uid,args  # Custom format with Solaris fields

# Enhanced alternatives
prstat              # Better than top
ptree               # Better than pstree

# Package management evolution
pkginfo/pkgadd      # Traditional SVR4 packages (Solaris 10 and earlier)
pkg                 # IPS (Image Packaging System) (Solaris 11+)

# Service management
/etc/init.d/        # Traditional init scripts (Solaris 10 and earlier)
svcs/svcadm         # SMF (Service Management Facility) (Solaris 10+)

📋 File System and Storage

ZFS Integration

Solaris pioneered ZFS, now a key differentiator:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ZFS management
zpool create tank /dev/rdsk/c0t0d0s0  # Create pool
zfs create tank/data                     # Create filesystem
zfs set compression=lz4 tank/data        # Enable compression
zfs snapshot tank/[email protected]         # Create snapshot

# ZFS features
# - Copy-on-write
# - Snapshots
# - Clones
# - Compression
# - Deduplication
# - Built-in quotas and reservations

# Traditional filesystems
ufs                 # Unix File System
hsfs                # High Sierra filesystem (CD-ROM)
pcfs                # PC filesystem (FAT)

# File system management
mount -F zfs tank/data /mnt/data  # Mount ZFS
umount /mnt/data                  # Unmount

Storage Management

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Disk management
format              # Disk formatting and partitioning
prtvtoc            # Print volume table of contents
fmthard            # Format hard disk

# Volume management
metastat            # Solaris Volume Manager status
metainit            # Initialize metadevice
luxadm              # FCAL disk management

# Device management
cfgadm              # Configuration administration
devfsadm            # Device filesystem administration

🌐 Network Management

Advanced Networking Features

Solaris provides enterprise networking capabilities:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Network interface management
ifconfig            # Interface configuration
dladm               # Data link administration (Solaris 11+)
ipadm               # IP address management (Solaris 11+)

# Network virtualization
dladm create-vnic   # Create virtual NIC
ipadm create-ip     # Create IP interface
flowadm             # Flow management

# Network monitoring
snoop               # Packet sniffer
netstat             # Network statistics
ndd                 # Network driver debugging

# Network services
svcs network/*      # Network services
svcadm enable network/physical  # Enable network

# Load balancing and high availability
dladm show-linkagg  # Link aggregation
ipmpadm             # IP multipathing

Network Security

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# IP Filter
ipf                 # IP filter management
ipfs                # IP filter statistics
ipnat               # IP NAT configuration

# Network security
ipsecadm            # IPsec administration
ikeadm              # IKE administration

# Network isolation
zones               # OS-level virtualization
exclusive IP instances
shared IP instances

🛠️ Development Environment

Compiler and Build Tools

Solaris provides Oracle-developed tools:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Oracle Developer Studio
cc                  # C compiler
CC                  # C++ compiler
f77                 # Fortran 77 compiler
f95                 # Fortran 95 compiler

# GNU tools (if installed)
gcc                 # GNU C compiler
g++                 # GNU C++ compiler
gmake               # GNU make

# Build automation
make                # Standard make
gmake               # GNU make (if installed)
cmake               # CMake (if installed)

# Version control
sccs                # Source Code Control System
svn                 # Subversion (if installed)
git                 # Git (if installed)

System Call Interface

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Solaris system calls
# Many POSIX-standard calls
# Some Solaris-specific extensions

# Process management
fork(), exec(), wait()  # Standard
priocntl()              # Process scheduling control
pset_*()                # Processor set management

# Memory management
mmap(), munmap()        # Standard
memcntl()               # Memory control

🎨 Service Management

Service Management Facility (SMF)

Solaris introduced SMF for robust service management:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# SMF commands
svcs                # List services
svcs -a             # List all services
svcs network/ssh    # Check specific service
svcs -l network/ssh # Detailed service information

# Service control
svcadm enable service_name    # Enable service
svcadm disable service_name   # Disable service
svcadm restart service_name   # Restart service
svcadm refresh service_name   # Refresh configuration

# Service configuration
svcprop service_name          # Show properties
svccfg -s service_name setprop property=value  # Set property
svccfg import manifest.xml    # Import manifest

# Service dependencies
# Automatic dependency resolution
# Service restart on dependency changes
# Graceful shutdown ordering

Traditional vs SMF Services

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Traditional init scripts (Solaris 10 and earlier)
/etc/init.d/        # Service scripts
/etc/rc*.d/         # Run level directories

# SMF manifests
/var/svc/manifest/  # Service manifests
/lib/svc/manifest/  # System manifests

# Service states
online              # Service running
offline             # Service disabled
maintenance         # Service in maintenance mode
degraded            # Service partially functional

🔍 Advanced Features

Dynamic Tracing (DTrace)

Solaris pioneered DTrace for system observability:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# DTrace basics
dtrace -l           # List probes
dtrace -n 'probe'   # Execute one-liner
dtrace -s script.d  # Execute script

# Example probes
syscall::open:entry { printf("Opening file: %s\n", copyinstr(arg0)); }
fbt:::entry /pid == $1/ { @["kernel functions"] = count(); }

# DTrace providers
# syscall - system calls
# fbt - function boundary tracing
# io - I/O operations
# proc - process management

Containers and Virtualization

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Solaris Zones
zoneadm             # Zone administration
zonecfg             # Zone configuration
zlogin              # Login to zone

# Zone types
# Global zone
# Non-global zones
# Whole root zones
# Sparse root zones

# Resource management
prctl               # Process resource controls
projects            # Project management

🧾 Summary Comparison

Key Differences from Other Unix Systems

Feature Solaris Linux BSD
Service Management SMF systemd/init rc/init
File System ZFS native Various (ext4, XFS, Btrfs) UFS, ZFS
Virtualization Zones Containers Jails
Monitoring DTrace eBPF DDB
Package Management IPS/SVR4 RPM/DEB pkgsrc/pkg
Default Shell ksh/bash bash ksh

Migration Considerations

When moving to Solaris: - Learn SMF service management - Understand ZFS capabilities - Familiarize with DTrace - Adapt to Oracle toolchain - Understand enterprise security model

Differences to watch for: - Different command locations - Alternative system configuration - Unique security model - Modified command-line options - Distinct performance tuning


🧠 Best Practices

Solaris Administration Guidelines

  1. Service Management: Use SMF for service control
  2. Storage: Leverage ZFS for advanced storage features
  3. Monitoring: Utilize DTrace for system observability
  4. Security: Implement enterprise security frameworks
  5. Performance: Use built-in monitoring and tuning tools
  6. Networking: Leverage advanced networking features
  7. Virtualization: Use zones for application isolation

Cross-Platform Development

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Detect Solaris vs other systems
if [ "$(uname -s)" = "SunOS" ]; then
    # Solaris-specific commands
    prstat 1 1
else
    # Linux/BSD commands
    top -b -n 1
fi

# Portable path handling
if [ -d "/usr/sfw" ]; then
    # Solaris-specific paths
    PATH="/usr/sfw/bin:$PATH"
fi

# Service management abstraction
manage_service() {
    local service_name="$1"
    local action="$2"

    if command -v svcs >/dev/null 2>&1; then
        # Solaris SMF
        case "$action" in
            start) svcadm enable "$service_name" ;;
            stop) svcadm disable "$service_name" ;;
            restart) svcadm restart "$service_name" ;;
        esac
    else
        # Traditional init
        case "$action" in
            start) /etc/init.d/"$service_name" start ;;
            stop) /etc/init.d/"$service_name" stop ;;
            restart) /etc/init.d/"$service_name" restart ;;
        esac
    fi
}

Performance Monitoring

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# System monitoring script
solaris_monitor() {
    echo "=== Solaris System Monitor ==="

    # CPU usage
    mpstat 1 1

    # Memory usage
    vmstat 1 1

    # I/O statistics
    iostat -x 1 1

    # Network statistics
    netstat -i

    # ZFS statistics
    zpool iostat 1 1

    # Service status
    svcs -x  # Show services in non-default states

    echo "=== Monitor Complete ==="
}

🧾 See Also