OpenIndiana

From Hack Sphere Labs Wiki
Jump to: navigation, search

Share Data Via NFS

zfs set sharenfs=rw eh/data

Share Data Via CIFS/Samba

To share a zfs file system named "bob" via smb/cifs execute a command like the following below. Note that the share name is arbitrary and can be completely different than the name of the file system itself, as seen in the example below.

$ zfs set sharesmb=name=myshare yourpool/shares/bob

You can set some text description (Windows Explorer shows this text) for the share using this:

$ zfs set "sharesmb=name=myshare,description=My ZFS share" yourpool/shares/bob

To just turn on cifs sharing for a zfs file system without specifying a share name execute a command like the following. Note that the auto-generated names created using this method are usually not user-friendly.

$ zfs set sharesmb=on yourpool/shares/bob

Check your work or check current status with:

$ zfs get sharesmb yourpool/shares/bob

You may need to enable "pam_smb_passwd" to make regular OpenIndiana users have smb passwords. To do so, add the following line to the end of the file "/etc/pam.conf":

other password required pam_smb_passwd.so.1 nowarn

And then change the user's password with the "passwd" command. After this, their smb password will also be set so they can connect via smb with the same username and password.

If you want to use AD to manage your users then take a look at the following http://docs.oracle.com/cd/E19963-01/html/821-1449/manageidmutm.html#enableidmusupporttask It allows you to enable IDMU so you can easily keep UIDs and SIDs in sync.

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.

give user zfs and zpool rights

usermod -P "ZFS Storage Management,ZFS File System Management" username

zpool scrub weekly

export EDITOR=/usr/bin/nano
crontab -e

0 0 * * 0 pfexec /sbin/zpool scrub rpool 0 2 * * 0 pfexec /sbin/zpool scrub mainpool

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:

Revert to DHCP

nwamadm enable -p ncp Automatic

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 GPT (Hipster)

Note: This should work but there is a bug: https://www.illumos.org/issues/6160#change-15117

So while this will work in the future because of the script that is ran on the add event, right now you still have to manually install the bootloader to the disk you add.

So:

  • New disk is c2t50014EE65AC68D37d0
zdb
  • Find the full path that has the s0 on it then:
installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c2t50014EE65AC68D37d0s0

I had to change the dsk to rdsk. (Difference: http://www.unix.com/filesystems-disks-and-memory/6224-difference-dsk-rdsk.html)

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

ZFS handles mirroring rpools automagically (see: /etc/sysevent/config/SUNW,EC_zfs,ESC_ZFS_bootfs_vdev_attach,sysevent.conf) It will install grub onto the new attached disk.

Mirroring rpool
root@host:~# zpool status
  pool: rpool
 state: ONLINE
  scan: none requested
config:
        NAME                     STATE     READ WRITE CKSUM
        rpool                    ONLINE       0     0     0
          c2t50014EE65AC710BCd0  ONLINE       0     0     0
errors: No known data errors
 
root@host:~# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c2t50014EE65AC68D37d0 <ATA-WDCWD10JFCX-68N-0A82 cyl 60798 alt 2 hd 255 sec 126>
          /scsi_vhci/disk@g50014ee65ac68d37
       1. c2t50014EE65AC710BCd0 <ATA-WDC WD10JFCX-68N-0A82-931.51GB>
          /scsi_vhci/disk@g50014ee65ac710bc
Specify disk (enter its number): ^C
 
root@host:~# zpool attach rpool c2t50014EE65AC710BCd0 c2t50014EE65AC68D37d0
Make sure to wait until resilver is done before rebooting.

Be sure to configure your hardware to boot from both devices in case of failure.

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

dd bs=512 if=/dev/zero of=/dev/sda count=2048 seek=$((`blockdev --getsz /dev/sda` - 2048))

This would do the last part of the disk......2mb. I modded mine for 8mb for the heck of it.

pfexex, rbac, sudo

sudo works on OI but pfexec is the way I guess

http://www.c0t0d0s0.org/archives/4844-Less-known-Solaris-features-pfexec.html

Basically turns a user to root:

usermod -P'Primary Administrator' username

List profiles of current user

profiles

Or another user

profiles username

Remove all profiles from user

pfexec usermod -P "" webdawg

More info:

[-P profile [, profile]]
      -P profile
          One or more comma-separated rights profiles defined in
          prof_attr(4). This replaces any existing profile setting in
          user_attr(4). If an empty profile list is specified, the existing
          setting is removed.