Monday, June 23, 2014

Unix - Z File System (ZFS)

The Z file system (ZFS) developed by Sun Microsystems is a feature rich file system for server solutions. It is designed for high storage volumes, mirror and RAID options for redundancy, data snapshots, integrity checking, and automatic repairs.

Here are some ZFS troubleshooting commands and typical outputs:
  • # zpool status
      pool: zroot
     state: ONLINE
      scan: resilvered 30.6M in 0h0m with 0 errors on Sep 16 10:18:02 2013
    config:
    
     NAME        STATE     READ WRITE CKSUM
     zroot       ONLINE       0     0     0
       mirror-0  ONLINE       0     0     0
       gpt/disk0 ONLINE       0     0     0
       gpt/disk1 ONLINE       0     0     3
    
    errors: No known data errors 

  • # zpool list
    NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
    zroot   228G   124G   104G    54%  1.00x  ONLINE  - 

  • # zfs list
    NAME                        USED  AVAIL  REFER  MOUNTPOINT
    zroot                      31.8G   417G    31K  /zroot
    zroot/ROOT                 3.38G   417G  3.38G  /
    zroot/scratch              4.94G   417G  4.94G  /scratch
    zroot/tmp                  58.9M   417G  58.9M  /tmp
    zroot/usr                  21.0G   417G    31K  /usr
    zroot/usr/home             17.9G   417G  17.9G  /usr/home
    zroot/usr/local             813M   417G   813M  /usr/local
    zroot/usr/obj               997M   417G   997M  /usr/obj
    zroot/usr/ports             965M   417G   896M  /usr/ports
    zroot/usr/ports/distfiles  67.6M   417G  67.6M  /usr/ports/distfiles
    zroot/usr/ports/packages   1.30M   417G  1.30M  /usr/ports/packages
    zroot/usr/src               359M   417G   359M  /usr/src
    zroot/var                  2.46G   417G   109M  /var
    zroot/var/crash            2.15G   417G  2.15G  /var/crash
    zroot/var/db                206M   417G   204M  /var/db
    zroot/var/db/pkg           1.90M   417G  1.90M  /var/db/pkg
    zroot/var/empty              31K   417G    31K  /var/empty
    zroot/var/log               706K   417G   706K  /var/log
    zroot/var/mail             59.5K   417G  59.5K  /var/mail
    zroot/var/run              56.5K   417G  56.5K  /var/run
    zroot/var/tmp              1.79M   417G  1.79M  /var/tmp
    

  • # ls -l /etc/zfs
    total 1
    -rw-------  1 root  wheel  181 Jun 10 12:59 exports

  • # ls -l /boot/zfs /boot/zfsboot /boot/zfsloader
    -r--r--r--  1 root  wheel   66048 Dec  4  2012 /boot/zfsboot
    -r-xr-xr-x  1 root  wheel  303104 Oct 16  2013 /boot/zfsloader
    
    /boot/zfs:
    total 3
    -rw-r--r--  1 root  wheel  1588 Sep 13  2013 zpool.cache

  • # ls -l /boot/gptboot /boot/gptzfsboot
    -r--r--r--  1 root  wheel  16723 Dec  4  2012 /boot/gptboot
    -r--r--r--  1 root  wheel  43443 Dec  4  2012 /boot/gptzfsboot

Thursday, June 12, 2014

Unix - Hardware Timer Selection

  • To find the timer counter being used by the computer:

    myhost# sysctl kern.timecounter.hardware
    kern.timecounter.hardware: HPET


  • List of available timers:

    myhost# sysctl kern.timecounter.choice
    kern.timecounter.choice: TSC(-100) HPET(900)

  • The integer value within brackets defines the quality of the time counter compared to others. A negative value means this time counter is broken and should not be used.


  • Selecting the timer of your choice:
    myhost# sysctl kern.timecounter.hardware=TSC

    Note: This selection does not persist after a reboot. To make this change persistent add the following line to the file /etc/sysctl.conf:
    sysctl kern.timecounter.hardware=HPET