Take a look at our
ThinkPads.com HOME PAGE
For those who might want to contribute to the blog, start here: Editors Alley Topic
Then contact Bill with a Private Message

SSD, Encryption, Trim, and Wear Leveling

Performance, hardware, software, general buying and gaming discussion..
Post Reply
Message
Author
cb474
Sophomore Member
Posts: 133
Joined: Thu Jan 04, 2007 10:04 pm
Location: Washington, DC

SSD, Encryption, Trim, and Wear Leveling

#1 Post by cb474 » Thu Apr 12, 2012 3:32 am

I have a used X301 on which I want to create an encypted (Linux) system. Normally one writes random data to the entire drive first, so that there's no way to tell what's data and what's empty space on the drive.

However, it's my understanding that the Trim functionality of SSDs writes zeros to the empty space, when files are deleted. So I'm wondering if it would be better to just zero out the drive to begin with. This undermines some of the security of an encrypted drive, but I'm not concered with plausible deniablity, etc.

My main concern is if zeroing out the drive will allow it to perform better, because the SSD works better if it can see where there's empty space, both for the Trim function and for wear leveling. If the drive is completely filled with random data, I'm assuming the SSD controller would view it as full and this would degrade performance and wear leveling. Elsewhere I've seen people say that you should leave some unpartitioned space on the drive that can be used by the SSD for wear leveling. Does anyone know if either of these ideas (zeroing out, unpartitioned space) are good ideas?

(I should note, also, that I have one of the older 128 Gb Samsung SSDs, MMCQE28G8MUP, so I'm not actually sure it supports Trim, but I think it does do wear leveling.)

ThinkRob
Senior ThinkPadder
Senior ThinkPadder
Posts: 2394
Joined: Wed May 20, 2009 9:54 am
Location: near RTP, NC

Re: SSD, Encryption, Trim, and Wear Leveling

#2 Post by ThinkRob » Sat Apr 28, 2012 12:51 pm

cb474 wrote: However, it's my understanding that the Trim functionality of SSDs writes zeros to the empty space, when files are deleted. So I'm wondering if it would be better to just zero out the drive to begin with. This undermines some of the security of an encrypted drive, but I'm not concered with plausible deniablity, etc.
TRIM doesn't quite work that way. It doesn't just zero pages.

Slack space, if recognized by the drive as such, will often be used as spare area to improve performance. But the mechanics of how and why said space will be used depends on the drive. I don't know enough about the SSDs in the X301 to say whether or not simply leaving a bit of free space when partitioning is good enough.

Personally I wouldn't worry about it. I'd fill the drive with random data to start, set up your LUKS partitions, and think no more of it. Sure, you could have a bit of a long-term performance drop off since LUKS doesn't pass through TRIM (or, depending on the drive, you could not notice any difference.) I did that when I had an X300 and it worked fine. YMMV obviously.
Need help with Linux or FreeBSD? PM or catch me on IRC: I'm ThinkRob on FreeNode and EFnet.
Laptop: X270, running Fedora
Desktop: Intellistation 285 (currently dead)
Workstation: owned by my employer ;)
Toy: Miata!

crashnburn
ThinkPadder
ThinkPadder
Posts: 1724
Joined: Sat Apr 22, 2006 4:26 pm
Location: TX, USA & Bombay, India

Re: SSD, Encryption, Trim, and Wear Leveling

#3 Post by crashnburn » Sun Apr 29, 2012 12:56 pm

cb474 wrote:I have a used X301 on which I want to create an encypted (Linux) system. Normally one writes random data to the entire drive first, so that there's no way to tell what's data and what's empty space on the drive.

However, it's my understanding that the Trim functionality of SSDs writes zeros to the empty space, when files are deleted. So I'm wondering if it would be better to just zero out the drive to begin with. This undermines some of the security of an encrypted drive, but I'm not concered with plausible deniablity, etc.

My main concern is if zeroing out the drive will allow it to perform better, because the SSD works better if it can see where there's empty space, both for the Trim function and for wear leveling. If the drive is completely filled with random data, I'm assuming the SSD controller would view it as full and this would degrade performance and wear leveling. Elsewhere I've seen people say that you should leave some unpartitioned space on the drive that can be used by the SSD for wear leveling. Does anyone know if either of these ideas (zeroing out, unpartitioned space) are good ideas?

