Difference between revisions of "OpenIndiana"

From Hack Sphere Labs Wiki
Jump to: navigation, search
(Erasing GPT labels)
(Managing Disks)
Line 347: Line 347:
 
then
 
then
 
  print
 
  print
 +
 +
==cfgadm way==
 +
cfgadm -al
 +
cfgadm -s "select=type(scsi-sas)"
  
 
=Erasing GPT labels=
 
=Erasing GPT labels=

Revision as of 15:44, 23 August 2015

SATA Port Commands

https://osdude.wordpress.com/2010/09/20/sata-in-openindiana-oi_147/


 # zpool import
 pool: backup
 id: 53109282349614151
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
 some features will not be available without an explicit 'zpool upgrade'.
config:

 backup      ONLINE
 c8t2d0s0    ONLINE

# cfgadm -a sata
Ap_Id                          Type         Receptacle   Occupant     Condition
sata4/0::dsk/c8t0d0            disk         connected    configured   ok
sata4/1::dsk/c8t1d0            disk         connected    configured   ok
sata4/2::dsk/c8t2d0            disk         connected    configured   ok
sata4/3::dsk/c8t3d0            disk         connected    configured   ok
sata4/4                        sata-port    empty        unconfigured ok
sata4/5                        sata-port    empty        unconfigured ok

# cfgadm -c unconfigure sata4/2
Unconfigure the device at: /devices/pci@0,0/pci1458,b002@11:2
This operation will suspend activity on the SATA device
Continue (yes/no)? yes

# cfgadm -c disconnect sata4/2
Disconnect the port: /devices/pci@0,0/pci1458,b002@11:2
This operation will disable activity on the SATA port
Continue (yes/no)? yes

# cfgadm -a sata
Ap_Id                          Type         Receptacle   Occupant     Condition
sata4/0::dsk/c8t0d0            disk         connected    configured   ok
sata4/1::dsk/c8t1d0            disk         connected    configured   ok
sata4/2                        sata-port    disconnected unconfigured unknown
sata4/3::dsk/c8t3d0            disk         connected    configured   ok
sata4/4                        sata-port    empty        unconfigured ok
sata4/5                        sata-port    empty        unconfigured ok

Now, hot swap the disks here, and continue:

# cfgadm -c connect sata4/2
Activate the port: /devices/pci@0,0/pci1458,b002@11:2
This operation will enable activity on the SATA port
Continue (yes/no)? yes

# cfgadm -a sata
Ap_Id                          Type         Receptacle   Occupant     Condition
sata4/0::dsk/c8t0d0            disk         connected    configured   ok
sata4/1::dsk/c8t1d0            disk         connected    configured   ok
sata4/2                        disk         connected    unconfigured unknown
sata4/3::dsk/c8t3d0            disk         connected    configured   ok
sata4/4                        sata-port    empty        unconfigured ok
sata4/5                        sata-port    empty        unconfigured ok

# cfgadm -c configure sata4/2

# cfgadm -a sata
Ap_Id                          Type         Receptacle   Occupant     Condition
sata4/0::dsk/c8t0d0            disk         connected    configured   ok
sata4/1::dsk/c8t1d0            disk         connected    configured   ok
sata4/2::dsk/c8t2d0            disk         connected    configured   ok
sata4/3::dsk/c8t3d0            disk         connected    configured   ok
sata4/4                        sata-port    empty        unconfigured ok
sata4/5                        sata-port    empty        unconfigured ok

Verify that the disk is readable:

# format -Me /dev/rdsk/c8t2d0s2
Inquiry:
00 00 03 02 1f 00 00 02 41 54 41 20 20 20 20 20     ........ATA
57 44 43 20 57 44 31 30 45 41 44 53 2d 30 30 4c     WDC WD10EADS-00L
31 41 30                                            1A0
selecting /dev/rdsk/c8t2d0s2
[disk formatted]
...
format> q

# zpool import
 pool: backup
 id: 53109282349614151
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
 some features will not be available without an explicit 'zpool upgrade'.
config:

 backup      ONLINE
 c8t2d0s0    ONLINE

drive commands

cfgadm -x remove_device c3::c1t2d0
devfsadm

Set Default Editor Nano

For sh based shells:

export EDITOR=/path/to/nano

For C shell based:

setenv EDITOR /path/to/nano

Remember that unless you save these setting to your login profile script (/home/user/.bash_profile for example), you lose the setting at log out.

zpool scrub weekly

export EDITOR=/usr/bin/nano
crontab -e
0 12 * * 1 zpool scrub mainpool
0 11 * * 1 zpool scrub rpool

managing services

  • list broken services
 svcs -a
  • delete service
svccfg delete smartd
  • status service
svcs smartd
  • status more info service
svcs -l svc:/site/smartd:default
  • log file service
cat /var/svc/log/site-smartd:default.log

smart monitoring

pfexec pkg set-publisher -p http://pkg.openindiana.org/sfe
pfexec pkg install storage/smartmontools

Example Smart Query Command (sata)

smartctl -a /dev/rdsk/c3t2d0 -d sat,12
  • if you pass "-s on" it will turn smart on

Monitor Drives

nano -w /etc/smartd.conf
#DEVICESCAN

change these drive paths to your drive names

