Solaris

From T2B Wiki
Revision as of 12:29, 26 August 2015 by Maintenance script (talk | contribs) (Created page with " === Useful links === *You will find the official guides for system administrators [http://docs.sun.com/app/docs/coll/47.16 here] *Freeware for Solaris : [http://sunfreeware...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Useful links

  • You will find the official guides for system administrators here
  • Freeware for Solaris : here

File equivalences between Linux and Solaris

Linux Solaris
/var/log/messages /var/adm/messages
/etc/exports /etc/dfs/dfstab
/etc/fstab /etc/vfstab


Useful commands

  • If you want to untar an archive that has been created under Linux, use the gtar command instead of /usr/sbin/tar. Example :
  /usr/sfw/bin/gtar xvf myarchive.tar
  
  • The default tail command, which is in fact /usr/bin/tail, has not the same syntax than the one from Linux. For example :
  tail -100lf /var/nfs/nfslog
  
 will print the last 100 lines if the file /var/nfs/nfslog.
  • About process monitoring tools :
    • Use ps -ef instead of ps aux
    • Use prstat -a instead of top
  • Network tools : tcpdump does not exist --> use snoop instead. Example (NFS monitoring) :
  snoop | grep -i nfs
     or better:
  snoop  port 2049
  
  • to make the nfs more verbose, refer to this blog post: http://www.eall.com.br/blog/?p=125
  • If you want to make a backup with cp, the command cp -a doesn't exist under Solaris. The equivalent is :
  cp -r -p -P
  

NFS

Automatic file-system sharing

  1. Each shared file-system has an entry in /etc/dfs/dfstab. The syntax for this entry is :
  share [-F nfs] [-o specific-options] [-d description] pathname
  
 (See the dfstab(4) and share_nfs(4) man pages)
2. To apply the changes in /etc/dfs/dfstab :
  shareall
  
3. Check that all is ok :
  share
  

Enable NFS server logging

  1. In the file /etc/nfs/nfslog.conf, you will find the "global" tag, which defines the default settings to apply to all shared file-system. It should be like this :
  global  defaultdir=/var/nfs \
        log=nfslog fhtable=fhtable buffer=nfslog_workbuffer
  
2. You can now edit /etc/dfs/dfstab, adding the option log=tag for the shares you want to log. Example :
  share -F nfs -o ro,log=global /export/ftp
  
3. Apply the changes and verify :
  shareall
  share
  
4. Check if the NFS log daemon nfslogd is running :
  ps -ef | grep nfslogd
  
5. (Optional) Start nfslogd if it is not already running :
 - If /etc/nfs/nfslogtab is present, start the log daemon with :
    svcadm restart network/nfs/server:default
    
 - If /etc/nfs/nfslogtab is not present, run any of the share command to create the file and then start the log daemon. For example :
    shareall
    svcadm restart network/nfs/server:default
    
6. You can find the log files in 
/var/nfs/

Mounting an external nfs mount on jefke

mount -o vers=3 m7.iihe.ac.be:/var/swmgrs /m7mount/

Apparently, mounts across linux machines do work. Not so with Solaris.

Mounting an NFS export from jefke

It is advised to disable ACL (noacl) and a few other options for better performances. Example :

mount -t nfs -o noacl,noatime,nodiratime,rsize=32768,wsize=32768 jefke.wn.iihe.ac.be:/storage/user /mnt/jefke_user

Avoiding root squashing

Root squashing is the default behaviour for NFS shares in Solaris. It means that trying to access as root on a Solaris share will result in a no-access because root is mapped to nobody account on the Solaris side. This may be very annoying when doing some administration tasks. One solution is to allow no_root_squash from a particular machine on which users has no access. Here is an example of such a share allowing no root squash from host fs.wn.iihe.ac.be :

share -F nfs -o rw,root=fs.wn.iihe.ac.be /storage/localgrid

You can also specify a list of hosts separated by semicolons.

Status of the disk pool

Check the status of the disk pool

zpool status -x 

ZFS Snapshot

Make a snapshot

Here the zfs Filesystem is storage/sandbox the snapshot is tag 080610 (Could be a name such as e.g. tuesday)

zfs snapshot storage/sandbox@080610

Control the size it takes with:

zfs list -o space
-bash-3.00# zfs list -o space
NAME                       AVAIL   USED  USEDSNAP  USEDDS  USEDREFRESERV  USEDCHILD
rpool                      1.77T  12.3G         0     34K              0      12.3G
rpool/ROOT                 1.77T  8.28G         0     21K              0      8.28G
rpool/ROOT/s10x_u8wos_08a  1.77T  8.28G         0   8.28G              0          0
rpool/dump                 1.77T  2.00G         0   2.00G              0          0
rpool/export               1.77T    44K         0     23K              0        21K
rpool/export/home          1.77T    21K         0     21K              0          0
rpool/swap                 1.77T     2G         0     16K          2.00G          0
storage                    63.5T   361G         0   44.7K              0       361G
storage/localgrid           500G  37.6K         0   37.6K              0          0
storage/sandbox             336G   164G     4.58G    159G              0          0
storage/sandbox@070610         -  4.56G         -       -              -          -
storage/sandbox@080610         -  19.5M         -       -              -          -
storage/swmgrs              317G   183G         0    183G              0          0
storage/swmgrs@080610          -      0         -       -              -          -
storage/user               60.0T  13.4G         0   13.4G              0          0

Restore a snapshot

Use the rollback option:

zfs rollback -r storage/sandbox@080610

Notice the -r argument will destroy earlier snapshots

List snapshots

zfs list -r -t snapshot -o name,creation storage/sandbox

Destroy snapshots

zfs destroy storage/swmgrs@090610

Create a clone

zfs clone storage/sandbox@080610 storage/sandbox-clone
zfs set quota=500G storage/sandbox-clone

ZFS Quotas

Set quota for a user under storage/user

zfs set userquota@srugovac=500G storage/user

Show users quotas

zfs userspace storage/user

Show single user quota

zfs get userused@srugovac storage/user


Force Shutdown

to reboot jefke, do: Connect to the ILOM console with ssh:

# ssh ilom-jefke.wn.iihe.ac.be
Password: 

Sun(TM) Integrated Lights Out Manager

Version 3.0.3.36

Copyright 2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

Then you are allowed to type the following commands:


-> stop -f /SYS
Are you sure you want to immediately stop /SYS (y/n)? y
Stopping /SYS immediately


-> start /SYS
Are you sure you want to start /SYS (y/n)? y
Starting /SYS

->
  • REMARK: in case jefke is not mounted anymore on the UIs you can simply do the following on a UI (this is not the proper place on the twiki to put this info)
service autofs restart

Package management

Determine which package a particular files belongs to

The syntax is :

# /usr/sbin/pkgchk -l -p /absolute/path/todir

You can also simply use the package directory. It is a file containing all the info about files installed from packages :

# grep /absolute/path/todir /var/sadm/install/contents

List the files coming from a particular package

The syntax is :

pkgchk -v <name_of_the_package>

Install a package

The syntax is :

pkgadd -d <path_of_the_package_to_install>

Display detailed info about installed package

The syntax is :

pkginfo -v <pkgid>

Note that pkginfo alone will list all installed packages.

Remove a package

The syntax is :

pkgrm <pkgid>


Template:TracNotice