Ubuntu 11.10 on a SSD

Discussion in 'all things UNIX' started by Martijn2, Oct 16, 2011.

Thread Status:
Not open for further replies.
  1. Martijn2

    Martijn2 Registered Member

    Joined:
    Jul 24, 2006
    Posts:
    321
    Location:
    The Netherlands
    I installed Ubuntu 11.10 on a old laptop replacing the Windows Vista copy on it. Having played with it for a few days I'm ready to install it on my laptop. My question is, on Windows 7 you have the Intel SSD toolbox to optimize your system. Is this also necessary for Ubuntu? I know that Ubuntu supports TRIM since 10.04 or so, but can you optimize it more?
     
  2. tlu

    tlu Guest

    Yes, Ubuntu supports TRIM (I guess you're using ext4). You have to add the discrad,noatime options to /etc/fstab. An entry might then look like this:

    Code:
    [FONT=Verdana]UUID=YOUR_DISK    /    ext4     [B]discard,noatime,[/B]errors=remount-ro     0       1[/FONT]
    However, the current discard implementation seems to be sub-optimal - see, e.g., the discussion here. It seems that batched discard is the better way to go ATM. Use fstrim for that. You could either execute it manually or, alternatively, create the following file if you have a root and a separate home partition on your SSD:

    Code:
    #!/bin/sh
    
    fstrim /
    fstrim /home
    and save it in /etc/cron.weekly.

    BTW, you can check if your SSD supports TRIM (it definitely should) by executing

    sudo hdparm -I /dev/sda | grep -i TRIM

    You should get a message like:
    Data Set Management TRIM supported

    Another idea is to create a dynamic RAM disk which consumes half of your RAM at most by default and use it for your browser cache thus avoiding many write accesses. You could add the following line to /etc/fstab:

    Code:
    tmpfs    /tmp    tmpfs    nosuid    0    0
    and execute sudo mount -a. If you want to explicitly control its size you can change the options to, e.g.,
    ... nosuid,size=1G ... (i.e. max. 1 GB) or
    ... nosuid,size=20% ... (i.e. max. 20% of your RAM)
    instead.

    In Firefox you should then (via about:config) create a new entry (-> string) called browser.cache.disk.parent_directory and assign the value /tmp. (Alternative: Create a user.js file in your FF profile folder and add the line

    user_pref("browser.cache.disk.parent_directory", "/tmp");

    This makes life easier if you create a new profile later - just copy user.js to the new profile.)

    EDIT: I forgot to mention that it's also wise, IMHO, to create the swap partition or swap file on your normal harddisk (I guess you have one).
     
    Last edited by a moderator: Oct 16, 2011
  3. Martijn2

    Martijn2 Registered Member

    Joined:
    Jul 24, 2006
    Posts:
    321
    Location:
    The Netherlands
    Thanks for the lengthy respons, the ramdisk sounds very useful, will definitely try that. I already read that Ext3 is sometimes better because it has no journaling. I will still install Ubuntu with ext4, I doubt that the file journal will have a large impact.
     
  4. tlu

    tlu Guest

    According to Ted Ts'o, who is the main developer of ext, journalling doesn't cause any damage for SSDs. Only older models which don't use Wear Levelling yet are affected.
     
  5. Martijn2

    Martijn2 Registered Member

    Joined:
    Jul 24, 2006
    Posts:
    321
    Location:
    The Netherlands
    Aah ok, I will install it with ext4 then. Thanks again for your tips!
     
Loading...
Thread Status:
Not open for further replies.