On Ubuntu Linux 12.10 TRIM on filesystem level is not enabled by default (for a good reason!) but also batched discard is not enabled by default.
The German ubuntuusers wiki suggests running a script every day or week. Since I decided that I only wanted this to run if my load is low, because queued TRIM will only be avaliable in SATA 3.1 and running TRIM can block the system.
I decided to run TRIM daily since that would make it run shorter.
So I wrote this little script (Python this time, no other dependencies but the little script mentioned above and a file /var/opt/trim which needs to be existing and non-empty), which will be executed every 3 hours (using cron).
import os, time
TRESH = 1.0
RUN_FILE = "/var/opt/trim"
load_1, load_5, load_15 = os.getloadavg()
if now - last_run > 86400 and load_5 < TRESH:
except Exception, e:
Today, as I got my new harddrive (which is a Samsung 830 SSD), I decided to re-install my copy of Ubuntu (for whatever reason). Copying my home folder, some configfiles and so on is an easy task, but what about all these little programs, that were installed with some manual Installer (like QPilot, VMware, …) because they don’t provide a APT-Installer? I do not do any bookkeeping about those, so I wrote a little script, that checks populates a list of files on my root filesystem and checks them, if they belong to some debian package.
It took a while on my old spinning harddrive, probably there is a more efficient way, instead of calling dlocate for every single file.
My little script:
echo "Creating fileslist"
eval "/usr/bin/find / -xdev -type f > $FILELIST 2>/dev/null"
if [ ! -f $FILELIST ]
while read LINE
if [[ $LINE != *var\/cache* ]]
if [ $(dlocate -S $LINE | wc -l) == 0 ]
value=`expr $value + 1`;
if [ $FRESHLIST == 1]
echo "****$value Non-APT Files found";