Saturday, July 24, 2010

Something I just learned about in Gnome

Just today I learned about a feature in the Gnome desktop environment that is the Ubuntu default. I absent-mindedly middle-clicked the title bar of a window, and found it sent the window to the back, behind any other windows. It's the opposite to left-clicking the title bar, which brings the window to the front, which everyone knows about.

You learn something every day.

Thursday, July 1, 2010

Should you use the XFS file system?

One of the good things, and also one of the confusing things about Linux, is the amount of choice you have. Even down to what sort of file system you want to use for storing your data. By default, the Ubuntu installer will use ext4, a good, general purpose file system that will suit most people's needs just fine.

There are other options though, depending on your usage patterns. If you have a lot of large files stored, such as lots of video or movies, maybe even if you record TV with MythTV like I do, a good alternative is XFS. Its design means it is particularly good at handling large files, such as High Definition TV recording, giving good performance in reading and writing them.

You can specify a partition to be in XFS format at the time of installation, or later on by using GParted. Once it is created, there are some further tweaks you can do to make its performance better, and also to maintain its performance over time.

1. Add the following options to the fstab entry for the partition (located in /etc/fstab):

UUID=xxxx /var/lib/mythtv xfs defaults,noatime,allocsize=512m,logbufs=8 0 2

noatime refers to stopping the file system logging each time the file is accessed. Normally it is not needed, and this option reduces the number of writes done to disk, speeding things up.

allocsize=512m lets XFS set aside 512 megabytes of space at a time when it writes. This reduces the chance of the file being split up into many small chunks, or fragmenting. Especially good for recording TV.

logbufs=8 refers to the log buffers held in RAM. Values can be from 2 to 8 buffers, which are 32K in size. Since most PCs have RAM to spare these days, there is no problem maxing this out.

Sometimes a bit of periodic maintenance is needed with XFS, and this can make people used to NTFS on Windows feel a little more at home. You sometime have to defragment the file system, and there is a utility that can do it. It isn't installed by default - you have to install the xfsdump package to get the folllowing commands.

To check the fragmentation level of a drive, for example located at /dev/sda6:

sudo xfs_db -c frag -r /dev/sda6

The result will look something like so:

actual 51270, ideal 174, fragmentation factor 99.66%

That is an actual result I got from the first time I installed these utilities, previously having no knowledge of XFS maintenance. Pretty nasty. Basically, the 174 files on the partition were spread over 51270 separate pieces. To defragment, run the following command:

sudo xfs_fsr -v /dev/sda6

Let it run for a while. the -v option lets it show the progress. After it finishes, try checking the fragmentation level again:

sudo xfs_db -c frag -r /dev/sda6

actual 176, ideal 174, fragmentation factor 1.14%

Much better! I have the xfs_fsr command scheduled to run daily with a cron job, at a time when it is unlikely to be recording, to keep things in good shape.

More in depth information on XFS can be found at the MythTV wiki. Some more detailed performance optimisation info can be found here and here.

Tuesday, June 29, 2010

Where to go for help with Ubuntu

OK. So you've downloaded the latest version of Ubuntu, or even scored yourself an installer CD. Something doesn't go quite right with the install - where do you go next?

You may be able to still use Ubuntu as a live CD, meaning you could use it to access the internet. Or, if you were thinking of trying a dual-boot installation, you could still get on to the net from your existing install.

The first place I look is the Ubuntu forums. They are quite popular, with loads of visitors. Whatever problem you're having, someone is bound to have had something similar. These things are invaluable. As a matter of fact, even though I've visited them for years, and found heaps of solutions, I'm still yet to make a post myself. I just haven't needed to. The same thing happened with the Gentoo Linux forums, back when I used to run that.

As a matter of fact, if you can't find an answer in the Ubuntu forums, try some different ones - like the Debian User Forums. Since Ubuntu is based on Debian, there is a lot of similarity.

Another community I've been a long-time member of is Overclockers Australia. Their forums also provide a wealth of information - the Other Operating Systems forum in particular comes in quite handy.

Back on the Ubuntu site, you could try the Official Ubuntu Documentation. Sometimes though, it can be a bit lacking in detail, or it can be a little dated. This is why I suggest visiting the forums first.

