February 26, 2009

Stale Lock

I did a bad thing the other day and have just barely lived to tell about it. I turned of my Linux box without shutting down. All you Linux & Unix veterans know my horror when I realized what I had just done. I hit the shutdown button and, when the screen briefly blanked out before going into the shutdown graphic, I hit the power button on my power strip to turn it all off. Oh oh, says I...

Now, I never used to shut off my machine(s). The only time I have ever had a hardware problem (he says, knocking on wood), is when I was turning on a machine. Given that, and some daemons that like to run in the background at night, I usually left my computers turned on.

But I have started to get more worried about power consumption, including 'zombie' electronic devices, I have started to power down all the computers in the house before I head to bed. It makes me feel all virtuous and green. But the other night I nearly paid dearly for my greeness.

When I turn the computer on the next morning, it booted to a text screen. Somehow, I just wasn't surprised. But I couldn't figure out why. dmesg told me nothing, nor did /var/log/messages. But when I tried to 'startx', I got a complaint about .X0.lock and a "stale NFS handle". How odd, as I don't use NFS at all.

Well, this file proved to be very difficult to get rid of. See, when your X server starts up, it creates this file to prevent X from running twice. So at startup, it checks to see if /tmp/.X0.lock exists. If it doesn't, X will create it and carry on its merry way. If it does, it assumes X is already running and will complain, albeit in a very obscure fashion. The usual solution, if you're sure there isn't a X server already running, is to just delete it. But 'stale NFS handle' files are a real pain to delete, especially if they aren't really NFS handles!

I had an inkling that I needed to run fsck on the partition, but that's a problem on the root partition. Luckily, I have several other Linux partitions I can boot into, so I just booted up my openSUSE 11.1 and tried fsck from there. Haven't made the jump to 11.1 yet, as too many of my packages don't quite work right, or I don't like the newer versions (I'm talking to you, Eclipse Ganymede and Amarok 2). But fsck didn't find anything wrong either, so I was stuck for ideas.

But then I read about the force option for e2fsck, so I ran that. Voila! A few odd errors, but most especially an odd error with .X0.lock. So I mounted the filesystem while still in 11.1 and was finally able to delete the .X0.lock file. And the reboot back into my 11.0 openSUSE went swimmingly!

So the lessons learned:

  1. If X won't start, try removing the lock file found at /tmp/.X0.lock
  2. If you can't remove a file because there is a bogus 'stale NFS handle' error (and believe me, it doesn't let you do anything with it), try forcing an fsck on the partition

Posted by jdarnold at 04:52 PM | Comments (1) | TrackBack

February 25, 2009

Big Bad SATA

So Best Buy had the much maligned Seagate 7200.11 Barracuda 1.5 terabyte hard drive on sale for a mere US$130. Given a couple of Best Buy rebates, I just couldn't resist picking it up for just a little of US$120 - incredible! I immediately went to the Seagate page to see if my drive had a firmware update, but luckily(?) it didn't so I was all set to install it.

Man, I just love the SATA connectors! Gone are the days of bending one of the gazillion little pins, or, even worse, getting it plugged in backwards. And no more slave/master settings either. Slid it into my tower, plugged two small cables into it and fired up the machine. It was immediately noticed and so now I needed to figure out how to partition it.

I created one 650gb partition for backups. I really truly am going to get a backup strategy implemented, especially now that my wife has her own laptop and is working from home. I'm going to run a Bacula server on my machine and Bacula clients on my box, my work box (WinXP) and my wife's Vista laptop. So I want to have plenty of room for storing select backups. I created this as an ext3 partition, with no access time tracking (for performance reasons), using YasT2's very easy Partitioner.

The other partition was a little more problematic. I want it to be the home for all our media - songs, movies, pictures. And I'll run a media server here. I have had real good luck with Mediatomb but Andrew Wafaa convinced me to try Coherence, a true DLNA/UPnP framework. It looks pretty neat - great, just what I need another project!

I wanted my media partition to be readable by WinXP as well as my openSUSE (and, in general, Linux) boots. I just checked so I know differently now, but I also thought that sharing a volume via Samba would require it to be a Windows partition as well. Turns out, that is a by now obvious bad conclusion, as Samba will share Linux partitions just fine. But as I wanted to use it natively as well, I still needed a Windows partition.

I was shying away from an NTFS partition, as I just wasn't sure how stable the NTFS-3G implementation was, so I started with a FAT32 partition. The biggest drawback with FAT32 is its 4gb max file size. It is also, I think, less efficient than NTFS in its structure, so it would use more space for such a large (nearly 750gb) partition. Once again, the Yast Partitioner worked great and was nearly instantaneous for FAT32 (or vfat) partition.

Now I wanted to move my ripped music CDs over to the new "mediax" partition (I couldn't use /media, as KDE uses that). As I wanted to preserve the time information, I used rsync:

$ rsync -auv Music /mediax
[lots and lots of]
/bin/cp: preserving times for `/mediax/Music/podcasts': Operation not permitted

That was odd. So without thinking about it too much, I decided to take the plunge and try out NTFS, as openSUSE 11 comes with read/write support "out of the box". So I reformatted it as NTFS (after rebooting into Windows, as Partitioner doesn't format NTFS) and tried again.

This time, it worked pretty well. openSUSE uses the "standard" NTFS-3G driver. There is an odd caveat about a slowdown with Amarok, my prefer music player, but it seems to have to do with writing, not reading, which I don't do much, so no big deal.

But I ran into a problem because of my change of heart. Because I had originally formated it with FAT32 (vfat) using the Partioner in YaST (openSUSE's graphical admin tool), and because Partioner doesn't support NTFS formating, I forgot to change the /etc/fstab file, so on reboot, it didn't work correctly. I then compounded errors by changing the 3rd column to being merely 'ntfs', which meant I was still getting the weird cp "Operation not permitted" error, which had me really confused. But I checked out swerdna's page on using NTFS on Linux and finally the light dawned on Marblehead. I changed the filetype to 'ntfs-3g' and now all is good and I can use my music collection whether I'm in Linux or (shudder) have to reboot into Windows.


Posted by jdarnold at 09:33 AM | Comments (3) | TrackBack