(I should note, also, that I have one of the older 128 Gb Samsung SSDs, MMCQE28G8MUP, so I'm not actually sure it supports Trim, but I think it does do wear leveling.)
Interesting work. Reminds me of some stuff I worked on in Grad school.
T61 8892-02U: 14.1"SXGA+/2.2C2D/4G/XP|Adv Mini Dock|30" Gateway XHD3000 WQXGA via Dual-link DVI
X61T 7767-96U: 12.1"SXGA+/1.6C2D/3G/Vista|Ultrabase
W510 4319-2PU: 15.6"FHD/i7-720QM/4G/Win7Pro64 (for dad)
T43 1875-DLU: 14.1"XGA/1.7PM-740/1G/XP (Old)

Kaze22
Sophomore Member
Posts: 159
Joined: Sat Mar 24, 2012 1:38 pm
Location: Vancouver, Canada

Re: SSD, Encryption, Trim, and Wear Leveling

#4 Post by Kaze22 » Sun Apr 29, 2012 1:10 pm

Your drive doesn't support TRIM, you can check with crystaldiskinfo.
First generation ssds like the X301 Samsung were never designed with TRIM.
I had to spend like 400 bucks to upgrade to a 256 Kingston v180 to get trim for my X301.
You need to use secure delete via BIOS or run Tony Trim on your drive manually.
Both a pain.

These drives will slow down to a crawl if you flush them out via random data writes.
They can slow down to less then 20mb/s write speeds. A security flush like what you are talking about will in effect dirty the entire drive, and leave your SSD slower than an old PATA HDD.

Leaving space on a drive for wear leveling is only good for modern SSDs that have hardware garbage collection such as the new Samsungs or the Indelink Everest Series.
The unused space gives the SSD controller the ability to run background garbage collection in idle states. Again, your drive doesn't support this feature.
So pretty much, no matter what you do your drive will suffer from wear because it has no TRIM and no hardware garbage collection.

It is what it is. I know from first hand experience, I had the same drive. The worst it ever got, I was doing 15mb/s writes and 50mb/s read. It was essentially worse than a 5400rpm.
Thinkpad W520 | Intel i7 2.5 XM | 1920x1080 FHD 95% Gamut | 32 GB DDR3 | 128GB MyDigitalSSD mSATA SSD | 2GB NVIDIA QUADRO 2000M | UEFI WIN 7

ThinkRob
Senior ThinkPadder
Senior ThinkPadder
Posts: 2394
Joined: Wed May 20, 2009 9:54 am
Location: near RTP, NC

Re: SSD, Encryption, Trim, and Wear Leveling

#5 Post by ThinkRob » Mon Apr 30, 2012 5:14 pm

Kaze22 wrote: It is what it is. I know from first hand experience, I had the same drive. The worst it ever got, I was doing 15mb/s writes and 50mb/s read. It was essentially worse than a 5400rpm.
15MB/s random writes would still be an order of magnitude faster than a conventional disk. Same for the seek time(s).

Not saying that you don't need to consider the performance implications of an old SSD, but even in the worst case the SSD will still outperform spinning rust.
Need help with Linux or FreeBSD? PM or catch me on IRC: I'm ThinkRob on FreeNode and EFnet.
Laptop: X270, running Fedora
Desktop: Intellistation 285 (currently dead)
Workstation: owned by my employer ;)
Toy: Miata!

Kaze22
Sophomore Member
Posts: 159
Joined: Sat Mar 24, 2012 1:38 pm
Location: Vancouver, Canada

Re: SSD, Encryption, Trim, and Wear Leveling

#6 Post by Kaze22 » Mon Apr 30, 2012 8:59 pm

A 7200rpm drive can do 80mb read and write assuming it's a latest model with decent cache. You'd be surprised how fast some of these new HDD are. I was writing some heavy data to my W520s 500GB HDD (7200rpm) from my msata SSD. I was seeing sustained speeds of 90-100mb/s. Not too shabby for spinning rust.
Of course the milisecond seek is what makes the difference.
All in all, these older SSDs are a real hassle to maintain.
Ever try installing large updates at 15mb write/s. Not fun.
Thinkpad W520 | Intel i7 2.5 XM | 1920x1080 FHD 95% Gamut | 32 GB DDR3 | 128GB MyDigitalSSD mSATA SSD | 2GB NVIDIA QUADRO 2000M | UEFI WIN 7

ThinkRob
Senior ThinkPadder
Senior ThinkPadder
Posts: 2394
Joined: Wed May 20, 2009 9:54 am
Location: near RTP, NC

Re: SSD, Encryption, Trim, and Wear Leveling

#7 Post by ThinkRob » Mon Apr 30, 2012 9:35 pm

Kaze22 wrote:A 7200rpm drive can do 80mb read and write assuming it's a latest model with decent cache. You'd be surprised how fast some of these new HDD are. I was writing some heavy data to my W520s 500GB HDD (7200rpm) from my msata SSD. I was seeing sustained speeds of 90-100mb/s. Not too shabby for spinning rust.
Those are sequential speeds. Random 4K performance for *any* spinning disk is nowhere near 10 MB/s, let alone 80.
Need help with Linux or FreeBSD? PM or catch me on IRC: I'm ThinkRob on FreeNode and EFnet.
Laptop: X270, running Fedora
Desktop: Intellistation 285 (currently dead)
Workstation: owned by my employer ;)
Toy: Miata!

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Thinkpad - General HARDWARE/SOFTWARE questions”

Who is online

Users browsing this forum: No registered users and 55 guests