-   Linux - Hardware (
-   -   interesting article on configuring SSD (

danimalz 10-02-2012 11:52 PM

interesting article on configuring SSD
Im building a mini-itx system for full-time general-use desktop system, because:

1. low power use
2. small footprint
3. i rarely use cd's/dvd's
4. silent!! (fan-less)
5. something new (for me) .. !
6. cheap (like me)

I purchased a 32G SSD to run the system on; after researching online, i learned of limitations to the number of writes over time on drives of this type.

I found an interesting article, and i'd like comments as to whether folks here have opinions as to the veracity of its claims. Also comments in general 'cause im curious that way.

thx in advance LQers!

article below:

Ztcoracat 10-03-2012 01:10 AM

I think it's a good article.

You mentioned that your learned of limitations to the number of writes over time on drives of this type of ssd.
If there is a chance that the limitations include the type of architecture your computer is you may want to do more research.

Benchmarking seems to be a very important role from what I gathered.

This page talks about tests on certain architecture and a comparison of different architectures-

If this is what you would really like to consider doing it go for it-
But I would do (If it were my system)more research. I don't like running into surprises when working hard on a project. These instructions are most certainly going to be work for you.

If you happen to read the article again ask yourself one question.
Is there anything about this procedure that I'm going to perform have any conflicting practices?

If so you may run into unwanted distress.

Newegg has more if your intrested. I didn't know that some of the ssd's were so expensive!

Good luck

TobiSGD 10-03-2012 03:04 AM

Nice article, just a few corrections:
- With normal desktop usage the wear-out caused by writes is a non-issue on modern SSDs.
- ext2/3/4 are not partition types, but filesystems.
- If I would consider wear-out as a problem I would still use ext4 because of its superior performance compared to ext2 and because it supports the TRIM function. You can use ext4 without the journal.
- The article omits any information about partition alignment. The partitions on a SSD should be aligned to the SSD's flash erase block size, otherwise you can get serious impacts on write performance. Since the usual erase block sizes are 128, 256 or 512KB it is the safest bet to align partitions to 2048 logical sectors (1 logical sector = 512 Byte). If you partition the disk with GParted this will usually be done automatically.

JaseP 10-03-2012 01:53 PM

One thing the article doesn't go into is swappiness, the propensity of the system to move things to swap, rather than keeping them in active memory. If you are attempting to limit writes, reducing swappiness can help. Most modern desktop machines are going to have at least 1GB RAM, but likely 2GB to 4GB or more. Most likely, you won't be swapping much under those conditions. However, that is very dependent on what you do with the system. And, as TobiSGD indicated, modern SSDs aren't as susceptible to write wear-out. But why take the chance, right?

For SSDs, you might not want to specify a swap partition at all (just don't make one on install, or reclaim the space later). Specifying a swap partition kind of just gives your SSD a defined place to wear out first (although wear leveling may mitigate this)... You can go with swap files, if you think you'll need swap to keep apps behaving themselves.

But to reduce swappiness, first determine where it is;
cat /proc/sys/vm/swappiness

It'll return a value of 60, most likely. That's fine for a server, but probably lousy for a desktop.

Permanent changes are made by editing the /etc/sysctl.conf file. Use what even text editor you prefer (gedit, kate, nano, etc.) with root authority, and either edit, or add the line;

(or 10, or 1,... personal choice,... but I've gone to 1 with no ill effects)

Temporary changes can be made with;
sudo sysctl vm.swappiness=5

(again, use whatever number you want to try)

As much as doing this will reduce writes, it will also reduce the drain on resources from IO operations while it's moving the data in and out of swap. You might notice the system appearing "snappier,"... or not.

TobiSGD 10-03-2012 02:02 PM

I disagree. If you have a workload on your system that indicates that you will use the swap partition (besides that few MB stale memory that you see from time to time swapped out) I would strongly recommend to put your swap on the SSD. This will give you much better performance than putting it on a conventional drive.

JaseP 10-03-2012 02:37 PM

Well, swappiness is one of those controversial, heavily opinion laden things...

Some say "no swap," others counter 100% swappiness,... It really is one of those "Your mileage may vary," kind of things... and depends heavily on how the system is to be used... As far as SSDs are concerned, I take the better safe than sorry approach... Even in the face of empirical evidence stating that their reliability and end-of-life specs are on par with HDs,... I remain skeptical.

onebuck 10-03-2012 08:59 PM

Member Response

I agree with TobiSGD. Point is if you do need swap at some point in time and no swap then the system will respond differently. :(
This is how I set my SSD;

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001e3e2

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1            2048    41945087    20971520  83  Linux
/dev/sda2        41945088    46139391    2097152  82  Linux swap
/dev/sda3        46139392    88082431    20971520  83  Linux
/dev/sda4        88082432  234440703    73179136    5  Extended
/dev/sda5        88084480    94375935    3145728  83  Linux
/dev/sda6        94377984  115349503    10485760  83  Linux
/dev/sda7      115351552  136323071    10485760  83  Linux
/dev/sda8      136325120  138422271    1048576  83  Linux
/dev/sda9      138424320  146812927    4194304  83  Linux

When you create the filesystem for each partition then the option to discard can be setup by;

tune2fs -o discard /dev/some_device_partition #to disable journal
Or setup in /etc/fstab.

Then at boot;


#09-25-12 gws 20:07
#08-20-12 gws 14:38
#set minimum swappiness
echo 1 > /proc/sys/vm/swappiness

#08-20-12 gws
#sets scheduler for SSD to 'noop'
#SSD=(device ID's of all 'SSD': see note below)
#Note Information revised from ArchWiki;

#This provides the links listed with targets information to place in bash array
#'SSD= ( ) parentheses in below 'SSD= ( );

#ls -l /dev/disk/by-id
#lrwxrwxrwx 1 root root  9 Aug 19 11:27 ata-OCZ-AGILITY3_OCZ-C93VFN4X0532CVMP -> ../../sda


declare -i i=0
while [ "${SSD[$i]}" != "" ]; do
  NODE=`ls -l /dev/disk/by-id/${SSD[$i]} | awk '{ print $NF }' | sed -e 's/[/\.]//g'`
  echo noop > /sys/block/$NODE/queue/scheduler

#08-20-12 gws 14:45
#get some additional gain by setting up a write-back cache
hdparm -W1 /dev/sda  #where x= a,b,c,d...

#09-20-12:16:14 gws bumblebee
#for nvidia optimus
if [ -x /etc/rc.d/rc.bumblebeed ]; then
    /etc/rc.d/rc.bumblebeed start

On Slackware swappiness is default set to '60'.
On my Dell XPS I am using OCZ 'SSD' with a mechanical in the other bay.

Most users fail to setup the environment properly. I do use 'ext4' no journal, discard and noatime for the 'SSD' partitions';

cat fstab
/dev/sda2        swap            swap        defaults        0  0
/dev/sda5        /                ext4        defaults,noatime,discard        1  1
/dev/sda6        /home            ext4        defaults,noatime,discard        1  2
/dev/sda7        /usr            ext4        defaults,noatime,discard        1  2
/dev/sda8        /var            ext4        defaults,noatime,discard        1  2
/dev/sda9        /tmp            ext4        defaults,noatime,discard        1  2
/dev/sdb2        /mnt/win7        ntfs-3g    fmask=111,dmask=000 1  0
#/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
tmpfs            /dev/shm        tmpfs      defaults        0  0

No problems!

jefro 10-04-2012 03:41 PM

In a real sense, I'd think that before this disk actually wears out, you'd buy a new one. It pretty much means you can run it as you wish or want to.

My more pressing concern is that some motherboards and OS's are pretty fickle on ssd's. A lot of issues reported on all brands of lockups and what not. Read the posts on the selections before you buy it.

" full-time general-use desktop system, "

I'd be more inclined to buy ram to substitute for swap file or partition. I would be even inclined to put a small CF disk or usb in for swap before going to an SSD swap. Or a complex swap scheme that has priority on one or more.

All times are GMT -5. The time now is 10:21 PM.