Tuning an SSD in Linux - Page 4 - Overclock.net - An Overclocking Community

Forum Jump: 

Tuning an SSD in Linux

Reply
 
Thread Tools
post #31 of 38 (permalink) Old 12-11-2013, 10:02 AM
New to Overclock.net
 
thestraw0039's Avatar
 
Join Date: Jun 2012
Posts: 302
Rep: 25 (Unique: 20)
Quote:
Originally Posted by Rookie1337 View Post

Considering the age and somewhat dated material in the OP...anyone else feel we should update this guide?

Yea, there was a lot of good discussion in the echo thread, but I don't think there was an agreement on how to optimize. I'm willing to help but my knowledge is minimal at best.
thestraw0039 is offline  
Sponsored Links
Advertisement
 
post #32 of 38 (permalink) Old 12-11-2013, 11:29 AM
Linux Lobbyist
 
Rookie1337's Avatar
 
Join Date: Nov 2008
Location: /dev/random
Posts: 8,555
Rep: 389 (Unique: 296)
Quote:
Originally Posted by thestraw0039 View Post

Yea, there was a lot of good discussion in the echo thread, but I don't think there was an agreement on how to optimize. I'm willing to help but my knowledge is minimal at best.

Alright. Well, I'll put in a little bit of what I've got right now for review and then people can check it and add things as needed.
My rough draft of a guide (Click to show)
To improve performance:
Limiting Writes on the drive by moving non-essential directories to RAM
Edit /etc/fstab with your CLI text editor, IE nano or similar (requires sudo invocation IIRC)
Go to the end and add this
Quote:
# Move /tmp to RAM
tmpfs /tmp tmpfs defaults,noatime,nosuid 0 0
# Move cache to RAM
tmpfs /home/USERNAME/.cache tmpfs defaults,noatime,nosuid 0 0
Make sure you understand that /home/USERNAME means the home directory of YOUR user thus if you created a user named Bob it would be /home/Bob/.cache

This only works for directories that are temporary in nature so it will not work for libs, bin, or share and would make an unbootable system if you tried to move them to tmpfs.

This section deals with a setup that has no swap and is recommended mainly for systems with 4GB+ of RAM
Next; edit /etc/sysctl.conf as sudo and add vm.swappiness=0 and vm.vfs_cache_pressure=90 to the end of it. The higher value for pressure the more it will favor program data in caches and the lower the more it will favor files; thus 50 will split preference between the two. The default should be about 60.

