Difference between revision 1 and current revision
No diff available.Specifically, I partitioned a 120 GB Intel X25-M SSD for Ubuntu. Most of these instructions are appropriate for other GNU/Linux distros such as Debian, too.
NOTE: THESE INSTRUCTIONS USE THE "GPT" PARTITION TABLE TYPE, WHICH I BELIEVE MAY INTERFERE WITH WINDOWS (i don't have a windows partition on my drive)
This partitioning left a bunch of free space for reasons specific to Intel SSDs. See "Notes on why i did the partitioning the way i did", below.
Boot using a Ubuntu LiveCD? (or USB stick).
Choose to not install, just try out.
open applications->accessories->terminal
type
sudo gparted
in gparted,
Device->Create new partition table select "advanced" pulldown select new partition table type: "gpt"
Partition->new
Free space preceding (MiB): 1 (the default) New size (MiB): 92160 (this is 1024*90) Free space following (MiB): leave unchanged (this will autoupdate) Align to: MiB (the default) Create as: Primary Partition (the default) File system: ext4 Label: boot2011
click on the Add button
click on "unallocated"
Partition->new
new size: 8192 File system: linux-swap
click on the Add button
Now the table should look like this:
New partition #1: ext4 boot2011 90.00 GiB New partition #2: linux-swap boot2011 8.00 GiB unallocated: unallocated 13.79 GiB
If you want, you can doubleclick the partitions to get more info. New partition #1 tells you that the first sector will be 2048, and the last one will be 188745727. This is good, because the first sector is divisible by 2048. Similarly, New partition #2 tells you that the first sector is 188745728, and the last is 205522943. Again, 188745728 is divisible by 2048, so this is good.
Now click the green checkmark. It works for a minute. Now type "exit" in the terminal to exit.
ACHI must be on (this was the default when my computer arrived) (IDE or compatibility mode doesn't work with TRIM).
I left 14GB free (not assigned to any partition) because this apparently makes the drive faster and extends its lifetime (people cite [1] but I haven't watched that); apparently, at least on the Intel SSDs, this has the same effect as manufactorer underprovisioning. Note that this apparently only works if that space has never been assigned to a partition -- if it has, you need to Secure ATA Erase the entire drive in order for this to work. [2] [3]
For good performance and lifetime on an SSD, apparently the partitions should be "aligned", meaning that each partition should start at byte numbers divisible by 1 megabyte. Sectors are 512 bytes. So, the root partition should start at sector 2048. [4] [5]
In order to be able to hibernate, the size of the swap partition should be at least as large as RAM. [6]
I used ext4. I think ext3 doesn't work with TRIM.
Note that data on SSDs apparently fades after about 10 years [7].
These are for after you install GNU/Linux.
I added the following flags to my SSD: noatime, discard. noatime prevents the OS from recording the last access time for files and directories. discard turns on TRIM support, which means the OS tells the SSD which blocks are free so that it can garbage-collect them.
i think the point of TRIM is to tell the SSD which blocks are free. I think with "discard", the OS tells the SSD when it deletes a file that now the blocks are free. But doesn't think mean that the blocks that were used by temporary/deleted files during the installation of Ubuntu before you added "discard" to the fstab (and the next time you rebooted after that, which causes "discard" to take effect -- i think "sudo mount -o remount /" would also do the trick -- btw you can see which mount options are enabled on which drives by typing "mount", it should show "discard" as an option on the drive mounted on /) have never been reported to the SSD? I'm not sure, but just to be "safe", i ran wiper.sh, which reports all of the currently free blocks to the SSD using TRIM.
wiper.sh can be downloaded from the hdparm sourceforge site ( http://sourceforge.net/projects/hdparm/files/ ).
However, on my install, it didn't work, with "FAILED: Input/output error" when i run it with --commit. The problem turned out to be an insufficiently recent hdparm. Mb this will be fixed in Ubuntu by the time you read this, but if not, the fix is just to download a new hdparm from the same site, compile it by entering its folder and doing "make", copy wiper.sh into that folder, and edit wiper.sh and change it to use the hdparm in the current folder.
wiper.sh apparently might work a little better if it is run on a volume which isn't mounted rw, so i booted using the same USB key i used to install ubuntu, did "try out Ubuntu", pulled up a terminal, and did roughly the following:
select my hard drive from Places menu, so that it mounts
go into the folder with the new hdparm and the wiper.sh
cp -r . ~/
cd /home/ubuntu/hdparm-9.37/
sudo umount /dev/sda1
edit the file wiper.sh, and change it to HDPARM=/home/ubuntu/hdparm-9.xx/hdparm instead of HDPARM=`find_prog ....etc...., where xx is replaced by the appropriate numbers from the name of the hdparm folder that you got
sudo apt-get install gawk
sudo ./wiper.sh --commit /dev/sda1 # where /dev/sda1 is replaced by the device where your SSD drive is
I added the line "vm.swapiness=0", which tells the system not to use the swap unless it is actually out of memory. The swap is only there for hibernation, or in case its really needed. [8]
In Firefox, i went to about:config
, and then set browser.cache.disk.parent_directory = /tmp
, and set browser.cache.disk.enable
to false.
In /etc/rc.local, i added:
echo deadline > /sys/block/sda/queue/scheduler exit 0
here is an explanation of the deadline scheduler.
i also mounted /tmp as tmpfs by adding the following to /etc/fstab:
tmpfs /tmp tmpfs defaults,noatime,mode=1777,size=12G 0 0
(thanks to [9], [10], [11], [12], [13], [14])
Note that i didn't set stripe_width. i dunno if that's a missed opportunity for better alignment -- i'm not using RAID.