Then there's always Google. Which could be how you found this page...

Another option is to download the free ebook, Getting Started with Ubuntu 10.04, by the Ubuntu Manual Project. Lots of info there in setting it up.

Monday, June 28, 2010

Ubuntu 10.04 progress update... update

Well I should have known I'd jinx myself when I mentioned in my last post that the strange, hanging at boot problem has solved itself. Just this morning, the day after I posted, the thing just hung at the boot splash screen. A quick control-alt-delete got the thing rebooting, and it all started fine after that. Looking in the log file viewer revealed nothing out of the ordinary; checking the ubuntu forums showed up nearly nothing, apart from the fact that it happens to other people too.

I say nearly nothing, because I did learn one thing. If you hit escape while in the boot splash screen, the pretty graphics go away and the boot messages come up. I now want the machine to have problems at boot, so I can try this and see if anything interesting appears. Yeah, reverse psychology. I want you to fail at boot, all the time!

(Originally posted June 28, 2010 on my other blog)

Ubuntu 10.04 progress update, and a bit about Crashplan

Well it has been a couple of months now, using Ubuntu 10.04 Lucid Lynx. Overall, I have been pretty happy with it. Boot times are very quick, especially with it installed on the Intel X25-V solid state drive. The interface is quite polished and looks good. MythTV is working nicely as well. I did have a spell a little while back where it would hang during boot or shutdown, requiring a restart. Either that, or there would be a quite long delay in the boot process. I tried to work out what was causing the holdup by installing bootchart (available in the repositories) and looking at the results.

Wouldn't you know it, but after I installed it and rebooted, the system worked fine. Everything has been back to normal. Don't know what was wrong or what fixed it. Oh well, I'll take it.

I have a sneaking suspicion that it might be due to doing an upgrade install rather than doing a fresh install - I'll wait and see if it keeps behaving itself.

Backing up the various systems around the house has been something that has been looked into lately, too. I have purchased a new external hard drive to replace the old one, that is now getting a bit old. Following on from discussions on the Overclockers Australia forums, I have been trialling Crashplan, a backup service that allows you to back up to local folders or attached drives, other computers on a network, other people's PCs, or their own online backup service. It is more concerned with backing up data, rather than complete system images, so that's what I use it for.

It has enabled me to get around some of Windows 7 Home Premium's limitations about backing up to a network. The setup I have now for my wife's Windows 7 PC is that the standard windows backup runs, sending its data to a small external drive attached to it. Supplementing that is Crashplan, that backs up documents, photos, music and the like to the new external drive attached to my PC, giving a bit of redundancy.

My own PC has a regular backup scheduled via backintime to get most of the system data, and Crashplan to back up the music, photos, documents and the like.

On all machines, these are scheduled to run daily with the exception of the windows system backup that is set for weekly running.

I haven't yet decided whether to take the plunge and purchase the Pro version of Crashplan, or to enable the online backup component. I'm just waiting to see how the software behaves itself - I have overcome one particularly nasty teething problem.

Sometimes when my Linux machine boots, if the external drive hasn't mounted in time, Crashplan would decide to re-create the backup directory on the system partition and try to back up ~140GB of data to it. I've fortunately managed to catch it in the act and stop it before anything nasty happened, but it made me hesitant to make the purchase. I am not the only one who has had the problem, as this support forum thread describes.

I tried a couple of fixes - one was to change the program setting to only allow it to run between certain times, so the machine would be on, and the drive mounted in time, before it starts. This worked well until a few days later when I came home late from work and booted the PC. Backup to system partition happened again. I tried editing the startup scripts, adding a "sleep 20" command, to delay the program from starting until the drive was mounted. I thought this was the solution, until I one day turned the PC on and walked away to do something else. I came back, logged in, and realised the drive wasn't mounting until after I did that. Crashplan started as soon as the 20 second delay ran out, which turned out to be before my login.

The final solution, and I think this has nailed it, was to add an entry for the external hard drive in the /etc/fstab file. This now mounts the drive straight after it mounts the other, internal drives, and well before the Crashplan engine starts. Since the external drive is a semi-permanene attachment to the PC, it works for me.

