Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
2,792 Views

Trim function works well on Linux/Ubuntu 9.10 64-bit

For those waiting for an updated TRIM enabled firmware for their x25-m 80gb g2 postville:

I flashed my drive and am trimming away!

If you track the conversation from here onwards you should be all set: http://www.ocztechnologyforum.com/forum/showthread.php?t=60882&page=10

1) download hdparm 9.27

2) make, make install

3) apply the latest patch mentioned in the thread above as presented on page 10 by danekl

4) copy wiper.sh to usr/local/bin

5) run from terminal: sudo wiper.sh --commit / or sudo wiper.sh --commit /dev/sdaN (where sdaN is your ssd)

BTW, this is not real TRIM but gives the same effect. I run this each time at system start up.

Skip Windows, go Ubuntu!

0 Kudos
16 Replies
idata
Community Manager
132 Views

That's good news.

The big companies like Intel and Microsoft need to come out of their cave mentality. They thrive own their intellectual engineering thinking that no one else but them can come up with engineering solutions that will benefit the masses. For Intel this is readily evident, in their lack of providing even a minimal of of help to their users and the tight-lip on how their SSDs work in general. Anandtech took their drives apart and they did a excellent job of explaining how the Intel drive works without Intel's help. Shame on Intel.

It's going to take Microsoft and the vendors probably a year to get TRIM working harmoniously without data loss. The Linux and the Unix brethren will have things working in months. The proof is in your post. As I said before in another thread Microsoft did not design Win7 to optimize the use of SSDs. Their tactic was purely "hype" and as usual people fell for it and are now surely disappointed with its implementation.

idata
Community Manager
132 Views

FYI. here's the putput I get:

[Sat Nov 21 21:06:56 CET 2009] trim starting

wiper.sh: Linux SATA SSD TRIM utility, version 2.5, by Mark Lord.

 

Preparing for online TRIM of free space on /dev/sda1 (ext4 mounted read-write at /).

 

Creating temporary file (65301988 KB)..

 

Syncing disks..

 

Beginning TRIM operations..

/dev/sda:

 

trimming 30195709 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 31358977 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 31293442 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 31457280 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 6298568 sectors from 104 ranges

 

succeeded

 

Removing temporary file..

 

Syncing disks..

 

Done.

 

 

[Sat Nov 21 21:07:16 CET 2009] trim finished
idata
Community Manager
132 Views

really nice to hear. i'm new to ssds and therefore pretty unsure how to handle my x25-m g2. i opened two threads, maybe someone could give me an advice please:

- http://communities.intel.com/thread/8419

- http://sourceforge.net/projects/hdparm/forums/forum/461704/topic/3466536

idata
Community Manager
132 Views

blackSP,

I tried it and i'm having no success. Downloaded from sourceforge.net the hdparm 9.27 source which included wiper.sh. I'm using 9.10 32 bit PAE mode on a Macbook pro 5,2. 6 GB memory. Gives me an error message cannot open file. I put some debug statements in the program to see how big the WIPEFILE is and it is huge. It fills the remainder of the drive space. What i'm doing wrong? I didn't apply the patch also?.

Appreciate any help.

idata
Community Manager
132 Views

This is exactly the output:

wiper.sh: Linux SATA SSD TRIM utility, version 2.5, by Mark Lord.

 

rootdev=/dev/sda1 rdev=/dev/sda1

 

fsmode2: fsmode=read-write

 

/: fstype=ext4

 

freesize = 132285104 KB, reserved = 1322851 KB

 

Preparing for online TRIM of free space on /dev/sda1 (ext4 mounted read-write at /).

 

This will be a DRY-RUN only. Use --commit to do it for real.

 

Creating temporary file (130962253 KB)..

 

Syncing disks..

 

Simulating TRIM operations..

 

get_trimlist=/sbin/hdparm --fibmap WIPER_TMPFILE.3818

 

(dry-run) trimming 261924512 sectors from 4280 ranges

 

Removing temporary file..

 

Syncing disks..

 

Done.
idata
Community Manager
132 Views

Sorry, being a complete noob I can't help you, I've been fiddeling for days myself to get wiper.sh to work!

I ended up registering on the OCZ form where the guys where extremely helpfull and made a few patches that were essential to get wiper to work.

But I first followed up another suggestion: use wiper 1.9 and that worked straight away!

But... before you do anything ensure your drive supports trim, flash it (with the firmware Intel tookoffline). Linux is no Windows 7 so your machine shouldn't hang. Mine didn't!

