SSD disk and Linux

I bought new 250GB SSD disk to my notebook AsusN53SV. You can find my Linux (Ubuntu 11.10) configuration wich I use to maximize SSD disk performance and lifetime.

SSD disk configuration

“discard” and “noatime” attributes

Each partition wich is on SSD disk should have be mounted with “discard,noatime” attributes.

  • Edit your /etc/fstab
    sudo nano /etc/fstab
  • Modify each partition line which is related to SSD disk. e.g there is modified my root and boot partition.
    /dev/mapper/ssdlvm-mainpartition /               ext4    discard,noatime,errors=remount-ro,user_xattr 0       1
    UUID=5a66498a-e3cb-470c-b37d-e9c312402808 /boot           ext4    discard,noatime,defaults        0       2
  • Save file and reboot your computer

Other modifications

Move /tmp to RAM

Because I have only one disk slot in my notebook and /tmp can demage SSD disk (there are a lot of write operations) I moved my /tmp to RAM (I have 12GB of RAM in my NTB).

  • Delete all content of your /tmp
  • Edit your /etc/fstab
    sudo nano /etc/fstab
  • Modify or add your /tmp mount point. There is line of my /tmp mount point.
    tmpfs	/tmp	tmpfs	nosuid	0	0
  • Save file and reboot your computer

There is my /etc/fstab file

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#                
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/ssdlvm-mainpartition /               ext4    discard,noatime,errors=remount-ro,user_xattr 0       1
# /boot was on /dev/sda1 during installation
UUID=5a66498a-e3cb-470c-b37d-e9c312402808 /boot           ext4    discard,noatime,defaults        0       2
# /tmp
tmpfs	/tmp	tmpfs	nosuid	0	0

Disable SWAP

SWAP partition can demage SSD disk too. Move SWAP to HDD or disable it. I didn’t create SWAP when I installed Ubuntu on my SSD.

Move ~/.cache to RAM

System produce a lot of cache files (e.g. browsers cache pages), it can decrese SSD lifetime too. I moved my cache to RAM.

  • Delete folder ~/.cache
    rm ~/.cache -R
  • Create folder for your cache in tmpfs partition (in my case /tmp/.myCache).
    mkdir /tmp/.myCache
  • Create symlink to /tmp/.myCache).
    ln -s /tmp/.myCache ~/.cache
  • You have prepared your cache folder, but after restart you will lost it. You have to modify .profile file.
    nano ~/.profile
  • Add mkdir command to the top of the file.
    # Create folder for my cache files
    mkdir /tmp/.myCache
  • Save file

Leave a Reply

Your email address will not be published. Required fields are marked *