Category: How-To

  • Folding@Home: How to check your progress

    Once you start folding you will want to check on your contribution and see how you’re faring compared to other volunteers – one of the most popular ways of checking your stats is through the Extreme Overclocking website:

     

    http://folding.extremeoverclocking.com/

     

    On the left-hand side you can see a name search field; put your username in there and you will see all of the username results which match. This can be a bit of an issue if you have a common username (e.g. Bob) – doing a case-sensitive search might help a bit there. Once you find your username you can save the URL as it’s unique; for ours, see:

     

    http://folding.extremeoverclocking.com/user_summary.php?s=&u=567476

     

    If you click on your username at the top you’ll see your ranking within your team. The rest of the information is easily accessible – you can see your daily and weekly stats in the bar up the top and below that your top 5 conquests and threats. Below that again are graphs showing your future production estimates, past production and a list of your points from the past few months, weeks and days.

     

    The listings are updated every 3 hours, so bookmark the page and check regularly!

  • ZFS: How to change the compression level

    By default ZFS uses the lzjb compression algorithm; you can select others when setting compression on a ZFS folder. To try another one do the following:

     

    sudo zfs set compression=gzip [zfs dataset]

     

    This changes the compression algorithm to gzip. By default this sets it to gzip-6 compression; we can actually specify what level we want with:

     

    sudo zfs set compression=gzip-[1-9] [zfs dataset]

     

    e.g.

     

    sudo zfs set compression=gzip-8 kepler/data

     

    Note that you don’t need the leading / for the pool, and that you can set this at a pool level and not just on sub-datasets. 1 is the lowest level of compression (less CPU-intensive, less compressed) where gzip-9 is the opposite – often quite CPU intensive and offers the most compression. This isn’t necessarily a linear scale, mind, and the type of data you are compressing will have a huge impact on what sort of returns you’ll see. Try various levels out on your data, checking the CPU usage as you go and the compression efficiency afterwards – you may find that 9 is too CPU-intensive, or that you don’t get a great deal of benefit after a certain point. Note that when you change the compression level it only affects new data written to the ZFS dataset; an easy way of testing this is to make several sets, set a different level of compression on each and copy some typical data to them one by one while observing. We discussed checking your compression efficiency in a previous post.

     

    Compression doesn’t just benefit us in terms of space saved, however – it can also greatly improve disk performance at a cost of CPU usage. Try some benchmarks on compression-enabled datsets and see if you notice any improvement – it can be anywhere from slight to significant, depending on your setup.

  • ZFS: Replacing a drive with a larger drive within a vdev

    One way to expand the capacity of a zpool is to replace each disk with a larger disk; once the last disk is replaced the pool can be expanded (or will auto-expand, depending on your pool settings). To do this we do the following:

     

    zpool replace [poolname] [old drive] [new drive]

     

    e.g.:

     

    zpool replace kepler ata-WDC_WD15EARX-00PASB0_WD-WCAZAA512624 ata-WDC_WD20EARX-00PASB0_WD-WCAZAA637471

    If you then check on the pool’s status via zpool status, we see:

     

    NAME                                            STATE     READ WRITE CKSUM
    kepler                                          ONLINE     0     0     0
    raidz2-0                                      ONLINE     0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WMAZA7352703    ONLINE       0     0     0
    replacing-1                                 ONLINE     0     0     0
    ata-WDC_WD15EARX-00PASB0_WD-WCAZAA512624  ONLINE      0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WCAZAA637471  ONLINE       0     0     0  (resilvering)

     

    The pool will resilver and copy the drive contents across. If you have large drives which are reasonably full this resilver process can take quite a few hours. You can do this with multiple drives at once; here’s a zpool

     

            NAME                                            STATE     READ WRITE CKSUM
    kepler                                          ONLINE     0     0     0
    raidz2-0                                      ONLINE     0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WMAZA7352703    ONLINE       0     0     0
    replacing-1                                 ONLINE     0     0     0
    ata-WDC_WD15EARX-00PASB0_WD-WCAZAA512624  ONLINE      0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WCAZAA637471  ONLINE       0     0     0  (resilvering)
    replacing-2                                 ONLINE       0     0     0
    ata-ST2000DM001-9YN164_W24009TB           ONLINE       0     0     0
    ata-WDC_WD20EARS-00MVWB0_WD-WCAZAC389099  ONLINE       0     0     0  (resilvering)
    ata-WDC_WD20EFRX-68AX9N0_WD-WMC300005367    ONLINE       0     0     0
    ata-WDC_WD20EARX-00MMMB0_WD-WCAWZ0842974    ONLINE       0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WMAZA7482198    ONLINE       0     0     0

    Please don’t disconnect the old drive before inserting the new one – this can cause issues with some setups where ZFS complains that it cannot find the old drive to replace.

     

    Once your resilver is complete on the final drive you can expand the vdev by running:

     

    zpool online -e [poolname]

     

    or you can turn on automatic expansion with the following settings:

     

    zfs set autoexpand=on [poolname]

     

    If you are using zpool online -e the pool does not have to be offline for it to work. Now sit back and enjoy your increased space!

  • ZFS: Adding an SSD as a cache drive

    ZFS uses any free RAM to cache accessed files, speeding up access times; this cache is called the ARC. RAM is read at gigabytes per second, so it is an extremely fast cache. It is possible to add a secondary cache – the L2ARC (level 2 ARC) in the form of solid state drives. SSDs may only be able to sustain about half of a single gigabyte per second but this is still vastly more than any spinning disk is able to achieve, and the IOPS (in/out operations per second) are also typically much, much higher than standard hard drives.

     

    If you find that you want more high-speed caching and adding more RAM isn’t feasible from an equipment or cost perspective a L2ARC drive may well be a good solution. To add one, insert the SSD to the system and run the following:

     

    zpool add [pool] cache [drive]

    e.g.:

     

    zpool add kepler cache ata-M4-CT064M4SSD2_000000001148032355BE

     

    zpool status now shows:

     

            NAME                                            STATE     READ WRITE CKSUM
    kepler                                          ONLINE     0     0     0
    raidz2-0                                      ONLINE     0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WMAZA7352713    ONLINE       0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WCAZAA637401  ONLINE       0     0     0
    ata-WDC_WD20EARS-00MVWB0_WD-WCAZAC389999  ONLINE       0     0     0
    ata-WDC_WD20EFRX-68AX9N0_WD-WMC300005397    ONLINE       0     0     0
    ata-WDC_WD20EARX-00MMMB0_WD-WCAWZ0842074    ONLINE       0     0     0
    ata-WDC_WD20EARX-00PASB0_WD-WMAZA7482193    ONLINE       0     0     0
    cache
    ata-M4-CT064M4SSD2_000000001148032155BE       ONLINE       0     0     0

    You can see that the cache drive has been added to the bottom of the pool listing.

     

    The way the ARC works is beyond the scope of this post – suffice to say for the moment that simply adding a L2ARC is not necessarily going to improve performance in every situation, so do some research before spending money on a good SSD. Check back for a more detailed investigation into how ARC and L2ARC work in November!

  • How to exclude results from grep

     

    Sometimes you may wish to further filter grep output, such as in the following situation:

     

    # zfs get all | grep compressratio

    backup01         compressratio         1.23x                  –
    backup01         refcompressratio      1.00x                  –
    backup01/data    compressratio         1.50x                  –
    backup01/data    refcompressratio      1.50x                  –
    backup01/photos  compressratio         1.05x                  –
    backup01/photos  refcompressratio      1.05x                  –

    Here we only really want to see the compressratio results, not the refcompressratio. We can pipe the grep output to another grep command, this time inverting the results with the -v switch.

     

    # zfs get all | grep compressratio | grep -v refcompressratio

    backup01         compressratio         1.21x                  –
    backup01/data    compressratio         1.50x                  –
    backup01/photos  compressratio         1.05x                  –

    This excludes any line containing refcompressratio, making the results easier to read. This is particularly helpful when you have a large number of results from grep.

  • ZFS: How to check compression efficiency

     

    If you have enabled compression on a ZFS folder you can check to see just how much disk space you’re saving. Use the following command:

     

    sudo zfs get all [poolname]/[folder] | grep compressratio

     

    An example:

     

    sudo zfs get all backup01/data | grep compressratio

     

    returns the following:

     

    backup01/data compressratio  1.50x  –

     

    Here we can see we have a compression ratio of 1.5x. Compression is an excellent way of reducing disk space used and improving performance, so long as you have a modern CPU with enough spare power to handle it. Some data will not be easily compressible and you may see less benefit – other data will be much more compressible and you may reach quite high compression ratios.

     

    If we run the same command on a folder full of already-compressed RAW image files:

     

    sudo zfs get all backup01/photos | grep compressratio

    backup01/photos compressratio 1.05x

     

    …we can see that they do not compress as easily as the documents in the data folder, giving us only a 1.05x compression ratio. You can see the compression ratio of all of your ZFS pools and folders with the following:

     

    sudo zfs get all | grep compressratio

     

    Check your own datasets and see how much you are saving!

  • Ubuntu: How to list drives by ID

    If you’re creating a  zpool on Ubuntu you have several options when it comes to referring to the drives; the most common is /dev/sda, /dev/sdb and so on. This can cause problems with zpools as the letter designated to a drive can change if you move the drives around, add or remove a drive – causing your zpool to come up as faulty. One way to avoid this is to use a more specific name for the disk, one of which is the ID. You can find this on Ubuntu through the following command:

     

    sudo ls -l /dev/disk/by-id/

     

    This gives an output similar to the following:

     

    lrwxrwxrwx 1 root root  9 Oct 19 08:48 ata-ST2000DM001-9YN164_W1F01W57 -> ../../sdd

    lrwxrwxrwx 1 root root  9 Oct 19 08:48 ata-ST2000DM001-9YN164_W2400946 -> ../../sdc

    lrwxrwxrwx 1 root root  9 Oct 19 08:48 ata-ST2000DM001-9YN164_W24009TB -> ../../sde

    lrwxrwxrwx 1 root root  9 Oct 19 08:48 ata-ST2000DM001-9YN164_W2402PBQ -> ../../sdb

    lrwxrwxrwx 1 root root  9 Oct 19 08:48 ata-ST2000DM001-9YN164_Z24064V7 -> ../../sda

     

    You can see that the command helpfully points which ID is associated with which /dev/sd?.

  • ZFS basics: Installing ZFS on Ubuntu

    For those who don’t want to use Solaris or FreeBSD as their ZFS platform Ubuntu now seems a valid option; installation is now relatively straightforward. Please note, though, that you should be running a 64-bit system – ZFS on Ubuntu is not stable on a 32-bit system. Open up a terminal and enter the following:

     

    sudo add-apt-repository ppa:zfs-native/stable
    sudo apt-get update
    sudo apt-get install ubuntu-zfs

    …and that’s it! From here you can begin to use the filesystem by creating a pool or importing an existing pool. Many people find Ubuntu an easier system to manage compared to Solaris or FreeBSD so it’s good news that it now appears to be a stable implementation, despite being technically a release candidate.

  • Checking SSD health with ESXi 5.1

    A new feature with ESXi 5.1 is the ability to check SSD health from the command line. Once you have SSH’d into the ESXi box, you can check the drive health with the following command:

     

    esxcli storage core device smart get -d [drive]

     

    …where [drive] takes the format of: t10.ATA?????????. You can find out the right drive name by the following:

     

    ls -l /dev/disks/

     

    This will return output something like the following:

     

    mpx.vmhba32:C0:T0:L0
    mpx.vmhba32:C0:T0:L0:1
    mpx.vmhba32:C0:T0:L0:5
    mpx.vmhba32:C0:T0:L0:6
    mpx.vmhba32:C0:T0:L0:7
    mpx.vmhba32:C0:T0:L0:8
    t10.ATA_____M42DCT064M4SSD2__________________________000000001147032121AB
    t10.ATA_____M42DCT064M4SSD2__________________________000000001147032121AB:1
    t10.ATA_____M42DCT064M4SSD2__________________________0000000011470321ADA4
    t10.ATA_____M42DCT064M4SSD2__________________________0000000011470321ADA4:1

     

    Here I can use the t10.xxx names without the :1 at the end to see the two SSDs available, copying and pasting the entire line as the [drive]. The command output should look like:

     

    ~ # esxcli storage core device smart get -d t10.ATA_____M42DCT064M4SSD2__________________________000000001147032121AB
    Parameter                     Value  Threshold  Worst
    —————————-  —–  ———  —–
    Health Status                 OK     N/A        N/A
    Media Wearout Indicator       N/A    N/A        N/A
    Write Error Count             N/A    N/A        N/A
    Read Error Count              100    50         100
    Power-on Hours                100    1          100
    Power Cycle Count             100    1          100
    Reallocated Sector Count      100    10         100
    Raw Read Error Rate           100    50         100
    Drive Temperature             100    0          100
    Driver Rated Max Temperature  N/A    N/A        N/A
    Write Sectors TOT Count       100    1          100
    Read Sectors TOT Count        N/A    N/A        N/A
    Initial Bad Block Count       100    50         100

    One figure to keep an eye on is the reserved sector count – this should be around 100, and diminishes as the SSD replaces bad sectors with ones from this reservoir. The above statistics are updated every 30 minutes. As a point of interest, in this case ESXi isn’t picking up on the data correctly – the SSD doesn’t actually have exactly 100 power-on hours and 100 power cycle count.

    Assuming it works for your SSDs, this is quite a useful tool – knowing when a drive is likely to fail can give you the opportunity for early replacement and less downtime due to unexpected failures.

  • DNS troubles with Ubuntu Server 12.04

    Some customers have been having DNS issues after setting a static IP on Ubuntu 12.04.1 where the server is no longer picking up the DNS settings as it was before; this can be easily fixed by adding the following to /etc/network/interfaces after the eth0 entry:

     

    dns-nameservers [ip.of.your.router]

     

    e.g., for a modem/router that’s 10.1.1.1 on your local network, your /etc/network/interfaces file might look like:

     

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 10.1.1.50
    netmask 255.255.255.0
    gateway 10.1.1.1
    broadcast 10.1.1.255

    dns-nameservers 10.1.1.1

    Restart your network with:

     

    sudo /etc/init.d/networking restart

     

    …then try pinging Google or something similar and you should have success 🙂

     

    It’s generally not advisable for Australians to use nameservers located elsewhere, e.g. Google’s public DNS’ 8.8.8.8 or 8.8.4.4 – some things which are unmetered by your ISP may be metered if you do so.