Thinkpad x220 – the (almost) perfect setup (Fedora 16)

The Configuration

1. SSD

First thing after the installation has completed is to finish the SSD configuration and disks layout. You’ll need to shrink the Windows partition (or may be even deleted) to allow partitions like HOME and VAR. How you’ll do it is up to you – I’ve used gparted and shrinked the Windows part to 80GB like this:

All free space was used for and LVM partition, with an exception of a small 1GB part which was designated for a BOOT partition (it is not used currently, but you never know :-). Out of the 200GB LVM I’ve carved 4GB for /var/log, 4GB for swap and 140GB for /home, so the final layout of all volumes is:

[root@yggdrasil ~]# lvdisplay  | egrep '(LV|VG) (Name|Size)'
LV Name                /dev/vg_ssd/fc16_root
VG Name                vg_ssd
LV Size                20.00 GiB

LV Name                /dev/vg_hdd/home
VG Name                vg_hdd
LV Size                140.00 GiB

LV Name                /dev/vg_hdd/swap
VG Name                vg_hdd
LV Size                4.00 GiB

LV Name                /dev/vg_hdd/fc16_log
VG Name                vg_hdd
LV Size                4.00 GiB

Why I moved that partitions there?

  • /var/log – to minimize the SSD writes
  • swap – to minimize the SSD writes (it is not used any way so I don’t care about the performance)
  • /home – this is the place where I keep all my data, so it cannot be accommodated on the SSD anyway, minimizing writing on the SSD is also a factor here

To further minimize the write operations on the SSD /tmp was moved into RAM with simple modification of /etc/fstab:

[root@yggdrasil ~]# cat /etc/fstab

/dev/mapper/vg_ssd-fc16_root                    /                       ext4    defaults,relatime,discard                       1 1
/dev/mapper/vg_hdd-fc16_log                     /var/log                ext4    defaults                                        1 2
UUID=bcbe3b92-71bb-4587-a0e4-7615b06cf637       /boot                   ext4    defaults,relatime,discard                       1 2
UUID=3731-23C5                                  /boot/efi               vfat    umask=0077,shortname=winnt                      0 0
/dev/mapper/vg_hdd-home                         /home                   ext4    defaults                                        1 2
/dev/mapper/vg_hdd-swap                         swap                    swap    defaults                                        0 0
tmpfs                                           /tmp                    tmpfs   defaults,relatime,nodev,nosuid,mode=1777        0 0

This leads to one more thing that should be added to that file – the relatime and discard options for the filesystems formated on the SSD.

  • discard – this allows the filesystem to inform which disk blocks are freed and not used –  for SSD that translates to the so called TRIM command
  • relatime – this instructs the filesystem to update the access time of each file only after it was modified or changed, otherwise by default every time a file is read, its access time is modified which results into writes onto the SSD disk

How are the partitions moved?

  • /var/log – switch to console terminal and login as root
