Showing posts with label FreeBSD. Show all posts
Showing posts with label FreeBSD. Show all posts

Thursday, January 18, 2018

iohyve / bhyve USB controller passthrough goodness

I used to have a Windows machine that was dedicated to running software for our printer since the open-source software wouldn't scan and print correctly. Thanks to iohyve and a $20 PCI USB card, I was able to eliminate this machine and replace it with a slimmed down virtual machine.

Here are some tips and steps to get it working:
  • Only PCI devices that support MSI (message signaled interrupts) will work. You can figure all of this out with the command:

    pciconf -lvc


    In my case, I get:

    xhci1@pci0:3:0:0:        class=0x0c0330 card=0x12421b21 chip=0x12421b21 rev=0x00 hdr=0x00
        vendor     = 'ASMedia Technology Inc.'
        device     = 'ASM1142 USB 3.1 Host Controller'
        class      = serial bus
        subclass   = USB
        cap 05[50] = MSI supports 8 messages, 64 bit
        cap 11[68] = MSI-X supports 8 messages
                     Table in map 0x10[0x2000], PBA in map 0x10[0x2080]
        cap 01[78] = powerspec 3  supports D0 D3  current D0
        cap 10[80] = PCI-Express 2 endpoint max data 128(512) NS
                     link x2(x2) speed 5.0(5.0) ASPM disabled(L0s/L1)
        ecap 0002[100] = VC 1 max VC0
        ecap 0001[200] = AER 1 0 fatal 0 non-fatal 0 corrected
        ecap 0019[280] = PCIe Sec 1 lane errors 0
        ecap 0018[300] = LTR 1
  • bhyve expects that PCI devices that will be passed through must be associated with the ppt driver. Rebooting your machine is not required. In the above example, the device is associated with the xhci driver. To associate it with the ppt driver:

    devctl detach pci3:0:0
    devctl set driver pci3:0:0 ppt

    If you execute pciconf -lvc again, you'll now notice:

    ppt1@pci0:3:0:0:        class=0x0c0330 card=0x12421b21 chip=0x12421b21 rev=0x00 hdr=0x00
  • In modern bhyve, you must supply the -S argument to bhyve in order to get PCI passthrough working. Note that -u is provided to make Windows like my UTC clock:

    iohyve set vm_name_here bargs = "-H -w -S -u"
  • Create the mapping for the PCI device in question:

    iohyve set vm_name_here pcidev:1=passthru,3/0/0
  • Limit or completely disable network access to your virtual server!

Sunday, January 14, 2018

Installing Windows 10 in TrueOS (FreeBSD) in a bhyve container using iohyve

Here's an abbreviated HOWTO install Windows 10 using iohyve on TrueOS.
iohyve is a handy script that helps manage virtual machines in bhyve. More information is available here.

  1. Download installation ISOs
    You can use the Windows Media Creation Tool to download .iso files for Windows 10.
    Download the Red Hat VirtualIO network adapter ISO.
  2. Install the prerequisite packages for iohyve and bhyve
    pkg install tigervnc bhyve-firmware uefi-edk2-bhyve iohyve
  3. Initialize iohyve if you have never used iohyve before
    iohyve setup pool=zfs_poolname_here net=network_nic_here kmod=1
  4. Initialize components
    iohyve cpfw /usr/local/share/uefi-firmware/BHYVE_UEFI.fd
    iohyve cpiso /path/to/Windows_10_installer.iso
    iohyve cpiso /path/to/virtio-win.iso
  5. Create and configure device (example uses 32 gigabytes for C:)
    iohyve create win10 32g
    iohyve set win10 loader=uefi ram=2G cpu=2 vnc=YES vnc_tablet=YES vnc_port=6901 vnc_wait=YES bargs="-H -w" fw=BHYVE_UEFI.fd
  6. Install Windows 10
    iohyve install win10 Windows_10_installer.iso
    vncviewer localhost:6901

    ... stuff happens.
  7. Once install is completed and the VM shuts down, install the virtio network driver
    iohyve install win10 virtio-win.iso

    Navigate the explorer to the "d:" drive, open the NetKVM directory for your architecture, find the .inf file and right-click it to "Install." Congratulations, your VM can now download teh viruz!
  8. Do cool things to your Windows using zfs commands.
