On 12/15/2010 04:46 PM, [email protected] wrote:
First of all, I would like to thanks for answers.

One more question and some reply in text.

After making ssd disc a cache for some partition, there is possibility to detach cache. What should 
I do to "erase" (trim) whole disk for another benchmarking? I think that "dd 
if=/dev/zero of=/dev/sdx" wouldnt be right command.

Yeah, one nifty thing is you can disable caching on a mounted, in use filesystem (and reenable it provided you invalidate the cache somehow).

Hdparm can send a trim, but it can't do the whole disk at once, you've got to script it. I wrote one awhile back, this is what I use:

#!/bin/bash

DEV=$1

if [ ! -b "$DEV" ]; then
        echo "Can't open $DEV"
        exit 1
fi

SECTORS=`hdparm -I "$DEV"|awk '/LBA48/ { print $5 }'`
OFFSET=0

echo "$DEV has $SECTORS sectors:"

while (($SECTORS)); do
        i=$(( $SECTORS > 65535 ? 65535 : $SECTORS ))

        echo "wiping $i sectors at offset $OFFSET"
        hdparm --please-destroy-my-drive \
                --trim-sector-ranges $OFFSET:$i $DEV

        SECTORS=$(($SECTORS - $i))
        OFFSET=$(($OFFSET + $i))
done
--
To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to