idata
Community Manager
132 Views

Thanks, blackSP. My ssd has the right firmware. I upgraded before Intel pulled it. I will try the wiper 1.9 version.

idata
Community Manager
132 Views

I upgraded my Intel G2 80GB SSD to the newest firmware ending in HD

I have hdparm 9.27 installed on my Arch Linux system

I patched the wiper.sh v2.5 to work for the Intel SSD and named it wiper-intel.sh

Now wiper-intel.sh works. I no longer get the "Input/Output Error"

I uploaded the patched wiper.sh to rapidshare here...

http://rapidshare.com/files/349948975/wiper-intel.sh

MD5sum= 90e596a399ff6660c8542bf6be1d58ce

SHA1sum= f1af639d00a671532069ccf6407a91a35bf94521

Here is the output of the last run of wiper-intel.sh on the ext4 /root partition on my Intel SSD

[XXXXX@LinuxBox ~]$ sudo ./wiper-intel.sh --commit /dev/sda2

wiper-intel.sh: Linux SATA SSD TRIM utility, version 2.5, by Mark Lord.

 

Preparing for online TRIM of free space on /dev/sda2 (ext4 mounted read-write at /).

This operation could silently destroy your data. Are you sure (y/N)? y

 

Creating temporary file (45499969 KB)..

 

Syncing disks..

 

Beginning TRIM operations..

/dev/sda:

 

trimming 31178749 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 31375361 sectors from 512 ranges

 

succeeded

/dev/sda:

 

trimming 28445834 sectors from 464 ranges

 

succeeded

 

Removing temporary file..

 

Syncing disks..

 

Done.
ÉChem
Beginner
132 Views

Hello,

I have an Intel G2 160 GB SSD. I have not been able to download the modified script from rapidshare, but from somewhere else, even though I cannot be sure of the integrity of the script then. It first seems to be OK (maximum number of displayed ranges is 512), but I'm still having the input/output errors.

1) can someone confirm that it also work on 160 GB model?

2) if so, could you indicate an alternate trustworthy download location?

Thanks!

idata
Community Manager
132 Views

Hum, that link still works.

Anyway, so it is not working ? LIke it quits with an Input/Output error? Or are you getting errors in /var/log/messages ?

Also, the script is farly small. You can just read it to make sure it is not running netcat on some random port and emilling off your IP to some randome email account or something like that. Hell, you may be best off to to that anyway. my point being that you can read the script there really is not need for the hash values as far as security is consered.

----------

Ok I just posted the script below. Make sure word-wraping dosen't mess up the code.

ÉChem
Beginner
132 Views

Thanks for your answer! I have the same problem though:

/dev/sda:

 

trimming 154928 sectors from 164 ranges

 

FAILED: Input/output error

And hdparm -i shows Model=INTEL SSDSA2M160G2GC, FwRev=2CV102HD, so I have the right FW, right?

ÉChem
Beginner
132 Views

News from the front:

I've just booted using the live CD (still 9.10 64 bit), installe hdparm 9.27 and use your modified script: it works!

I will try to find out what make it fails on my install and let you know if interesting.

Thanks!

idata
Community Manager
132 Views

As far as I know it only works with hdparm 9.27, since I installed that my disk is trimmed with every boot, no i/o errors.

ÉChem
Beginner
132 Views

Update: it seems that it is coming from the 2.6.32 kernel (from Ubuntu PPA) I'm using. When using latest 2.6.31 kernel from Ubuntu it's working as intended.

idata
Community Manager
132 Views

I can confirm that there seems to be a problem with the 2.6.32-kernel in Ubuntu

I get input/output-errors (though not always, some of the TRIM commands succeed) with 2.6.32. But using 2.6.35-rc1, all TRIM commands succeed.

idata
Community Manager
132 Views

# !/bin/bash

 

#

 

# SATA SSD free-space TRIM utility, by Mark Lord

VERSION=2.5

 

 

# Copyright (C) 2009 Mark Lord. All rights reserved.

 

#

 

# Requires gawk, a really-recent hdparm, and various other programs.

 

# This needs to be redone entirely in C, for 64-bit math, someday.

 

#

 

# This program is free software; you can redistribute it and/or

 

# modify it under the terms of the GNU General Public License Version 2,

 

# as published by the Free Software Foundation.

 

#

 

# This program is distributed in the hope that it would be useful,

 