telinit 1
mkdir /mnt/log
mkfs.ext4 /dev/mapper/vg_hdd-fc16_log
mount /dev/mapper/vg_hdd-fc16_log /mnt/log
mv /var/log/* /mnt/log
umount /mnt/log
mount /dev/mapper/vg_hdd-fc16_log /var/log
restorecon /var/log
telinit 5
  • swap
swapoff -a
mkswap /dev/mapper/vg_hdd-swap
swapon /dev/mapper/vg_hdd-swap
  • /home – logoff from your X session again switch to console terminal
mkdir /mnt/home
mkfs.ext4 /dev/mapper/vg_hdd-home
mount /dev/mapper/vg_hdd-home /mnt/home
mv /home/* /mnt/home
umount /mnt/home
mount /dev/mapper/vg_hdd-home /home
restorecon /home

2. Fedora repositories

This is quite straight forward. Just a list of repositories and why I’ve added them

  • Adobe repositories – the 32bit one I’ve added because of Acrobat Reader that I occasionally happen to use (when I really Adobe’s PDF reader – usually I’m OK with Okular) and the 64bit is added because of 64bit flash-plugin

name=Adobe Systems Incorporated

name=Adobe Systems Incorporated
  • RPM Fusion repository (both free and non-free) – this is the main third party repository for Fedora that I’m using containing many, many of packages that are not included by default in Fedora repos because of copyright/licensing.
  • Infinality repo – this is one of the well kept secret repo that every fedora user should enable. This one ships modified versions of freetype library packages and the difference in font rendering is unbelievable. There are tons of options that you could modify its behaviour and how the fonts are rendered, but I’ll not comment them here. Just install this package to enable it.

So I think this is it for the initial installation. There are of course more topics that must be added to make this install more “perfect” (not that it is possible to achieve that state :-). I’ll just list them here for now and later when I have articles on them I’ll link them here. The things that I’ve already worked on are:

  • Powersaving – this can make a huge difference in battery life
  • Docking Station – seamlessly docking and undocking the laptop,  regardless of the state of the OS – powered off, suspended or working and getting what is expected – switching of the user interface on the correct display, whether there is a user logged in or not and we are at the login screen – this is something that deserves a separate post.
  • Thinkpad / X220 specific configuration – getting most of your Thinkpad obviously requires additional software and efforts
  • Desktop config / Eyecandy – this is mostly a matter of personal taste, so I’ll just share mine 🙂


Tagged , , , ,

8 thoughts on “Thinkpad x220 – the (almost) perfect setup (Fedora 16)

  1. Anonymous says:

    Any problems with the graphics?

  2. The only “problem” that I see is this message in dmesg:

    [ 2.392269] mtrr: no more MTRRs available
    [ 2.392271] [drm] MTRR allocation failed. Graphics performance may suffer.

    Beside that fact – I cannot say there are any performance/speed issues, screen tearing etc …

    • Anonymous says:

      Awesome…I’m looking at a Dell with the same graphics card and I was concerned. Your blog post was incredibly insightful and interesting thanks so much for shearing!


  3. beesdee says:

    I want to know if you had success with powersaving. I am having trouble on FreeBSD and am looking at Fedora as a temporary solution. I can’t get below 50C with the default fan options. I don’t want to be manually setting anything. What are some good throttling configurations?

    • Indeed I’ve done what I’ve could to get down the power consumption, but it was not related with controlling the fans …

      I plan to write about what I’ve done, but as I don’t have the time to do it now I’ll just post the script with all settings:

      # Enable USB autosuspend
      for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
      # Enable SATA Power Management
      for h in /sys/class/scsi_host/*/link_power_management_policy; do echo min_power > $h; done
      # Disable WOL 
      ethtool -s em1 wol 
      # Enable Power Aware CPU scheduler 
      echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
      # Enable Audio codec power management
      echo 1 > /sys/module/snd_hda_intel/parameters/power_save
      echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
      # Enable power management for all PCI devices
      for c in  /sys/bus/pci/devices/*/power/control; do echo auto > $c; done
      # Extend VM writeback timeout
      echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
      # Disable NMI watchdog
      echo 0 > /proc/sys/kernel/nmi_watchdog
      echo 0 > /proc/sys/kernel/watchdog

      Also I’ve added this to my /etc/default/grub

      GRUB_CMDLINE_LINUX="quiet rhgb threadirqs pcie_aspm=force i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 iwlagn.power_save=1 iwlagn.power_level=5

      And that gives me usually consumption around 10W with WiFi ON. Regarding the temperature I’ve never worried about it, but it seems that I have similar values – 45-50C, which I think is OK.

  4. mir says:

    Great documentation – great results!
    what’ s still unclear to me: Is the dvd-drive, provided through the ultrabase dock, working properly in fedora? i.e movie playback and burning? Where there any troubles? Which model do you use?

  5. Matthew Shuster says:

    Hi Tador,

    I also have an X220. I tried installing Fedora 17 from the Live CD image via UEFI, however Anaconda creates a FAT16 EFI System Partition (ESP), rather than the FAT32 ESP required by ThinkPads —and as you have pictured above. I just installed Fedora 18 on my Asus H77 desktop board in UEFI mode, also from the Live CD, and the new Anaconda still creates a FAT16 ESP. How exactly did you install Fedora on your X220 in order to get the FAT32 partition? Was this from a DVD image, or a net install?

    Thanks for your help,
    Montréal, Canada

  6. […] I wanted to install Fedora with no special settings and based my setup partially on this article. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: