Monitor HDD Temperatures in Debian

Modern storage drives (harddisk/ssd) support S.M.A.R.T (Self-Monitoring, Analysis, and Reporting Technology) and allow to examine the current drive status through a standardized interface. The design goal during S.M.A.R.T’s development was to anticipate drive failures before they actually happen. HDDTemp utility can read out the temperature of your hard drive by reading the data from S.M.A.R.T

Install hddtemp

To install hddtemp under Debian/Ubuntu enter the following command into a terminal.

$ sudo apt-get install hddtemp

You can also perform source code installation. Download the source code tar ball here.

$ tar -jxvf hddtemp-0.3-beta15.tar.bz2
$ cd hddtemp-0.3-beta15
$ ./configure
$ make
$ sudo make install

Monitor hard disk temperature

To see the temperature for /dev/sda, enter the following command:

# hddtemp /dev/sda

##Output
/dev/sda: Hitachi HDS723020BLA642: 36°C
# hddtemp /dev/sd[a-k]

##Output
/dev/sda: Hitachi HDS723020BLA642: 37°C
/dev/sdb: Hitachi HDS723020BLA642: 38°C
/dev/sdc: Hitachi HDS723020BLA642: 38°C
/dev/sdd: Corsair Force 3 SSD: 128°C
/dev/sde: WDC WD2003FYYS-02W0B1: 37°C
/dev/sdf: WDC WD2003FYYS-02W0B1: 37°C
/dev/sdg: WDC WD2003FYYS-02W0B1: 39°C
/dev/sdh: Hitachi HUA723020ALA640: 35°C
/dev/sdi: Hitachi HUA723020ALA640: 35°C
/dev/sdj: WDC WD2003FYYS-02W0B1: 41°C
/dev/sdk: WDC WD2003FYYS-02W0B1: 41°C

Dropbox error about monitoring file system

On Linux, the Dropbox client or in general all applications are subject to a default file system limit regarding the number of directories and files an application can monitor for changes.
Dropbox sooner or later will notify you with the following warning:

“Unable to monitor the filesystem – Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem.”

The Linux version of the Dropbox desktop application is limited from monitoring more than 10000 folders by default. Anything over that is not watched and, therefore, ignored when syncing. There’s an easy fix for this.

# increases the max-file-watch limit


echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf

# to apply the changes without restarting


sudo sysctl -p
sudo dropbox stop
sudo dropbox start

Optimize Debian/Ubuntu for SSD

Original post: http://askubuntu.com/questions/1400/how-do-i-optimize-the-os-for-ssds

I have successfully used several different techniques to improve the way Ubuntu uses the storage device, whether that be solid state or traditional drives. For SSDs you are looking to minimise the number of times the drive is written too, as reads should not add wear to the drive.

1) Manage the swap file

If you do not hibernate your computer and you have ample RAM memory to run all your applications, then in theory you do not need a swap partition. In case that you have a mix of SSD and hard drives, place your swap partition on the hard drives only.

2) No Writes for Read Timestamps (suitable for SSD’s and hard drives)

Mounting your partitions with the options noatime and nodiratime will stop timestamp writes when you read files and folders. These timestamp writes are not generally required unless you use a local mail server client such as mutt.

Edit your /etc/fstab configuration file (carefully – take a backup to be sure as breaking your fstab configuration can prevent you system from working):


#backup your fstab file
cp /etc/fstab ~/fstab-backup
#open the file in your favorite editor (with root permissions)
gksudo gedit /etc/fstab

Edit the mounting options for your partitions by adding the text noatime and nodiratime to the lines defining your root (/) and other partitions if you have them such as (/home).
Note: if you have a /home partition, start with that just changing that partition if you are concerned about breaking something


# / was on /dev/sda2 during installation
UUID=587e0dc5-2db1-4cd9-9792-a5459a7bcfd2 / ext4 noatime,nodiratime,errors=remount-ro 0 1

# /home was on /dev/sda3 during installation
UUID=2c919dc4-24de-474f-8da0-14c7e1240ab8 /home ext4 noatime,nodiratime,defaults 0 2

Enabling trim

In case your ssd supports TRIM (all intel and samsung ssds do) you can enable TRIM by adding the discard option to your fstab file so the final fstab file looks like this:


# / was on /dev/sda2 during installation
UUID=587e0dc5-2db1-4cd9-9792-a5459a7bcfd2 / ext4 discard,noatime,nodiratime,errors=remount-ro 0 1

# /home was on /dev/sda3 during installation
UUID=2c919dc4-24de-474f-8da0-14c7e1240ab8 /home ext4 discard,noatime,nodiratime,defaults 0 2

These changes are effective after a reboot

3) Minimising writes from the OS and applications

Assuming that you are not running a mission critical production-server, most people do not look at logs should something go wrong (especially as serious errors are rare for most Ubuntu users). Therefore you can configure Ubuntu to write all logs to ram instead of the ssd.

Note: only make the following changes when you have installed all software you are going to use (especially things like Apache web server), otherwise you may experience some issues with missing directories in /var/log

Open /etc/fstab with an editor (assuming you have backed up the /etc/fstab file)


gksudo gedit /etc/fstab

Add the following lines at the end of the fstab file and save:


# Uncomment these after all server based applications installed - eg. apache
#tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
#tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
#tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
#tmpfs /var/log/apt tmpfs defaults,noatime 0 0
# none /var/cache unionfs dirs=/tmp:/var/cache=ro 0 0

Alignment:

What is often pointed out is the right alignment of the partition. This should be equal to the block size of the SSD. Play safe and make your partitions aligned to MiB boundaries. Note that you can’t do this with the Ubuntu installer’s partition tool (which uses MB not MiB), but you can boot the live CD, use Gparted (which uses MiB), then click Install to use the partitions you set up.

The right scheduler:

A important point is the scheduler which should be noop. You can set this scheduler via kernelparameter elevator=noop or via a entry in rc.local:


echo noop > /sys/block/sda/queue/scheduler

Unbranded Firefox in Debian

Mozilla Firefox is a widely used web browser in many GNU/Linux distibution, including Debian OS. Debian uses a slightly patched version of Firefox and due to the brand/name restrictions isn’t allowed to call their version Firefox anymore. Therefore, Debian re-brands the Firefox browser and calls it Iceweasel. (Same restrictions apply to Thunderbird which is called Icedove)

Iceweasel is Firefox, only with different name and logo. It performs exactly like Firefox and the extensions/add-ons are 100% compatible.

Manually Installing Firefox

Download Firefox

Download the latest version of the unbranded Firefox from Mozilla’s Website:
Link on their Website to 32bit builds: http://www.mozilla.org/en-US/firefox/all/
For 64bit builds for Linux goto: http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/

Install Firefox

#copy firefox tarball to /opt

sudo cp firefox-*.tar.bz2 /opt

#change to /opt directory

cd /opt

#extract tarball

sudo tar -xvf firefox-*.tar.bz2

#remove the tarball

sudo rm firefox-*.tar.bz2

Create Symbolic Link for Startup

If you previously had Iceweasel installed the file /usr/bin/firefox might already exist. On further inspection it’s just a script:


#!/bin/sh

FIREFOX="$(which $0)"
[ -x "$FIREFOX.real" ] && exec "$FIREFOX.real" "$@"

exec iceweasel "$@"

Basically it means if a file called firefox.real exists the shell is going to execute the firefox.real binary otherwise it will start iceweasel. Therefore create a symbolic link to /usr/bin/firefox.real


sudo ln -s /opt/firefox/firefox /usr/bin/firefox.real