Difference between revisions of "SSD"

From ArchWiki
Jump to: navigation, search
m (Step 1: Aligning the drives partitions)
m (fix double redirect)
(21 intermediate revisions by one other user not shown)
Line 1: Line 1:
=Accumulated info on how to use your SSD drive under linux=
#REDIRECT [[Solid State Drives]]
''under construction, not complete, not nice''
So you got yourself one of those precious, blazing fast SSDs and you want to get the most out of it? There are a number of things to worry about, such as alignment, choice of file system, journaling and TRIM.
==Before buying==
Make sure the SSD you buy has a firmware with TRIM support. This is a vital feature that both prolongs your SSDs lifetime and reduces the loss of performance over time to almost nil. I recommend all of what Anand has ever written about SSDs in general before considering to buy one:
SSD Anthology (history lesson, a bit dated): http://www.anandtech.com/show/2738
SSD Relapse (refresher and more up to date: http://www.anandtech.com/show/2829
He also reviewes most of the SSDs so you'll find up-to-date benchmarks on all of them. Brilliant stuff.
==Setting up a fresh drive with archlinux==
This guide assumes that you want to install archlinux from scratch on your brand new SSD. For different applications (like using them in a RAID, a server or whatever) many things might be different
===Step 1: Aligning the drives partitions===
Launch the latest archlinux install medium, then go on launching fdisk with fixed head and sector number options. The head and sector options are a safe bet for many drives. Read the links below to find out more about what they do, as some SSDs might require a different setting for maximum performance.
# fdisk -H 32 -S 32 /dev/sda
Now create your partitions.
{{Warning|When creating the first partition, select cylinder number 2 as the first cylinder, not 1. This ensures that your first partition doesn't get shifted.}}
You might not want to create a swap partition if you don't really need it.
==== Background info ====
aligning the SSD to block boundaries:
aligning the SSD to block boundaries when using LVM:
===Step 2: Choosing a file system===
There's lots of talk about what to use. Some say ext2 should be used because it doesn't have journaling, some say ext4 without journaling is best, and some use btrfs. Since TRIM support, journaling can be enabled without much of a drawback as stated by the guy in the link below. If you disable journaling, you end up with a slightly faster system, but in case of a power failure your data might end up garbled. I decided to go with a regular journaled ext4 because it's a laptop and a low battery could garble me some data. If you plan on using a RAID, there's even more to consider, such as stripe-widths and so on.
$ mkfs.ext4 /dev/sda1
Next, consider setting the noatime mount option for your SSD partitions in [[fstab|/etc/fstab]] (see the reasons in the link below):
UUID=b0848f0d-5d37-41df-a2c7-5a43f023f420 /home ext3 defaults,noatime 0 2
====Background info====
*btrfs on an SSD on arch: [http://www.madeo.co.uk/?p=346 Intel X25-M Gen2 on linux – migrating to btrfs on kernel 2.6.33]
*Thoughts on why journaling isn't much of a deal: [http://thunk.org/tytso/blog/2009/03/01/ssds-journaling-and-noatimerelatime/ SSD’s, Journaling, and noatime/relatime ]
===Step 3: Install Arch===
I don't do anything out of the ordinary. LVM or RAID users might need to insert some info here. However, if you use ext4, add the "noatime" option to disable timestamps and the "discard" option to enable TRIM.
If you decided to use a swap partition or file, it's recommended to reduce the "swapiness" of the system to avoid writes to swap. Add this to rc.local:
$ echo 1 > /proc/sys/vm/swapiness
====Background info====
ext4 without journaling and some fstab options:

Revision as of 20:48, 1 July 2010

Redirect to: