Computer How To How To, Tutorial, Example, Review


 
  1. Solving Solaris Event Errors

    December 13, 2011 by Computer

    Solaris provides a useful tool to find more information about an unexpected event on your Solaris system. Once the event occurs, information is immediately captured and stored so that you may view the details. The command you can use for this is fmdump. This command can be used to solve event errors by providing addition error information. An example is as follows:

    fmdump -v -u <event id>
    

    It is often the case you will need to obtain the event id directly from the console. It should a long string of letters and numbers.

    Solaris with fmdump makes it easy to view event errors.


  2. smbclient location in solaris

    December 7, 2011 by Computer

    Most of the smb commands are in the /usr/sfw/bin directory. Including “smbpasswd” and “smbclient”. The smb packages will need to be installed. Copy the smb packages from the solaris disc and copy them to /var/spool/pkg. Then install them with “pkgadd package”. It is often useful to have /usr/sfw/bin as part of your path.


  3. Find Serial Number in Solaris

    December 6, 2011 by Computer

    To find the serial number of your server in solaris you may be able to use the prtdiag command as follows:

    prtdiag -v
    

    The serial number should be listed toward the very bottom of the output. Note, this will not work with non Sun or Oracle servers.


  4. Use file command to determine file type

    November 28, 2011 by Computer

    The file command is a useful tool in solaris that can help you to determine what file type a particular file is. The usage is simple, just “file “. Below we have two files, but we don’t know what type of file they are:

    root@solaris:/pool/share# ls -lah
    total 20K
    drwxr-xr-x 2 root root   4 2011-10-03 04:08 .
    drwxr-xr-x 3 root root   3 2011-07-28 04:27 ..
    -rw-r--r-- 1 root root   9 2011-10-03 04:02 testfile1
    -r-xr-xr-x 1 root root 13K 2011-10-03 04:02 testfile2
    

    Now we find out using the file command

    root@solaris:/pool/share# file testfile1
    testfile1:      ascii text
    root@solaris:/pool/share# file testfile2
    testfile2:      ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped, no debugging information available
    

    We notice that the first testfile is ascii text and the other a 32 bit binary. In solaris it is useful to use this command, and can often be more convenient than using a cat of the file.


  5. Using the nfsstat command

    by Computer

    The “nfsstat” command is useful for debugging errors. It gives clear representation of the errors one can expect to see on the nfs server, rpc, or client. In particular, the “badcalls” column. For example, to view the nfs statistics for an nfs version 3 server one can use the “-v” parameter, which allows one to specify the version.

    
    root@solaris:/mnt/nfs# nfsstat -v 3
    
    Server rpc:
    Connection oriented:
    calls      badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs
    35         0          0          0          0          0          0
    Connectionless:
    calls      badcalls   nullrecv   badlen     xdrcall    dupchecks  dupreqs
    0          0          0          0          0          0          0
    
    Server NFSv3:
    calls      badcalls   referrals  referlinks
    0          0          0          0
    Version 3: (0 calls)
    null        getattr     setattr     lookup      access      readlink
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    read        write       create      mkdir       symlink     mknod
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    remove      rmdir       rename      link        readdir     readdirplus
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    fsstat      fsinfo      pathconf    commit
    0 0%        0 0%        0 0%        0 0%
    
    Server nfs_acl:
    Version 3: (0 calls)
    null        getacl      setacl      getxattrdir
    0 0%        0 0%        0 0%        0 0%
    
    Client rpc:
    Connection oriented:
    calls      badcalls   badxids    timeouts   newcreds   badverfs   timers
    34         0          0          0          0          0          0
    cantconn   nomem      interrupts
    0          0          0
    Connectionless:
    calls      badcalls   retrans    badxids    timeouts   newcreds   badverfs
    0          0          0          0          0          0          0
    timers     nomem      cantsend
    0          0          0
    
    Client nfs:
    calls      badcalls   clgets     cltoomany
    0          0          0          0
    Version 3: (0 calls)
    null        getattr     setattr     lookup      access      readlink
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    read        write       create      mkdir       symlink     mknod
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    remove      rmdir       rename      link        readdir     readdirplus
    0 0%        0 0%        0 0%        0 0%        0 0%        0 0%
    fsstat      fsinfo      pathconf    commit
    0 0%        0 0%        0 0%        0 0%
    
    Client nfs_acl:
    Version 3: (0 calls)
    null        getacl      setacl      getxattrdir
    0 0%        0 0%        0 0%        0 0%
    

    Solaris provides this command on a default install. Use it to debug potential problems with nfs.


  6. Dedup Example in Solaris

    November 25, 2011 by Computer

    As of Solaris 11, and formerly open solaris, the dedup option is available as a standard feature of a zfs pool. To enable dedup it is just a quick parameter adjustment. Below is an example of how to enable dedup and a quick test to verify it works.

    root@solaris:~# zfs list
    NAME                         USED  AVAIL  REFER  MOUNTPOINT
    pool                         233K   357M  41.4K  /pool
    pool/share                  40.6K   100M  40.6K  /pool/share
    ...
    root@solaris:~# zfs set dedup=on pool/share
    root@solaris:/pool/share# zfs get dedup pool/share
    NAME        PROPERTY  VALUE          SOURCE
    pool/share  dedup     on             local
    root@solaris:/pool/share# dd if=/dev/zero of=testfile bs=1K count=10240
    10240+0 records in
    10240+0 records out
    10485760 bytes (10 MB) copied, 10.7363 s, 977 kB/s
    root@solaris:/pool/share# zfs list
    NAME                         USED  AVAIL  REFER  MOUNTPOINT
    pool                        10.2M   356M  41.4K  /pool
    pool/share                  10.0M  90.0M  10.0M  /pool/share
    

    Notice the pool available is 357M starting, after writing 10MB worth of zeros to a file on pool/share using the dd command we notice the pool size is 356M. Since deduplication works at a block level it is of reasonable speed. For what you get, it is a good option to conserve pool space in solaris.


  7. Get all zfs and zpool attributes

    November 24, 2011 by Computer

    It is often useful to get a complete listing of all attributes pertaining to a ZFS pool or share in Solaris. ZFS provides an easy way to do this using the “get” parameter. An example of getting attributes on a zpool:

    root@solaris:~# zfs get all pool
    NAME  PROPERTY              VALUE                  SOURCE
    pool  type                  filesystem             -
    pool  creation              Thu Jul 28  4:26 2011  -
    pool  used                  233K                   -
    pool  available             357M                   -
    pool  referenced            41.4K                  -
    pool  compressratio         1.00x                  -
    pool  mounted               yes                    -
    pool  quota                 none                   default
    pool  reservation           none                   default
    pool  recordsize            128K                   default
    pool  mountpoint            /pool                  default
    pool  sharenfs              off                    default
    pool  checksum              on                     default
    pool  compression           off                    default
    pool  atime                 on                     default
    pool  devices               on                     default
    pool  exec                  on                     default
    pool  setuid                on                     default
    pool  readonly              off                    default
    pool  zoned                 off                    default
    pool  snapdir               hidden                 default
    pool  aclinherit            restricted             default
    pool  canmount              on                     default
    pool  xattr                 on                     default
    pool  copies                1                      default
    pool  version               5                      -
    pool  utf8only              off                    -
    pool  normalization         none                   -
    pool  casesensitivity       sensitive              -
    pool  vscan                 off                    default
    pool  nbmand                off                    default
    pool  sharesmb              off                    default
    pool  refquota              none                   default
    pool  refreservation        none                   default
    pool  primarycache          all                    default
    pool  secondarycache        all                    default
    pool  usedbysnapshots       0                      -
    pool  usedbydataset         41.4K                  -
    pool  usedbychildren        192K                   -
    pool  usedbyrefreservation  0                      -
    pool  logbias               latency                default
    pool  dedup                 off                    default
    pool  mlslabel              none                   default
    pool  sync                  standard               default
    pool  encryption            off                    -
    pool  keysource             none                   default
    pool  keystatus             none                   -
    pool  rekeydate             -                      default
    pool  rstchown              on                     default
    

    This can also be performed on a share within a pool. It is important to note that there is often inheritance that takes place. If an attribute is set on the pool, and a share is created within the pool, the share will inherit the attributes from the pool.

    Solaris ZFS uses attribute based features which greatly improves file system management.


  8. Shut down system in Solaris

    November 23, 2011 by Computer

    To power down the system in solaris and have the machine turn off completely one can use the “poweroff” command.

    poweroff
    

    This is similar to “shutdown -h now” in a linux system. Solaris does not have the shutdown commmand, so poweroff can be used.


  9. zfs share not showing up after snapshot

    November 7, 2011 by Computer

    On occasion when you perform a zfs snapshot to another host the share may not always show up as mounted, although a “zfs list” will show it. To get this share mounted after a snapshot you will need to use the zfs mount command. Below is an example:

    zfs mount pool/share
    

    This will mount a particular share that was previously sent via the solaris zfs snapshot.


  10. ZFS sharenfs to multiple subnets

    by Computer

    It is possible to set the sharenfs attribute in solaris zfs to share out to multiple subnets. The syntax must be correct though. Below is an example of the correct syntax for sharing a share in a pool to multiple subnets.

    zfs set sharenfs='rw=@192.168.50.0/24,rw=@192.168.200.0/24' pool/share
    

    The above command sets read and write to any address in the subnet of 192.168.50.xxx and 192.168.200.xxx. This is useful for restricting your zfs shares to only certain groups of hosts via nfs.






The field of computers is very vast and can somtimes be extremely challenging, but also very rewarding. One will often times encounter problems that they may not have the answer to. Problems don't always have solutions, but sometimes they do. And helpting to provide some of those solutions is our mission. It is our goal to provide helpful computer how to, tutorial, example, and review for the benefit of everyone.

Terms and Disclaimer