Some caveats about bhyve:
  1. You can't run bhyve and VirtualBox at the same time.
  2. If you try to run bhyve, and then want to run VirtualBox, it seems that it is not possible to kldunload the byhve module vmm that occupies the hypervisor (it is possible to unload nmdm).

Friday, September 2, 2016

Building Python3 modules from FreeBSD ports

If you're like me, you will have python2.7 selected as the default interpreter in your TrueOS installation. However, some programs may require Python version 3 (and associated python3 modules). However, there aren't many py34 modules available using pkg install.

The solution to the problem is simple if you have a FreeBSD ports tree installed.

To build a port for a specific version of python, execute:
PYTHON_VERSION=pythonX.X make
Substitute X.X for the appropriate version that you require. Instead of the default py27-modulename, FreeBSD will build pyXX-modulename.

The default, of course, can be changed in make.conf (see man make.conf for details.)

Wednesday, September 16, 2015

ZFS compression results in workload starvation, partially ameliorated by async_write_max_active

I have a particular dataset that consists of old backup files. Rather than storing them in .tar.gz archives, where the contents remain buried (and the files cannot be culled with useful tools such as fdupes), I elected to create a zfs dataset that uses gzip-9 compression.

However, on my system, I noticed that writing to the compression=gzip-9 zfs dataset resulted in starvation to other I/O processes  -- in particular, read processes -- rendering the system unusable.

In order to analyze the situation, I used this dtrace script to analyze different classes of I/O operations on my system.

See below for the sysctl tuneable that I modified.

vfs.zfs.vdev.async_write_max_active=10 vfs.zfs.vdev.async_write_max_active=3
  Delete                                            
           value  ------------- Distribution ------------- count    
             256 |                                         0        
             512 |@@@                                      2        
            1024 |@@@@                                     3        
            2048 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@        24       
            4096 |                                         0        

  Flush                                             
           value  ------------- Distribution ------------- count    
             512 |                                         0        
            1024 |@@@@                                     4        
            2048 |@                                        1        
            4096 |@@@@                                     4        
            8192 |@@@@                                     4        
           16384 |@@@                                      3        
           32768 |@@@@@@@@@@@@@@@                          14       
           65536 |@@@@@@@@                                 7        
          131072 |                                         0        

  Write                                             
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |                                         96       
              64 |@                                        531      
             128 |@@                                       735      
             256 |@@                                       1067     
             512 |@@@@@@@@@@@@@@@@@@@@@@@@@@               11639    
            1024 |@@@                                      1573     
            2048 |@@                                       878      
            4096 |@@                                       785      
            8192 |@                                        612      
           16384 |                                         183      
           32768 |                                         25       
           65536 |                                         16       
          131072 |                                         13       
          262144 |                                         3        
          524288 |                                         0        

  Read                                              
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |                                         12       
             128 |                                         48       
             256 |@                                        124      
             512 |@@@@@@@@@@                               2046     
            1024 |@@@@                                     906      
            2048 |@@@@@@                                   1244     
            4096 |@@@@@@@                                  1523     
            8192 |@@@@@@                                   1228     
           16384 |@@@@                                     774      
           32768 |@                                        173      
           65536 |                                         26       
          131072 |                                         22       
          262144 |                                         5        
          524288 |                                         0
  Delete                                            
           value  ------------- Distribution ------------- count    
             256 |                                         0        
             512 |@@                                       1        
            1024 |@@@@@@@@@@@@@@@@@@@@                     12       
            2048 |@@@@@@@@                                 5        
            4096 |@@                                       1        
            8192 |@@@@@@@@                                 5        
           16384 |                                         0        

  Flush                                             
           value  ------------- Distribution ------------- count    
             512 |                                         0        
            1024 |@@@@@@@@@                                5        
            2048 |@@@@                                     2        
            4096 |@@@@@                                    3        
            8192 |@@@@@@@@@                                5        
           16384 |                                         0        
           32768 |@@@@@@@                                  4        
           65536 |@@@@@                                    3        
          131072 |                                         0        

  Write                                             
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@                                        468      
              64 |@@@@@@                                   3741     
             128 |@@@@@@                                   3627     
             256 |@@@@@                                    3234     
             512 |@@@@@@@@@@@@@@@@@                        10520    
            1024 |@                                        916      
            2048 |@                                        608      
            4096 |@                                        476      
            8192 |@                                        476      
           16384 |                                         246      
           32768 |                                         80       
           65536 |                                         54       
          131072 |                                         11       
          262144 |                                         5        
          524288 |                                         0        

  Read                                              
           value  ------------- Distribution ------------- count    
              32 |                                         0        
              64 |                                         18       
             128 |@                                        70       
             256 |@                                        153      
             512 |@@@@@@@@                                 890      
            1024 |@@@@                                     445      
            2048 |@@@@@                                    594      
            4096 |@@@@@@                                   667      
            8192 |@@@@@@                                   709      
           16384 |@@@@@                                    609      
           32768 |@@@                                      381      
           65536 |@                                        130      
          131072 |                                         26       
          262144 |                                         10       
          524288 |                                         0
 
                              avg latency      stddev        iops  throughput