#nas drives  
/dev/rdsk/c3t0d0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
/dev/rdsk/c3t1d0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
/dev/rdsk/c3t2d0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
/dev/rdsk/c3t3d0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
#os drives
/dev/rdsk/c3t4d0s0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
/dev/rdsk/c3t5d0s0 -d sat,12 -a -o on -S on -s (S/../.././04|L/../../7/03)
pfexec smartd -q onecheck
sudo nano -w /var/svc/manifest/site/smartd.xml

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="smartd">
  <service
     name="site/smartd"
     type="service"
     version="1">
    <single_instance/>
    <dependency
       name="filesystem-local"
       grouping="require_all"
       restart_on="none"
       type="service">
      <service_fmri value="svc:/system/filesystem/local:default"/>
    </dependency>
    <exec_method
       type="method"
       name="start"
       exec="/etc/init.d/smartd start"
       timeout_seconds="60">
      <method_context>
        <method_credential user="root" group="root"/>
      </method_context>
    </exec_method>
    <exec_method
       type="method"
       name="stop"
       exec="/etc/init.d/smartd stop"
       timeout_seconds="60">
    </exec_method>
    <instance name="default" enabled="true"/>
    <stability value="Unstable"/>
    <template>
      <common_name>
        <loctext xml:lang="C">
          SMART monitoring service (smartd)
        </loctext>
      </common_name>
      <documentation>
        <manpage title="smartd" section="1M" manpath="/usr/local/share/man"/>
      </documentation>
    </template>
  </service>
</service_bundle>
pfexec svccfg -v import /var/svc/manifest/site/smartd.xml
svcs smartd

If not on:

pfexec svcadm enable smartd

Date and Time

Timezone

tzselect
  • Take value learned
nano -w /etc/default/init
  • Set TZ=US/Eastern

You should reboot the system as all child processes take value from that file/data.

ntp client

cp /etc/inet/ntp.client /etc/inet/ntp.conf
nano -w /etc/inet/ntp.conf
  • Add some servers or whatever:
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
  • enable and restart ntpd
svcadm enable svc:/network/ntp:default
svcadm restart svc:/network/ntp:default
  • check to see if it is running
svcs -a | grep ntp
  • query ntp server
ntpq -p

Creating Static IP

# nwamcfg
nwamcfg> create ncp Nickebo
nwamcfg:ncp:Nickebo> create ncu phys e1000g0
Created ncu 'e1000g0'.  Walking properties ...
activation-mode (manual) [manual|prioritized]> prioritized
enabled (true) [true|false]>
priority-group> 0
priority-mode [exclusive|shared|all]> shared
link-mac-addr>
link-autopush>
link-mtu>
nwamcfg:ncp:Nickebo:ncu:e1000g0> end
Committed changes
nwamcfg:ncp:Nickebo> create ncu ip e1000g0
Created ncu 'e1000g0'.  Walking properties ...
enabled (true) [true|false]>
ip-version (ipv4,ipv6) [ipv4|ipv6]>
ipv4-addrsrc (dhcp) [dhcp|static]> static
ipv4-addr> 172.16.0.21
ipv4-default-route> 172.16.0.1
ipv6-addrsrc (dhcp,autoconf) [dhcp|autoconf|static]> dhcp,autoconf,static
ipv6-addr> 2001:470:df83::21
ipv6-default-route> 2001:470:df83::1
nwamcfg:ncp:Nickebo:ncu:e1000g0> end
Committed changes
nwamcfg:ncp:Nickebo> end
# nwamadm enable -p ncp Nickebo
Enabling ncp 'Nickebo'
  • Also:

Repos

http://wiki.openindiana.org/oi/Spec+Files+Extra+Repository

The SFE package repository is an "extras" package repository, supplementing the core OI distribution with additional software from the Spec Files Extra project.

It contains a wide variety of software, including:

  • Various languages and compilers (gcc 4.6.2, Steel Bank Common Lisp, the Glasgow Haskell Compiler, Python 3
  • Various daemons and database programs (PostgreSQL, dovecot, postfix)
  • Qt 4.7 and some applications which use it (the Scribus desktop publishing system, the LyX LaTeX front end, the Arora Web browser)
  • Multimedia applications (Music Player Daemon and several clients, FFmpeg, mplayer2, vlc, MKVToolnix)

Notes


Commands

http://wiki.openindiana.org/oi/pkg+Cheat+Sheet

Upgrading

If you are currently running OpenIndiana oi_147 or oi_148, first, verify you have the correct publishers set:

pfexec pkg publisher

PUBLISHER TYPE STATUS URI openindiana.org (preferred) origin online http://pkg.openindiana.org/dev/

If your openindiana.org publisher is set to a different URI, for example http://pkg.openindiana.org/dev-il/ (our release candidate branch), you can correct this with:

pfexec pkg set-publisher -O http://pkg.openindiana.org/dev/ openindiana.org

opensolaris.org publisher If you currently have the opensolaris.org publisher set, we would highly recommend unsetting it by running:

pfexec pkg unset-publisher opensolaris.org

Make sure pkg is up to date:

pfexec pkg install package/pkg

You can now identify what will be upgraded by issuing the command:

pfexec pkg image-update -nv

The -n flag specifies to perform no action (i.e. perform a trial run), and the -v flag is the verbose option, to provide additional output.

I always do big upgrades in screen so:

screen

If you are satisfied with the actions to be taken, you can perform the upgrade by typing:

pfexec pkg image-update -v

You may want to consider also passing the "--be-name" flag to give the new boot environment created a more memorable name, such as oi_151a.

Note: You may want to upgrade your zpool if you have a new version of ZFS

References

Interesting

Notes

Mirroring rpool

15:08 < tsoome> ah, just zpool attach rpool and use disk name ending with d0

Managing Disks

  • Find the disks
format

List the partitions

partition

then

print

cfgadm way

cfgadm -al
cfgadm -s "select=type(scsi-sas)"

Erasing GPT labels

Erase first 32 sectors
Erase last 32 sectors

GPT partitioning has reserved partition, no s2 (as there can not be overlapping partitions) and s0 starts from 256 reserved is there because backup GPT label is at the end of the disk, that prevents it to be overwritten.

The illumos (solaris) implementation limits the partition count there to maintain interface compatibility with vtoc