1. 2016-02-20 - Check SSD cache on HP Pavilion 500-330nz; Tags: Check SSD cache on HP Pavilion 500-330nz
    Loading...

    Check SSD cache on HP Pavilion 500-330nz

    Just needed to upgrade to Windows 10 on my Desktop. I was curious if the SSD caching still works, but it was hard to find or lookup any information about the Condusiv Express Cache. Finally I could found at least the responsible program.

    Open the cmd as Administrator and change directory to this example. With info you get at least the caching status.

    C:\"Program Files"\"Condusiv Technologies"\ExpressCache\ECCmd.exe -info
    
    C:\Program Files\Condusiv Technologies\ExpressCache>ECCmd.exe -info
    ExpressCache Command Version 1.3.118.0
    Copyright⌐ 2010-2014 Condusiv Technologies.
    Date Time: 2/20/2016 17:54:58:540 (OMEGA #2)
    EC Cache Info
    ==================================================
    Mounted                   : Yes
    Partition Size            : 14.91 GB
    Reserved Size             : 3.00 MB
    Volume Size               : 14.91 GB
    Total Used Size           : 5.17 GB
    Total Free Space          : 9.75 GB
    Used Data Size            : 5.10 GB
    Used Data Size on Disk    : 5.16 GB
    Tiered Cache Stats
    ==================================================
    Memory in use             : 1024.00 MB
    Blocks in use             : 8188
    Read Percent              : 3.07%
    Cache Stats
    ==================================================
    Cache Volume Drive Number : 2
    Total Read Count          : 67834
    Total Read Size           : 2.00 GB
    Total Cache Read Count    : 25476
    Total Cache Read Size     : 811.62 MB
    Total Write Count         : 4047
    Total Write Size          : 102.19 MB
    Total Cache Write Count   : 1690
    Total Cache Write Size    : 38.52 MB
    Cache Read Percent        : 39.62%
    Cache Write Percent       : 37.69%
    
    ssd
  2. 2016-01-08 - Speed up my Linux Book; Tags: Speed up my Linux Book
    Loading...

    Speed up my Linux Book

    As a special daily deal I bought the Kingston SSDNow V300 240 GB for my linux notebook, Lenovo Thinkpad Edge S430. This post is going to illustrate the differences and performance gain due to the upgrade.

    General

    The basic procedure:

    • backup data
    • test hdd speed with ssd caching
    • swap hdd with ssd
    • install ubuntu 14.04.03 LTS
    • test ssd speed
    • enable trim support for the Kingston SSDNow V300

    Test hdd speed

    My Thinkpad has already a builtin SSD. This was used as caching device for the regular hdd. Testing the current read and write speed. Reading

    bk201@edge:~$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/bcache0    451G  103G  325G  25% /
    none            4,0K     0  4,0K   0% /sys/fs/cgroup
    udev            7,8G  4,0K  7,8G   1% /dev
    tmpfs           1,6G  1,3M  1,6G   1% /run
    none            5,0M     0  5,0M   0% /run/lock
    none            7,8G   80K  7,8G   1% /run/shm
    none            100M   52K  100M   1% /run/user
    /dev/sda1       236M   98M  126M  44% /boot
    bk201@edge:~$ sudo hdparm -Tt /dev/bcache0
    /dev/bcache0:
     Timing cached reads:   15372 MB in  2.00 seconds = 7691.04 MB/sec
     Timing buffered disk reads: 378 MB in  3.00 seconds = 125.94 MB/sec
    

    Writing

    bk201@edge:~$ dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output
    10240+0 records in
    10240+0 records out
    83886080 bytes (84 MB) copied, 0,094371 s, 889 MB/s
    

    Swap hdd with ssd

    pd024447_hard_disk_drive_assembly_01

    Ubuntu installation

    Due to my 16 GB RAM, there is no need or recommendation for a swap space on a SSD. Therefore install and partition manually.

    Test ssd

    After the super fast installation of Ubuntu Desktop, the following layout exists.

    tan@edge:~$ df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            7.8G   12K  7.8G   1% /dev
    tmpfs           1.6G  1.3M  1.6G   1% /run
    /dev/sda1       220G  3.9G  205G   2% /
    none            4.0K     0  4.0K   0% /sys/fs/cgroup
    none            5.0M     0  5.0M   0% /run/lock
    none            7.8G   80K  7.8G   1% /run/shm
    none            100M   84K  100M   1% /run/user
    /dev/sdb1        15G  105M   14G   1% /boot
    /dev/mmcblk0p1   15G   38M   14G   1% /downloads
    

    The previous SSD, which was used as caching device, is now used as boot partition. A 16 GB SD-Card is used for downloads. It was spare and this place has usually a high write incidents. Writing to it is also sufficient, even if you have fiber :-) .

    tan@edge:~$ sudo hdparm -Tt /dev/sda
    /dev/sda:
     Timing cached reads:   12800 MB in  2.00 seconds = 6403.59 MB/sec
     Timing buffered disk reads: 1174 MB in  3.00 seconds = 391.08 MB/sec
    tan@edge:~$ sudo hdparm -Tt /dev/sdb
    /dev/sdb:
     Timing cached reads:   14624 MB in  2.00 seconds = 7317.32 MB/sec
     Timing buffered disk reads: 748 MB in  3.00 seconds = 249.32 MB/sec
    tan@edge:~$ sudo hdparm -Tt /dev/mmcblk0p1
    /dev/mmcblk0p1:
     Timing cached reads:   13158 MB in  2.00 seconds = 6582.90 MB/sec
     Timing buffered disk reads:  82 MB in  3.04 seconds =  26.96 MB/sec
    

    For approx. 60 EUR a reasonable super cheap upgrade and working and programming with IntelliJ is as fast as with my Macbook Pro.

    Enable trim support

    As of Ubuntu 14.04, scheduled TRIM is enabled by default for Intel, SAMSUNG, OCZ, Patriot and Sandisk SSDs. If you have another brand, you could disable the vendor check by running the following command:

    sed -i 's/exec fstrim-all/exec fstrim-all --no-model-check/g' /etc/cron.weekly/fstrim
    

    In the end the file contents should look like this

    root@edge:~# cat /etc/cron.weekly/fstrim
    #!/bin/sh
    # call fstrim-all to trim all mounted file systems which support it
    set -e
    # This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
    # firmware may encounter data loss problems when running fstrim under high I/O
    # load (e. g.  https://launchpad.net/bugs/1259829). You can append the
    # --no-model-check option here to disable the vendor check and run fstrim on
    # all SSD drives.
    exec fstrim-all --no-model-check
    
    ssd
  3. 2015-08-05 - SSD caching with bcache for Linux; Tags: SSD caching with bcache for Linux
    Loading...

    SSD caching with bcache for Linux

    This article describes SSD caching for the HDD drive on a new Ubuntu Linux installation. The contents might as well apply to Debian Jessie.

    Preconditions

    • Device: Thinkpad Edge S430, 500 GB hdd, 16 GB ssd, 16 GB ram
    • OS: Ubuntu 14.04.02 LTS (Desktop)
    • bcache as ssd cache

    Ubuntu base installation

    During the installation I partition my hdd drive like this

    hdd disk partitioning

    root@edge:~# fdisk -l
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      499711      248832   83  Linux       (1)
    /dev/sda2          501758   976771071   488134657    5  Extended
    /dev/sda5       960774144   976771071     7998464   83  Linux       (2)
    /dev/sda6          501760   960774143   480136192   83  Linux       (3)
    Disk /dev/sdb: 16.0 GB, 16013942784 bytes
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048    31277231    15637592   83  Linux       (4)
    
    • /dev/sda1 ⇒ 256 MB boot partition, will not be cached, as precaution for dist-upgrades
    • /dev/sda5 ⇒ 8 GB for / (sufficient for basic installation and will be later used as swap partition)
    • /dev/sda6 ⇒ the remaining hdd disk space for migration to bcache, don’t assign a mount point
    • /dev/sdb1 ⇒ the 16 GB sdd cache

    Ubuntu will complain that there is no swap partition and /dev/sda6 has no mount point. These warnings can be ignored from the initial base installation. After you have finished the base installation, you are ready to install bcache.

    bcache installation

    If you have kernel version 3.10 or greater you should have bcache, eg. Ubuntu distributions since version 14.04. You can lookup the kernel version with

    tan@edge:~$ uname -a
    Linux edge 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    

    bcache-tools

    The first thing you must do is install bcache-tools. This is the tool that will create and register the block devices to work with bcache. To install bcache-tools you must first add the repository. This is done with the following commands:

    sudo add-apt-repository ppa:g2p/storage
    sudo apt-get update
    sudo apt-get install bcache-tools
    
    sudo apt-get install git
    sudo apt-get install build-essential
    sudo apt-get install uuid-dev
    git clone http://evilpiepirate.org/git/bcache-tools.git
    cd bcache-tools
    make
    sudo make install
    

    If you are using higher ubuntu version like 14.10, bcache-tools are already in the repository.

    # install bcache-tools from repo
    apt-get install bcache-tools
    

    Concept

    bcache has two requirements: # a ‘backing’ device, the device that shall be cached, the empty hard disk or an empty partition on a hard disk # a ‘caching’ device, the device that is used as cache, the SSD, e.g. 16-32 GB contained in hybrid drives

    bcache

    It is designed around the unique characteristics of flash-based SSDs and uses a hybrid btree/log to track cached extents. It is designed to avoid random writes at all costs. bcache fills up an erase block sequentially and then issues a discard before reusing it. Both write-through and write-back caching are supported. Write-back defaults to off, but can be switched on and off arbitrarily at runtime. The virtual bcache device is created by attaching the backing device and caching device.

    Setup

    • the backing device is /dev/sda6, formatted as ext4
    • the caching device is /dev/sdb1, formatted as ext4

    Cleanup devices

    If the devices have already been used for bcache a cleanup is necessary. You may skip this section, if the devices are not used with bcache before.

    We put zeroes on the first 4kB of the disk:

    # wipe backing device
    sudo dd if=/dev/zero if=/dev/sda6 bs=512 count=8
    wipefs -a /dev/sda6
    # wipe caching device
    sudo dd if=/dev/zero if=/dev/sdb1 bs=512 count=8
    wipefs -a /dev/sdb1
    

    Create and register the devices

    The virtual bcache device is created by attaching the backing device and caching device.

    First set up the backing device (the empty partition on your hard drive).

    root@edge:/home/tan# make-bcache -B /dev/sda6
    UUID:			4bd28ddd-aae2-4b91-8ba9-a7347d365987
    Set UUID:		fc051fbd-37b1-4697-9ac9-fdd3e00ed92f
    version:		1
    block_size:		1
    data_offset:	16
    

    Then do the same thing for your caching partition.

    root@edge:/home/tan# make-bcache -C /dev/sdb1
    

    If you get an error that there are already non-bcache superblocks on the device(s), you have to remove those errors with the wipefs command (see above cleanup section).

    Once the backing device is registered, it will show up in /dev in the form of /dev/bcacheX (where X is a number – such as /dev/bcache0).

    You might need to format the devices

    mkfs.ext4 /dev/sda6
    mkfs.ext4 /dev/sdb1
    

    Show bcache superblock

    bcache-super-show prints the bcache superblock of a cache device or a backing device.

    root@edge:/home/tan# bcache-super-show /dev/sdb1
    sb.magic        ok
    sb.first_sector     8 [match]
    sb.csum         39497E70770FF75D [match]
    sb.version      3 [cache device]
    dev.label       (empty)
    dev.uuid        dc57ecd7-cc8d-468e-9853-9b0f6214faba
    dev.sectors_per_block   1
    dev.sectors_per_bucket  1024
    dev.cache.first_sector  1024
    dev.cache.cache_sectors 31273984
    dev.cache.total_sectors 31275008
    dev.cache.ordered   yes
    dev.cache.discard   no
    dev.cache.pos       0
    dev.cache.replacement   0 [lru]
    cset.uuid       9b1e7bf9-a97a-4785-bacb-0b17189adc08
    

    Attach devices

    The devices are now created and registered. You now have to attach the caching and backing devices to enable the caching feature. Here you will need the UUID (a long string of characters) found in /sys/fs/bcache/ (enter the command: ls /sys/fs/bcache and you’ll see the UUID). To attach the devices, you simply use the echo command to add the UUID to the attach file in /sys/block/bcache0/bcache/. The command is:

    echo UUID > /sys/block/bcache0/bcache/attach
    

    Where UUID is the actual UUID found in /sys/fs/bcache.

    root@edge:/mnt# ls /sys/fs/bcache/
    9b1e7bf9-a97a-4785-bacb-0b17189adc08  register  register_quiet
    root@edge:/mnt# echo 9b1e7bf9-a97a-4785-bacb-0b17189adc08 > /sys/block/bcache0/bcache/attach
    

    Check bcache status

    If bcache was properly setup, check with lsblk.

    root@edge:~# lsblk
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sda           8:0    0 465,8G  0 disk
    ├─sda1        8:1    0   243M  0 part /boot
    ├─sda2        8:2    0     1K  0 part
    ├─sda5        8:5    0   7,6G  0 part
    └─sda6        8:6    0 457,9G  0 part
      └─bcache0 251:0    0 457,9G  0 disk /  <b>(1)</b>
    sdb           8:16   0  14,9G  0 disk
    └─sdb1        8:17   0  14,9G  0 part
      └─bcache0 251:0    0 457,9G  0 disk /  <b>(2)</b>
    sr0          11:0    1  1024M  0 rom
    
    1. bcache0 for the backing device
    2. bcache0 for the caching device

    Migrate root partition

    create mount points

    cd /media
    mkdir OLD NEW
    mount /dev/sda5 OLD
    mount /dev/bcache0 NEW
    

    copy contents from old to new partition

    rsync -a OLD/ NEW/
    

    grub install

    mount /dev/sda1 NEW/boot
    mount -o bind /dev NEW/dev
    mount -t proc none NEW/proc
    mount -t sysfs none NEW/sys
    chroot NEW
    ls -l /dev/disk/by-uuid/ | grep bcache0     <b>(1)</b>
    vim NEW/etc/fstab                           <b>(2)</b>
    update-grub                                 <b>(3)</b>
    grub-install /dev/sda
    
    1. find out the UUID of /dev/bcache0
    2. replace the previous UUID of / with the new UUID/dev/bcache0
    3. creates a new grub.cfg with changed values from /etc/fstab

    Check caching

    After the grub installation, the next reboot should start from the backing device with bcache using the sdd as caching device.

    To check to see if the caching is working, open up a terminal window and issue the command:

    caching stats

    tan@edge:~$ tail /sys/block/bcache0/bcache/stats_total/*
    ==> /sys/block/bcache0/bcache/stats_total/bypassed <==
    294M
    ==> /sys/block/bcache0/bcache/stats_total/cache_bypass_hits <==
    3041
    ==> /sys/block/bcache0/bcache/stats_total/cache_bypass_misses <==
    0
    ==> /sys/block/bcache0/bcache/stats_total/cache_hit_ratio <==
    64
    ==> /sys/block/bcache0/bcache/stats_total/cache_hits <==
    7398
    ==> /sys/block/bcache0/bcache/stats_total/cache_miss_collisions <==
    0
    ==> /sys/block/bcache0/bcache/stats_total/cache_misses <==
    4069
    ==> /sys/block/bcache0/bcache/stats_total/cache_readaheads <==
    0
    

    Reuse old root as swap

    /dev/sda5 is no longer used and with 8 GB fits perfectly as swap for 16 GB main memory.

    You might change the partition type of /dev/sda5 to swap.

    root@edge:~# fdisk -l /dev/sda
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x00023929
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      499711      248832   83  Linux
    /dev/sda2          501758   976771071   488134657    5  Extended
    Partition 2 does not start on physical sector boundary.
    /dev/sda5       960774144   976771071     7998464   82  Linux swap / Solaris <b>(1)</b>
    /dev/sda6          501760   960774143   480136192   83  Linux
    Partition table entries are not in disk order
    
    1. Change this partition type to Linux swap

    make and enable swap

    mkswap /dev/sda5
    # output
    Setting up swapspace version 1, size = 15624188 KiB
    no label, UUID=3e021d3e-6faf-4f71-bef6-7acb1e49aa75
    # activate swap
    swapon /dev/sda5
    echo "UUID=3e021d3e-6faf-4f71-bef6-7acb1e49aa75 none swap defaults 0 0" >> /etc/fstab (1)
    
    1. add swap partition to /etc/fstab
  4. 2015-07-29 - Display ExpressCache information; Tags: Display ExpressCache information
    Loading...

    Display ExpressCache information

    ExpressCache enables systems with a mSATA SSD device as a cache for the harddisk on Windows.

    Most Thinkpad laptops have this software installed. Run the command prompt as administrator and enter following command, gives you specific details about your caching status:

    C:>eccmd.exe -info
    ExpressCache Command Version 1.0.86.0
    Copyright&reg; 2010-2011 Diskeeper Corporation.
    Date Time: 7/29/2015 10:16:39:174 (EDGE #10)
    EC Cache Info
    ==================================================
    ==================================================
    Mounted                   : Yes
    Partition Size            : 14.91 GB
    Reserved Size             : 3.00 MB
    Volume Size               : 14.91 GB
    Total Used Size           : 8.96 GB
    Total Free Space          : 5.95 GB
    Used Data Size            : 8.89 GB
    Used Data Size on Disk    : 8.96 GB
    Tiered Cache Stats
    ==================================================
    Memory in use             : 1024.00 MB
    Blocks in use             : 8188
    Read Percent              : 7.44%
    Cache Stats
    ==================================================
    Cache Volume Drive Number : 1
    Total Read Count          : 138803
    Total Read Size           : 5.66 GB
    Total Cache Read Count    : 38977
    Total Cache Read Size     : 1.69 GB
    Total Write Count         : 337549
    Total Write Size          : 15.28 GB
    Total Cache Write Count   : 64243
    Total Cache Write Size    : 1.28 GB
    Cache Read Percent        : 29.79%
    Cache Write Percent       : 8.40%