Write                               1892us      8057us       302/s    33416k/s
Delete                              2303us       732us         0/s       34k/s
Read                                7747us     15904us       135/s    17011k/s
Flush                              42742us     37072us         0/s        0k/s

                               avg latency      stddev        iops  throughput
 Write                               1521us      8316us       407/s    30107k/s
 Delete                              3557us      3001us         0/s       41k/s
 Read                               14255us     27405us        78/s     8844k/s
 Flush                              25081us     32016us         0/s        0k/s
In particular, it seems that the average latency of I/O Flush dropped considerably.

A more exhaustive study under more carefully controlled conditions seems like a reasonable next step.

Tuesday, May 12, 2015

USB audio disconnect woes in FreeBSD with fstat: tales of a voltage-sensitive Topping TP30

I have a very nice "class T" Tripath audio amplifier: the Topping TP30 (MK I -- hopefully they fixed the MKII) with a very convenient integrated USB audio card. However, this device is VERY sensitive to line voltage. For example, when plugged into the same circuit as, say, a refrigerator, the motor spark is enough to pop the speakers and cause the device to perform a USB reset.

In the case of FreeBSD, this causes everything to come to a miserable, grinding halt. dmesg gives me repeated warnings of failure:

pcm2: unregister: mixer busy
pcm2: Waiting for sound application to exit!
pcm2: unregister: mixer busy
pcm2: Waiting for sound application to exit!
pcm2: unregister: mixer busy
pcm2: Waiting for sound application to exit!
pcm2: unregister: mixer busy
pcm2: Waiting for sound application to exit!
pcm2: unregister: channel pcm2:virtual:dsp2.vp0 busy (pid 11413)
pcm2: Waiting for sound application to exit!
pcm2: unregister: channel pcm2:virtual:dsp2.vp0 busy (pid 11413)
pcm2: Waiting for sound application to exit!
pcm2: chn_write(): pcm2:virtual:dsp2.vp0: play interrupt timeout, channel dead

Before I realized that fstat worked on character devices, I had to manually fish around for processes to kill, in order to give the USB audio subsystem the breathing room required for it to reset the audio device. Interestingly enough: if a process that was holding onto the mixer releases the corresponding /dev/mixer device, but then restarts quickly enough and grabs control of the (now defunct) mixer, the sound card still won't reset.

Below, find the one-liner script that goes out and kills every process that holds the audio devices open. I have to execute this twice in a row to kill off XFCE's mixer process until the USB audio card has time to fully reset:

fstat /dev/dsp* /dev/mixer* /dev/audio* | tail -n +2 | awk '{print $3}' | xargs sh -c 'sudo kill -9 $0 $*'

Sunday, July 6, 2014

Semi-automatic installation of PC-BSD 10.0 with a custom MBR partition table

PC-BSD has made installing FreeBSD an almost trivial task -- give the PC-BSD installer a whole disk, and off it goes. However, if you're like me, you have a smaller SSD device (~100 GB), a bunch of really large and cheap traditional hard drives (2TB+), and fairly limited time. One of the great things about SSD is that we can use part of it as a cache device (L2ARC) or for data robustness (ZIL) to help out the big slow rotational hard drives.

First, a few terminology things. You're probably familiar with the idea of partitions from Linux and Windows world; traditionally, a disk can have four primary partitions, including one extended partition that can be further divided into additional logical partitions. In BSD (and Solaris), primary partitions are synonymous with slices, and are most comparable to extended partitions. Each slice (labeled s1 through s4 -- there is no zero slice) can contain multiple filesystems (labeled a through t). So, in BSD, the third filesystem in the second slice on a device called "ada0" would traditionally be represented by the device file /dev/ada0s2c (more on what I mean by traditional later).

The trick here is knowing that PC-BSD's automated installer can install to a specific slice. This means that you can create other slices on the disk to reserve space for things like L2ARC, or installation of other operating systems.

Let's boot our system using the PC-BSD 10.0 installer media, and I'll give a quick run-through of how one can create separate slice for L2ARC or whatnot.

The key points that follow:
  • Reserve enough room at the beginning of the partition table for GRUB
  • Align to 4k sector size for modern media
  • disk_ident is currently broken and hides filesystems
Once you've booted the installer, here are the steps to follow:

After loading the PC-BSD install media, launch an xterm by right-clicking on the  desktop area outside of the main installer window, or clicking on the icon corresponding to "Emergency Shell and Utilities."

Once you've got the command line, execute camcontrol devlist to figure out what drive corresponds to what entry in /dev. The following steps wipe out existing partition tables, so you are going to want to be sure you're doing this on the correct device.

First things first: disk_ident is broken and causes drive labels corresponding to FreeBSD partitions to disappear. In order fix this problem, we have to disable this feature through sysctl:
pcbsd# sysctl kern.geom.label.disk_ident.enable=0
Wipe out the existing partition table on the disk in question (here, we assume /dev/da0 corresponds to the drive that you're going to install on, as determined from the aforementioned camcontrol devlist command). Hat tip to Warren Block for his wonderful instructions concerning partitioning; some steps are replicated below.
pcbsd# dd if=/dev/zero of=/dev/da0 bs=512 count=34
In order to destroy an existing backup GPT table, we obtain the media size in sectors:

pcbsd# diskinfo -v da0
        512             # sectorsize
        11912167424     # mediasize in bytes (11G)
        23265952        # mediasize in sectors
        etc... 
Subtract 34 sectors from your mediasize in sectors by using python as a fancy calculator:
pcbsd# python -c "print (23265952 - 34)"
23265918
Delete the possible backup GPT:
pcbsd# dd if=/dev/zero of=/dev/da0 bs=512 seek=23265918
Create a new MBR partition table.
pcbsd# gpart create -s mbr da0
Now, choose a size, in gigabytes, that is sufficiently large to hold your L2ARC or whatever else. Pass this value in after the -s flag as you create a corresponding slice with 4k alignment and sufficient space for GRUB's bootcode (2 megabytes? I took a guess with 2MB, I haven't researched the "right" size).
pcbsd# gpart add -t freebsd -a 4k -b 2M -s 30G da0
da0s1 added 
Create a bsdlabel partitioning scheme for the slice and add your cache device. Note that adding alone is not enough. This is what trips me up every time:
pcbsd# gpart create -s bsd da0s1
da0s1 created 
pcbsd# gpart add -t freebsd-zfs -a 4k da0s1
da0s1a added
You can give it a handy label so that you know why you created the partition in the first place:
pcbsd# glabel label l2arc da0s1a
This step allows you to view your disk providers under /dev/label/XXXX  -- mighty handy if you happen to swap SATA ports, etc.