# but WITHOUT ANY WARRANTY; without even the implied warranty of

 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

 

# GNU General Public License for more details.

 

#

 

# You should have received a copy of the GNU General Public License

 

# along with this program; if not, write to the Free Software Foundation,

 

# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

export LANG=C

# The usual terse usage information:

 

#

 

function usage_error(){

 

echo >&2

 

echo "Linux tune-up (TRIM) utility for SATA SSDs"

 

echo "Usage: $0 [--verbose] [--commit] " >&2

 

echo " Eg: $0 /dev/sda1" >&2

 

echo >&2

 

exit 1

 

}

# Parameter parsing for the main script.

 

# Yeah, we could use getopt here instead, but what fun would that be?

 

#

echo

 

echo "${0# */}: Linux SATA SSD TRIM utility, version $VERSION, by Mark Lord."

verbose=0

 

commit=""

 

argc=$#

 

arg=""

 

while [ $argc -gt 0 ]; do

 

if [ "$1" = "--commit" ]; then

 

commit=yes

 

elif [ "$1" = "--verbose" ]; then

 

verbose=1

 

elif [ "$1" = "" ]; then

 

usage_error

 

else

 

if [ "$arg" != "" ]; then

 

echo "$1: too many arguments, aborting." >&2

 

exit 1

 

fi

 

arg="$1"

 

fi

 

argc=$((argc - 1))

 

shift

 

done

 

[ "$arg" = "" ] && usage_error

# Find a required program, or else give a nicer error message than we'd otherwise see:

 

#

 

function find_prog(){

 

prog="$1"

 

if [ ! -x "$prog" ]; then

 

prog="${prog# */}"

 

p=`type -f -P "$prog" 2>/dev/null`

 

if [ "$p" = "" ]; then

 

echo "$1: needed but not found, aborting." >&2

 

exit 1

 

fi

 

prog="$p"

 

[ $verbose -gt 0 ] && echo " --> using $prog instead of $1" >&2

 

fi

 

echo "$prog"

 

}

# Ensure we have most of the necessary utilities available before trying to proceed:

 

#

 

hash -r # Refresh bash's cached PATH entries

 

HDPARM=`find_prog /sbin/hdparm` || exit 1

 

FIND=`find_prog /usr/bin/find` || exit 1

 

STAT=`find_prog /usr/bin/stat` || exit 1

 

GAWK=`find_prog /usr/bin/gawk` || exit 1

 

BLKID=`find_prog /sbin/blkid` || exit 1

 

GREP=`find_prog /bin/grep` || exit 1

 

ID=`find_prog /usr/bin/id` || exit 1

 

LS=`find_prog /bin/ls` || exit 1

 

DF=`find_prog /bin/df` || exit 1

 

RM=`find_prog /bin/rm` || exit 1

# I suppose this will confuse the three SELinux users out there:

 

#

 

if [ `$ID -u` -ne 0 ]; then

 

echo "Only the super-user can use this (try \"sudo $0\" instead), aborting." >&2

 

exit 1

 

fi

# We need a very modern hdparm, for its --fallocate and --trim-sector-ranges-stdin flags:

 

# Version 9.25 added automatic determination of safe max-size of TRIM commands.

 

#

 

HDPVER=`$HDPARM -V | $GAWK '{gsub("[^0-9.]","",$2); if ($2 > 0) print ($2 * 100); else print 0; exit(0)}'`

 

if [ $HDPVER -lt 925 ]; then

 

echo "$HDPARM: version >= 9.25 is required, aborting." >&2

 

exit 1

 

fi

# Convert relative path "$1" into an absolute pathname, resolving all symlinks:

 

#

 

function get_realpath(){

 

iter=0

 

p="$1"

 

while [ -e "$p" -a $iter -lt 100 ]; do

 

# Strip trailing slashes:

 

while [ "$p" != "/" -a "$p" != "${p%%/}" ]; do

 

p="${p%%/}"

 

done

 

# Split into directory:leaf portions:

 

d="${p%/*}"

 

t="${p# */}"

 

# If the split worked, then cd into the directory portion:

 

if [ "$d" != "" -a "$d" != "$p" ]; then

 

cd -P "$d" || exit

 

p="$t"

 

fi

 

# If what we have left is a directory, then cd to it and print realpath:

 

if [ -d "$p" ]; then

 

cd -P "$p" || exit

 

pwd -P

 

exit

 

# Otherwise if it is a symlink, read the link and loop again:

 

...
Reply