- 1 Accumulated info on how to use your SSD drive under linux
Accumulated info on how to use your SSD drive under linux
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.
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.
You might not want to create a swap partition if you don't really need it.
aligning the SSD to block boundaries: http://www.ocztechnologyforum.com/forum/showthread.php?54379-Linux-Tips-tweaks-and-alignment&p=373226&viewfull=1#post373226 aligning the SSD to block boundaries when using LVM: http://es.linuxfoundation.org/news-media/blogs/browse/2009/02/aligning-filesystems-ssd%E2%80%99s-erase-block-size
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 which mount flags to use in the entries for your partitions in /etc/fstab (see the reasons in the link below):
/dev/sda1 / ext4 defaults,noatime,discard 0 1
- btrfs on an SSD on arch: Intel X25-M Gen2 on linux – migrating to btrfs on kernel 2.6.33
- Thoughts on why journaling isn't much of a deal: 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. 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
ext4 without journaling and some fstab options: http://cptl.org/wp/index.php/2010/03/30/tuning-solid-state-drives-in-linux/