Now, create the slice that you want FreeBSD to live inside of. If you omit the -s argument, the rest of the disk's space will be used.
pcbsd# gpart add -t freebsd -a 4k da0
da0s2 added 
Hooray! Continue running the installer. You must choose "Desktop" configuration. Server configuration will not give you sufficient granularity to control where PC-BSD is installed.

Once you reach the Disk Selection screen, click the "Customize" button. Choose the "Advanced" option that corresponds to the little bicycle icon. Under the "Selected Partition" dropdown, choose da0s2, or whatever corresponds to your second slice (even the user-friendly installer is referring to slices as partitions! No wonder we are all so confused...) If you're using modern SSD hardware, you probably want to force ZFS 4k block size. Things should look like this:


Note the output of gpart show in the terimal in the upper-left corner of the screen. The screenshot has lines everywhere due to redraw problems in the installer.

Now, you have plenty of space on your SSD for your root filesystem and L2ARC -- great for a home server! Only one last detail remains.

When your machine reboots, you probably want to disable disk_ident so that you can access the partitions in your first slice. This forces a "traditional" naming scheme in which disk partitions show up as e.g. /dev/da0s2b instead of /dev/diskid/CLASS_NAME-ident, which actually would be more portable if it didn't break compatibility with the trailing "a-t" lettered partition naming scheme. Perform the following commands.
# echo "kern.geom.label.disk_ident.enable=0" >> /boot/loader.conf
# grub-mkconfig -o /boot/grub/grub.cfg
All done!

Friday, February 7, 2014

Tips when upgrading PC-BSD 9.2 to PC-BSD 10


Here are some tips for you, if you decide to do a live upgrade from PC-BSD 9.2 to PC-BSD 10:
  • After your machine reboots for the first time, run pkg install -f to update all packages in order to match packages to the base system libraries.
  • Make sure that /etc/loader.conf contains the entries that you need for your hardware. In my case, nvidia_load="YES" is important.
     
  • After the aforementioned modifications, run grub-mkconfig -o /boot/grub/grub.cfg due to a known bug when upgrading grub.
  • In my case, pc-updatemanager didn't install the base overlay correctly. I was missing several important libraries; these omissions prevented both ssh and sshd from running. To fix:
    • Back up your /etc/ directory (and everything else -- I used a zfs snapshot -r tank)
    • Download the base system overlay from your favorite mirror into a nice place like /var/tmp/
    • cd /; tar xfym /var/tmp/base.txz
    • Check for missing / broken libraries by using libchk (I uninstalled many packages that were discontinued / no longer applicable)

Monday, October 15, 2012

Setting up OpenVPN on FreeBSD

I've found a few tricks to help improve OpenVPN setup on FreeBSD. First off, there's a reasonably good PERL script that makes the process a bit easier. Install security/ssl-admin.

Next, set up your /usr/local/etc/openvpn/server.conf file:

proto udp
port 1194
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 172.17.2.0 255.255.255.0

# Makes a local area network available to other clients
# This could be the IP block of your home network
push "route 192.168.1.0 255.255.255.0"
ifconfig-pool-persist ipp.txt
comp-lzo
client-to-client
duplicate-cn
user nobody
group nobody
keepalive 10 120
persist-key
persist-tun
status openvpn-status.log
verb 4
crl-verify /usr/local/etc/openvpn/crl.pem

Edit /usr/local/etc/ssl-admin/ssl-admin.conf.default and save as ssl-admin.conf in the same directory. Examples for the United States are shown below:

$ENV{'KEY_COUNTRY'} = "US";
$ENV{'KEY_PROVINCE'} = "CA";
$ENV{'KEY_CITY'} = "PASADENA";
$ENV{'KEY_ORG'} = "FOOBAR.NET";
$ENV{'KEY_EMAIL'} = 'CATS@FELINEHA.US';
Next, use the ssl-admin tool to create server certificates. Launch ssl-admin. You're presented with a "user-friendly" menu, but the menu requires knowledge about ssl certificate exchange. This knowledge isn't really necessary in order to set up a server. When the program initially executes, it will automatically ask you to create a certificate authority (CA) identity. Make sure you encrypt this certificate with a password. Next, choose options dh, and option S. Option S will prompt you for an "owner name." To make things less confusing, type "server" as the owner name.

Once these certificates have been generated, you'll want to copy them into your OpenVPN configuration directory:

cd /usr/local/etc/ssl-admin/active
sudo cp server.crt server.key ca.crt ../prog/crl.pem ../dh2048.pem /usr/local/etc/openvpn/

Edit /etc/rc.conf and add the lines:
# OpenVPN Server openvpn_enable="YES" openvpn_configfile="/usr/local/etc/openvpn/server.conf"

Configure your firewall to allow traffic into OpenVPN. If you use ipfilter, add the following lines to your /etc/ipf.rules file and then restart the ipfilter service:
# OpenVPN
pass in quick on XXXX proto udp from any to any port = 1194 keep frags
Now you should be able to start the OpenVPN server.
/usr/local/etc/rc.d/openvpn start

Server configuration is complete! Now you can create certificates for clients. I suggest creating  /usr/local/etc/openvpn/client.conf:
client
dev tun
proto udp
remote server.felineha.us
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
ca ca.crt
cert client.crt
key client.key
verb 3

Make a symlink so this configuration is included in the client configuration archive:
ln -s /usr/local/etc/openvpn/client.conf /usr/local/etc/ssl-admin/packages/client.ovpn

Using the ssl-admin tool, choose option (4) to create certificates for a client. The script will prompt you for another owner name -- choose something that is descriptive of the remote host so that you can figure out what certificate is for what host.

When the script asks you "Can I move signing request (xxxx.csr) to the csr directory for archiving?", choose Yes. After the script creates the certificate for the remote host, choose option (z).

Although this blog post will get you started, some of the methods used are dated. Apparently Ubuntu 10.10 now allows import of  pkcs12 .p12 files. Essentially, these files replace the archive created by ssl-admin's option (z).

Saturday, September 8, 2012

Getting spellchecking to work in LibreOffice / FreeBSD

I recently recompiled the LibreOffice port in FreeBSD and discovered that spell checking was not working. I installed textproc/en-hunspell and textproc/en-aspell and all was well.

PC-BSD 9 -> FreeBSD Notes

I've been using PC-BSD 9 for a while, and I got sick of having only PBI (push-button installer) software installed, opting for a more traditional BSD experience of dependency hell. Here are a few tips for the uninitiated (notes for noobs) -- to help you get away from PC-BSD PBI updates and into FreeBSD source-centric happiness.
  1. Use portmaster to upgrade packages. It's really the way to go. In order to get portmaster, you can use the command: portupgrade -PN portmaster
  2. The first time you upgrade your packages, browse /usr/ports/UPDATING. When you update your packages, this is the first place to look when something doesn't compile. After you finish with your update, NOTE THE DATE OF THE UPDATE somewhere. That way, the next time you upgrade packages, you don't have to look through the entire /usr/ports/UPDATING file.
  3. Accelerate your life. Tell FreeBSD to find and use the fastest mirror site:
    1. portmaster ports-mgmt/fastest_sites
    2. /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf
    3. echo '.include "/usr/local/etc/ports_sites.conf"' >> /etc/make.conf
  4. PERL updates are funky. When updating PERL, you'll need to update the many PERL packages that are already installed on your system. The p5-XML-SAX- packages are temperamental because p5-XML-SAX-Expat modifies a file that is contained in p5-XML-Parser. I haven't bothered to understand the problem well enough to write a definitive tutorial here. You'll also need to update all p5- ports, as well as print/foomatic-db-engine because it, too, contains a PERL package.

  5. Make your fonts pretty. Everyone uses LCDs these days, so go download some patches to better support your eyeballs. The patches at https://github.com/paranormal/freebsd_fonts_ubuntu allow FreeBSD to use subpixel antialiasing. The only port that I needed to patch in order to make both Firefox and LibreOffice look beautiful was the freetype2 package.
  6. Update your kernel for the latest fixes. If you decide to update your kernel (at this point, there are lots of bugfixes in 9-STABLE), try SVN: 
    1. svn checkout svn://svn.freebsd.org/base/stable/9 /usr/STABLE
    2. mv /usr/src /usr/RELEASE
    3. ln -s /usr/STABLE /usr/src
  7. Do all your configs at once. When using the Makefiles in /usr/ports/..., all you need to do is make config-recursive. portmaster apparently does this by default; I haven't yet figured out how to cause the tool to prompt with all of the configs (maybe using the -P option has something to do with this).