If you want swap without it being on the SSD (also useful for HDDs if you have the RAM) then there is Zram which trades some CPU usage for creating a swap in RAM setup. DO NOT USE if you have another location for swap setup, IE you let the Ubuntu/Mint installer set up your drives.
Next; install zram-config (this is the Ubuntu name; I don't know the name for other distros) as it should help on reboot using your ram for a compressed swap device as some things are just picky about swap. Remember to adjust the vm.swappiness amount from the previous section to something higher than 0 if you install/enable zram. Generally, vm.swappiness=20 should be the max but it depends on your choice.

For SSDs only:
First, most distros should automatically setup to use either the deadline or noop scheduler when installing on an SSD. So you should check first.
Quote:
cat /sys/block/sda/queue/scheduler
Whatever is in brackets will be the one in use so example
Quote:
noop [deadline] cfq
If it isn't deadline or noop then you should do the following:
To change data access scheduler for drives install “sysfsutils”. (Need name of package for non-buntu distros)
Next, assuming the SSD is on “sda”
If you have several disks or a mix of SSD and mechanical disks, install the sysfsutils package and add the following line at the end of /etc/sysfs.conf:
Quote:
block/sda/queue/scheduler = noop
*or for deadline [ block/sda/queue/sheduler=deadline ]*
To check what scheduler is in use:
“cat /sys/block/sda/queue/scheduler”
whatever is in brackets will be the one in use so example noop [deadline] cfq

Don’t forget to add noatime to /etc/fstab for each SSD you have a Linux install/filesystem on

The TRIM issue: About discard vs fstrim
Currently it is recommended to avoid using the discard option through /etc/fstab and instead use the fstrim command from terminal/CLI
Here is an example of fstrim:
Quote:
sudo fstrim / -v
This however is only if you have one partition on the ssd and everything is inside /
The command will take a while and it will not report anything until it has completed so be patient. (Time ranges depend on the size of the partition being trimmed).

Tell me what you guys think. I might add more but right now I need to update my comps from Kubuntu 13.04 to 13.10
Rookie1337 is offline  
post #33 of 38 (permalink) Old 12-11-2013, 11:33 AM
New to Overclock.net
 
Shrak's Avatar
 
Join Date: Dec 2011
Location: Nixers / Reddit
Posts: 10,323
Rep: 605 (Unique: 370)
Quote:
Originally Posted by Rookie1337 View Post

Alright. Well, I'll put in a little bit of what I've got right now for review and then people can check it and add things as needed.
My rough draft of a guide (Click to show)
To improve performance:
Limiting Writes on the drive by moving non-essential directories to RAM
Edit /etc/fstab with your CLI text editor, IE nano or similar (requires sudo invocation IIRC)
Go to the end and add this
Make sure you understand that /home/USERNAME means the home directory of YOUR user thus if you created a user named Bob it would be /home/Bob/.cache

This only works for directories that are temporary in nature so it will not work for libs, bin, or share and would make an unbootable system if you tried to move them to tmpfs.

This section deals with a setup that has no swap and is recommended mainly for systems with 4GB+ of RAM
Next; edit /etc/sysctl.conf as sudo and add vm.swappiness=0 and vm.vfs_cache_pressure=90 to the end of it. The higher value for pressure the more it will favor program data in caches and the lower the more it will favor files; thus 50 will split preference between the two. The default should be about 60.

If you want swap without it being on the SSD (also useful for HDDs if you have the RAM) then there is Zram which trades some CPU usage for creating a swap in RAM setup. DO NOT USE if you have another location for swap setup, IE you let the Ubuntu/Mint installer set up your drives.
Next; install zram-config (this is the Ubuntu name; I don't know the name for other distros) as it should help on reboot using your ram for a compressed swap device as some things are just picky about swap. Remember to adjust the vm.swappiness amount from the previous section to something higher than 0 if you install/enable zram. Generally, vm.swappiness=20 should be the max but it depends on your choice.

For SSDs only:
First, most distros should automatically setup to use either the deadline or noop scheduler when installing on an SSD. So you should check first.
Whatever is in brackets will be the one in use so example
If it isn't deadline or noop then you should do the following:
To change data access scheduler for drives install “sysfsutils”. (Need name of package for non-buntu distros)
Next, assuming the SSD is on “sda”
If you have several disks or a mix of SSD and mechanical disks, install the sysfsutils package and add the following line at the end of /etc/sysfs.conf:
*or for deadline [ block/sda/queue/sheduler=deadline ]*
To check what scheduler is in use:
“cat /sys/block/sda/queue/scheduler”
whatever is in brackets will be the one in use so example noop [deadline] cfq

Don’t forget to add noatime to /etc/fstab for each SSD you have a Linux install/filesystem on

The TRIM issue: About discard vs fstrim
Currently it is recommended to avoid using the discard option through /etc/fstab and instead use the fstrim command from terminal/CLI
Here is an example of fstrim:

This however is only if you have one partition on the ssd and everything is inside /
The command will take a while and it will not report anything until it has completed so be patient. (Time ranges depend on the size of the partition being trimmed).

Tell me what you guys think. I might add more but right now I need to update my comps from Kubuntu 13.04 to 13.10

Make it into an Article so everyone can add to it / correct it / update it as time goes on. That way if you ( or any use who makes a "guide" or "tutorial" ) go MIA, then it can still be updated tongue.gif

Like the situation this thread is now.. being quite old and nothing able to be done aside from starting a new one really.
Shrak is offline  
Sponsored Links
Advertisement
 
post #34 of 38 (permalink) Old 12-11-2013, 12:00 PM
Linux Lobbyist
 
Rookie1337's Avatar
 
Join Date: Nov 2008
Location: /dev/random
Posts: 8,555
Rep: 389 (Unique: 296)
Quote:
Originally Posted by Shrak View Post

Make it into an Article so everyone can add to it / correct it / update it as time goes on. That way if you ( or any use who makes a "guide" or "tutorial" ) go MIA, then it can still be updated tongue.gif

Like the situation this thread is now.. being quite old and nothing able to be done aside from starting a new one really.

I probably will...but first I want a more finalized version with more input ready before doing so. The other issue though is (I really hate to sound greedy as this is an issue in general I have with Articles that won't effect me making this into one) that people who make the articles don't get any rep (which I think matters more for guys with less than I have). The second issue doesn't matter to me as much but it's one of those principal things that bugs me. I will do an article anyway once there's enough input and someone helps me make it look pretty as right now I'm sure its not the best to follow and look at. redface.gif

I'm also looking for input on how I should deal with correcting Japan's mentioning of a filesystem and journaling; should I just say its best to use ext4 or btrfs until f2fs is ready and don't worry about the whole journaling thing?
Rookie1337 is offline  
post #35 of 38 (permalink) Old 12-11-2013, 12:47 PM
New to Overclock.net
 
thestraw0039's Avatar
 
Join Date: Jun 2012
Posts: 302
Rep: 25 (Unique: 20)
Rookie, I came across this article about the I/O Scheduler, I just don't know what kind of source would be considered legit. https://wiki.archlinux.org/index.php/Talk:Solid_State_Drives
thestraw0039 is offline  
post #36 of 38 (permalink) Old 12-11-2013, 09:25 PM
Linux Lobbyist
 
Rookie1337's Avatar
 
Join Date: Nov 2008
Location: /dev/random
Posts: 8,555
Rep: 389 (Unique: 296)
Quote:
Originally Posted by thestraw0039 View Post

Rookie, I came across this article about the I/O Scheduler, I just don't know what kind of source would be considered legit. https://wiki.archlinux.org/index.php/Talk:Solid_State_Drives

Well, after spending time reading a whole lot on the issue I'm horribly conflicted...many sources (IBM included) claim Deadline as the best I/O scheduler right now for all devices unless an individual wants to mess with CFQ's settings. On the other hand several threads in the Arch forums repeat that Noop is best on a system with NCQ and SSDs (actually they say on any system where the block device will control things whatever that means). Then, some of the Arch forums mention that Noop isn't any better but it will help reduce CPU load since it dumps all I/O work on the block device. So, anyone want to take a stab at what the order of recommendation should be? redface.gif
Rookie1337 is offline  
post #37 of 38 (permalink) Old 12-14-2013, 10:40 AM
Linux Lobbyist
 
Rookie1337's Avatar
 
Join Date: Nov 2008
Location: /dev/random
Posts: 8,555
Rep: 389 (Unique: 296)
Found another issue...apparantly we should also be doing a secure erase before every reinstall of a distro in order to keep things working well on an SSD. I'll dig deeper when I have the time but hopefully someone else will add some input on this.
Rookie1337 is offline  
post #38 of 38 (permalink) Old 12-14-2013, 12:36 PM
New to Overclock.net
 
GermanyChris's Avatar
 
Join Date: Mar 2012
Location: Southern Germany
Posts: 3,699
Rep: 82 (Unique: 60)
Quote:
Originally Posted by Rookie1337 View Post

Found another issue...apparantly we should also be doing a secure erase before every reinstall of a distro in order to keep things working well on an SSD. I'll dig deeper when I have the time but hopefully someone else will add some input on this.

This was supposed to be bad juju, though I do it on my Mac's it forces the drive to garbage collect..

The Infantry's primary role is close combat, which is characterized by extreme violence and physiological shock, close combat is callous and unforgiving FM 3-21.8
GermanyChris is offline  
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off