I may yet start using the online backup - the only issue now is the matter of uploading nearly 200GB total over a 512 kilobit upload link, with uploads counted towards my data allowance. This would have to be spread out over a couple of months of uploading at a throttled speed.

Overall, I'm pretty happy with Crashplan so far. It supports Windows, OSX and Linux, which is rare. The clients all find and connect to each other with a minimum of hassle as well. It would be good having some peace of mind that all our photos and documents would survive if the house burnt down or something.

(Originally posted June 26, 2010 on my other blog)

Most painless Ubuntu upgrade ever

Wow. That's all I can say. Today I decided to upgrade to Ubuntu 10.04, but rather than doing a clean install like I have done with previous versions, I thought I'd have a go at the upgrade. To prepare, I copied the /boot, root and /home partitions of the existing 9.10 install to some free space on another hard drive. Just as a precaution in case it all went pear-shaped. I ran the update manager, chose the upgrade option, and away it went - downloading all the new packages, applying the updates. Only a couple of dialog boxes popped up asking about Grub, and what it should do with it.

The process finished without incident, I rebooted, and surprisingly, it started, allowed me to log in, and it got to the desktop! All previous programs and settings there, all programs updated. I am pleasantly surprised - even MythTV updated without a hitch, for the first time. I'm sure there will be the odd hiccup along the way that I'll discover in time, but so far so good.

Oh yes, regarding Windows 7 - I've removed it from my machine. Partly because I was barely using it, apart from watching full-screen Flash videos in decent quality, partly because I have obtained an old laptop from work, and installed 7 on that.

(Originally posted on May 2, 2010 on my other blog)

New keyboard! And more on Windows 7

This post is basically inspired solely by the fact that I have bought a new keyboard and need an excuse to do a lot of typing on it. After finally having enough of interference, non-responsiveness and battery changes, I ditched by former wireless keyboard and mouse combo and bought a couple of new ones - a Logitech M500 corded mouse and an Illuminated keyboard. It has a nice, laptop-style key feel with just a little more travel, with the added bonus of keys that light up for use in a dark room.

I love it. Ubuntu picked it up without a problem, all keys working just fine. Windows detected it as well, but after installing drivers for it, insisted on a reboot. Some things never change. I didn't bother installing the setpoint software that is included - no need for it in my opinion.

As a progress update on my dual-boot exploits, there have been good points and bad about windows.

The good:
  • Sleep actually works. It worked even better when I downloaded a patch that stopped it crashing on resume when the hard drive didn't wake up in time. In Ubuntu, I only ever got to a blank screen with a blinking cursor when I tried the suspend feature.


  • Full-screen flash videos work with hardware acceleration. Only 5-10% CPU utilisation, compared with almost maxing-out a core under linux. This is due to differing stages of development of Adobe's flash player.


  • General polish and feel of the desktop. You can tell a lot of work has gone into this. The help functionality is excellent as well - far better than Ubuntu's vague documentation.


  • Backup works great - nice and straightforward, asking to also create a startup disc for system recovery. In Ubuntu, I am using backintime. While it is great for making backups, restoring from them is not so straightforward. Must look into an image based program.


  • Homegroups work great - it found the other Windows 7 PC on the network with no problems and is effortlessly sharing files between them. I can even use the printer connected to the other machine - a Canon that has stuff-all driver support under linux.


  • The bad:
  • While sleep works, the simpler task of powering off the screen after a set period seems more difficult for it. It doesn't always do it. Then again, a number of XP systems at my work have problems with that as well - and they are factory Dell and HP boxen.


  • The media centre application isn't quite up there with MythTV, one of linux's killer apps, in my opinion. Guide data is only available from the networks' broadcast guide, and I can't find a way to get it to set up two tuners. Actually, finding any documentation on it is somewhat difficult.


  • All the rebooting needed. It's still there, and it gets old pretty quick.


  • I think I'll be dual-booting for a while longer, especially since MythTV will not be replaced any time soon. It has been interesting though, and I am learning the interface and all. I have noticed a lot of fixes since the Release Candidate that I was running last year on the other PC.

    (Originally posted on January 29, 2010 on my other blog)