Monday, February 6, 2012

Make your GeForce GT 520 (or any Nvidia) video card sip power

I recently acquired an HP ProLiant Microserver N40L to replace my old giant mid-tower RAID box. Now that FreeBSD 9.0-RELEASE has integrated ZFS v28 for several months, I decided to migrate away from OpenIndiana 151a and enjoy FreeBSD's Linux binary compatibility, more up-to-date software selection, and a broader install base.

I imported my GeForce GT 520 video card into my new ProLiant microserver. The video card can be adapted to a "low profile" PCI slot by replacing the bracket in the front of the card. I disconnected the card's fan because it was loud, annoying, and making the dreaded "my bearings are out" screeeeeeeeching noise.

The GT 520 supports two digital monitors -- one connected via HDMI, and one via DVI. After enabling the commercially supported 'nvidia' driver by adding nvidia_load="YES" to /boot/loader.conf and generating a suitable xorg.conf file by running nvidia-xconfig, I was able to run nvidia-settings and watched my card idle at 85 degrees C. My power meter measured my system's idle consumption in X11 to be 80 watts. I also noticed that the PowerMizer showed that my card was operating at the maximum performance level.

After a bit of research, I discovered how to force the card into low-power mode. I added the following boldfaced lines into my /etc/X11/xorg.conf file:

Section "Device"
  Identifier     "Device0"
  Driver         "nvidia"
  VendorName     "NVIDIA Corporation"
  BoardName      "GeForce GT 520"
  Option  "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x3"
EndSection
This tells the card to enable PowerMizer; 0x2222 stands for "fixed frequency on battery and on AC" (byte 0x22 is for fixed frequency, 0x33 is for adaptive frequency, MSB is for battery), and the default power profile on AC is the lowest level (0x3 is lowest power, 0x2 is medium power, and 0x1 is high power).

I rebooted, and measured my card's idle temperature at 48 degrees C and idle power consumption in X11 to be 70 watts. This is a ten-watt power savings -- and remember, I disconnected the GT 520's fan.

The GeForce GT 520 is a great choice for anyone wanting to attach one or more DVI monitors to a low-power or passively cooled workstation.

I do not recommend ATI cards because configuring them to dual-head in Solaris or BSD environments has been nothing but a headache for me.

Sunday, February 27, 2011

ZFS Progress in FreeBSD

I've been watching the progress of my favorite filesystem, ZFS, in FreeBSD for a while now. ZFS v28 has been under test by the members of the freebsd-fs mailing list, and I have read multiple resources that have indicated that the performance of the ZFS implementation in FreeBSD is much better than in OpenSolaris; indeed, my Nexenta box only supports up to ZFS v26.

And now, ZFS v28 is now in FreeBSD-CURRENT:
http://lists.freebsd.org/pipermail/freebsd-fs/2011-February/010799.html

There is an excellent article in BSD magazine with some general information. The article is by Martin Matuška, who maintains a ZFS v28 patchset against FreeBSD-STABLE.

When I have some time, I'll be excited to migrate to FreeBSD, and to get away from the insanity that is (was) OpenSolaris.