August 03, 2009

My Book Studio Edition II under Linux

If you're thinking of buying one of these external RAID drives for use under Linux then you may want to reconsider. I've have had a 1 TB (2 x 500 GB) Western Digital My Book Studio Edition II for a few months now and running it under Linux is simply difficult because of the its power management features. After around 10 minutes of inactivity the drives spin down. Under Windows and OS X, WD's Drive Manager software spins the discs back up and presumably ensures that the computer waits while doing so.

I've tried several work arounds including touching a file via a cron job every few minutes to no avail. These are the kernel messages I get when trying to read the file system after the drive has spun down:

kernel: sd 0:0:0:0: Device not ready: <6>: Current: sense key: Not Ready
kernel:     Additional sense: Logical unit not ready, initializing command required
kernel: end_request: I/O error, dev sdb, sector 12511
kernel: sd 0:0:0:0: Device not ready: <6>: Current: sense key: Not Ready
kernel:     Additional sense: Logical unit not ready, initializing command required
kernel: end_request: I/O error, dev sdb, sector 12527
kernel: journal_bmap: journal block not found at offset 12 on sdb1
kernel: Aborting journal on device sdb1.
kernel: sd 0:0:0:0: Device not ready: <6>: Current: sense key: Not Ready
kernel:     Additional sense: Logical unit not ready, initializing command required
kernel: end_request: I/O error, dev sdb, sector 12431
kernel: Buffer I/O error on device sdb1, logical block 1546
kernel: lost page write due to I/O error on sdb1
kernel: ext3_abort called.
kernel: EXT3-fs error (device sdb1): ext3_journal_start_sb: Detected aborted journal
kernel: Remounting filesystem read-only

Running ls for example produces the following error until the drive has spun up again. As the file system now may contain errors, it's re-mounted as read-only and I have to run fsck on it to ensure that it is clean (which it usually is).

ls: reading directory .: Input/output error

My current work-around is to re-define how I use the drive. Sounds silly, but I now have designated the drive a vault (kind of archive) that I only need to write to every few months and when I need something off it, by default mount it as read-only. I use a tool called scsi-spin (part of the scsitools package available in Debian) to spin the drive up before mounting. scsi-spin won't spin up a mounted drives so remember to unmount the drive after use and for some reason I always have to issue this command twice.