- Make a Windows system repair disk via the control panel's Backup/Restore item.
- Put the new SSD into an external USB case
- Boot into a Linux live CD that supports your hardware, and dd the internal drive to the external drive.
- Unplug the external drive, reboot back into Windows.
- Now to extend the partitions on the new drive so you have your new C:. Plug in the external drive, run Easus Partition Master and move your rescue and tools partitions to the end of the drive and resize your C: partition on the new drive.
- Shutdown the system
- Remove the old SSD from the computer, replace it with the new SSD.
- Boot into the repair disk. It'll then whine that your boot needs repairing. Let it.
- Boot into the system, and then go to the control panel's 'System' item. Select "System Protection", then scroll down to the end of the list and you'll see something that says "C: (Unavailable)" that says System Protection is enabled. Click on it, then click "Configure", then "Disable".
- Click your new "C:" partition, select 'Enable', then whatever percentage you want to enable for System Restore snapshots.
Friday, November 9, 2012
How to upgrade to a bigger SSD
Wednesday, November 7, 2012
UDP or TCP for lossy networks?
At which point you're saying, "say wha?!" But here's the deal. If you lose a video packet with UDP, you lose a frame. RTP handles reassembling the packets into frames, if the next frame has come in and there's no packet to fill in slot X in the previous frame, RTP just throws the frame away. If you're getting 28 frames per second, you lose one frame out of that, big deal. Just replay the previous frame on replay, nobody will notice.
Now let's say you're using TCP. A missing packet occurs. TCP is expecting packet N... and doesn't get it. The TCP window goes SLAM at that point -- 4 megabytes of data backs up behind the missing packet as TCP tries to build its window and has a missing piece that it is waiting for, then TCP flow control assures that no more data is accepted until after the 1.5 second timeout causes a retransmit on the sender side. What this does is add 1.5 seconds worth of delay. You have a 1.5 seconds of delay, 4 megabyte window, and a gigabit Ethernet line, and what that means is that one lost packet every 1.5 seconds basically causes your gigabit Ethernet line to become a 21 megabit/sec Ethernet line. Congratulations, you just returned to 1985. And if you have 200 megabits/sec of incoming data, all that data is piled up in the network stack somewhere between you and the cameras, and you're in big trouble.
For streaming data, UDP thus handles a lossy network much more gracefully than TCP does. At least, that's true if you don't care about data loss due to redundancy in the data stream. I.e., frame 1000 in a video stream is very similar to frame 999 and frame 1001, so if frame 1000 goes missing it can be recontructed as simply the duplicate of the preceding or following frame. So what if you *do* care about data loss?
The reality is that if you *do* care about data loss, you're much more likely to get good results when streaming data if you use out-of-band data recovery. That is, if you've tried filling your frame, you already have packets for a couple more frames incoming, and you're missing a couple of packets, request packet retransmission directly via a NAK rather than wait for the sender to timeout waiting for an ACK. Thus *one* reason why most reliable multicast protocols rely on recipients proactively sending a NAK rather than time out waiting for an ACK before sending a packet. You can combine the two if you wish -- in this case, ACK would let the sender know that all packets in the frame were received thus it doesn't need to retain the frame in order to potentially service a NAK -- if you're really wanting both reliability and performance. But TCP doesn't do that. Which is why, on a lossy network, TCP is probably the worst protocol you could use for streaming data, and why the person who said "TCP is best for lossy networks" was wrong, at least for this application.
-ELG
Monday, November 5, 2012
The importance of strong product management
In other words, the notion that the Windows 8 UI change is all about "marketing" is pretty much nonsense. It's been well known that the Cairo user interface introduced with Windows 95 has reached its logical limits for quite some time, and ideas for changing the UI to meet the new challenges of the 21st Century have been floating around inside Microsoft for years, if a look at the Microsoft Research web site is any guide. I'm sure that Marketing told engineering, "we need a UI that will be usable on a tablet! And oh, make it usable on a desktop too!", but at worst Marketing merely hurried what was already in progress, rather than being a direct cause of the changes in Windows 8. The writing was on the wall for the Cairo UI, and sooner or later it would have been consigned to the dustbin of history regardless of Marketing's frantic panic about tablets.
So unlike a lot of people, I'm not surprised at all that Windows 8 has a significant shift in UI functionality. What I *am* surprised at is that it was done so badly. Microsoft has a lot of good people, and Windows 8 has all the raw tools in it to be a great operating system. Yet there's some needless complexities in its operation that shouldn't be there, and some important missing functionality that should be, such as IOS or Android style icon folders (without that, you're in endless sideways-scrolling territory to get all your most-used programs onto the start screen). So what gives?
In my opinion, the biggest issue with Windows 8 is caused by a clear failure of product management. Good product managers are hard to find because the job requires an understanding of customers at an intuitive level such that you can devise workable requirements to meet their needs, yet sufficient technical chops to understand what is doable and guide engineering toward producing the product that is going to meet those requirements. It also requires taste -- the ability to look at a product and say, "yes, that is tasteful and will please our customers" or look at a product and say "that is a pile of garbage, get it out of my sight until you do X, Y, and Z to it." Furthermore, product managers have to be empowered to be able to make those sort of judgements and have them stick. For better or for worse, Steve Jobs provides the template for what a strong product manager looks like -- opinionated, tasteful, with an intuitive understanding of the customer, with enough technical chops to understand what can be done, and power to make it stick.
Thing is, it's hard to find product managers like that because the geeks and nerds who typically run engineering departments wouldn't know good taste if it bit them on their bum, while the sales flunkees who typically run marketing departments wouldn't know technical chops if said chops bit off their ear. You almost need a Steve Jobs to do it. Unfortunately Microsoft doesn't appear to have a Steve Jobs to find good product managers, or if they do have good product managers, haven't empowered said product managers to make critical decisions about the product. Which is a shame. Because Windows 8 has a lot of good ideas, and the underlying technology is good. It just fails because of a lack of good taste (and courage, but see my prior blog on that), not because of a lack of technical chops.
Which just goes to show that putting out a great product isn't a matter of having great technology. It has to be a team effort, and if you don't have that, what you'll get is either a product that doesn't meet the needs of the marketplace, or a product that's far less great than it should be. Something to think about, if you're thinking about forming or joining a new startup. Do you have the kind of team that it will take? Does the company you are thinking of joining have such a team? Important questions, yet pretty much every startup I've encountered is all about the technology, and the rest of what it takes to have a great product is completely ignored. Which is probably why so many startups fail. So it goes.
-ELG
Thursday, November 1, 2012
Adding certificates for Windows 8 Mail
My email server is running Debian "squeeze" Linux with Exim4 as the smtp server and dovecot as the imap server. The first thing I needed to do was verify on the mail server that there were valid (self-signed) certificates for both exim4 and dovecot. This can be done with:
- openssl x509 -in some.crt -text -noout
The exim4 certificate was expired so I regenerated it with:
- /usr/share/doc/exim4-base/examples/exim-gencert --force
- Dovecot - /etc/ssl/certs/dovecot.pem
- Exim4 - /etc/exim4/exim.crt
Next, open up the Certificates tree until you see "Trusted Root Certification Authorities" and open it up to see "Certificates" underneath it. Right-click on Certificates and click "All Tasks" then "Import". Import your two certificates and there you are -- now all your self-signed certificates coming from your email server look as valid as any certificates, and are accepted by Windows 8 Mail just fine.
So, uhm... why does Microsoft make this so hard? I dunno, they're Microsoft, I guess. But the "ask your system administrator" is just BS, because Windows 8 Mail will *never* be used by anybody who actually has a system administrator other than themselves -- all businesses will be using Outlook Mail as their email client for a number of reasons. Oh well, just another example of how Windows 8 is half-baked and characterized by an utter lack of understanding of, well, actual customers.
-ELG
Tuesday, September 25, 2012
BTRFS vs ZFSonLinux: How do they compare?
- Integration with Linux
- ZFS: Not integrated. Has its own configuration database (not /etc/fstab), has its own boot order for mounting filesystems (not definable by you), cannot be told to bring a filesystem up after iSCSI comes up or down before iSCSI goes down.
- BTRFS: It's just another Linux filesystem as far as the system is concerned. You bring a pool up by mounting it (preferably by label) in /etc/fstab and can define the mount order so it comes up after iSCSI.
- Snapshots
- ZFS: Full snapshot creation and removal capabilities, well exploited by the FreeBSD port 'zfs-periodic'. Snapshots appear in a special "dot" directory rather than cluttering up the main filesystem. This script is relatively easy to port to Linux.
- BTRFS: Snapshots are created as "clones" of subvolumes, and destroyed as if they were subvolumes. They can be created either read-write or read-only.
- RAID: Both of these use filesystem-level RAID where filesystem objects are stored redundantly, either as entire clones (RAID1) or, in the case of ZFS, via RAID
- ZFS: Raid1 (mirroring) and RaidZ (similar to RAID5, except that it never does partial-stripe writes because it does variable stripe size -- the size of an object is the size of a stripe). Note that due to ZFS's COW implementation, an update to a RAID stripe cannot be corrupted by a power loss halfway through the write (see: RAID5 write hole)-- the old copy of the data (prior to the start of the write) is instead accessed when power comes back on.
- BTRFS: Raid1 (mirroring). BTRFS currently has nothing like RaidZ. Note that putting a BTRFS filesystem on top of a software mdadm RAID5 will not give you the same reliability and performance as RaidZ, since you will still have the random write hit of partial-stripe writes and will still have the RAID5 write hole where if a stripe update fails due to power loss halfway thru the stripe write, the entire stripe is corrupted.
- Portability
- ZFS: A ZFS filesystem can be read / written on: Linux (via either ZFS/Fuse or ZFSonLinux), FreeBSD, OpenIndiana, and MacOS (via Zevo). Requires extra 3rd party software to be installed on Linux and MacOS, comes standard with FreeBSD and OpenIndiana.
- Linux: Any recent Linux distribution (one with a 3.x vintage kernel) has BTRFS built in. Your BTRFS pools will be immediately available when you upgrade to a newer kernel or a newer Linux distribution, with no need to install any additional software. However, BTRFS doesn't run on any other OS.
- Stability
- On Linux, both BTRFS and ZFS are listed as "experimental". ZFSonLinux uses SEL (the Solaris Emulation Layer) as a "shim" between ZFS proper and Linux. Unfortunately this is sort of like nailing jello to a tree, while the underlying Linux block layer API hasn't changed in years, locking inside that block layer API has been in constant turmoil ever since the 2.6.30 timeframe as the last vestiges of the Big Kernel Lock were ferreted out and sent to the great bit bucket in the sky. The end result is that code that *used* to work may or may not cause deadlocks or strange races that cause an oops with current Linux kernels -- *UNLESS* it was developed as part of that current Linux kernel, as BTRFS is, in which case the person who changes the locks is responsible to make sure that all other kernel modules that are part of the next kernel release change their locks to match.
- Summary: On Linux, this is a tie. BTRFS is under rapid development. ZFS is attempting to nail jello to a tree from outside the Linux kernel. Use for production data of either system on Linux is not recommended. If you want a production server running a production-quality modern snapshotting filesystem, use ZFS on FreeBSD.
If you must use Linux, and you must have a modern snapshotting filesystem, and you can live with a RAID1 limitation on data redundancy, I would strongly recommend going with BTRFS. The reason for this is that BTRFS is only going to get better on Linux, while ZFS is always going to be fighting the nail-jello-to-a-tree issue where Linux keeps changing underneath it and breaking things in weird ways. Unless ZFS is included as part of the Linux kernel -- and Oracle's lawyers will never allow changing the license to GPL in order to allow that -- there simply is no way ZFS will ever achieve stability except with specific kernel versions shipped with specific distributions. And even there I'm dubious.
If you need the stability of ZFS, I strongly recommend using FreeBSD and not using Linux. I have personal experience dealing with the issues that come with supporting an emulation layer on top of the Linux block layer, including dealing with some deadlocks and races caused by locking changes inside recent kernels that caused a six-week delay in the release of an important product, and I honestly cannot say that any current ZFSonLinux implementation will continue to work with the next kernel revision. I can reliably say that BTRFS will work with the next kernel revision. While production servers don't change kernel revisions often, only once every three or four years, if the next version of the server OS doesn't happen to be one that is well supported by ZFSonLinux's then-current SEL implementation, you have problems.
So: Linux -- BTRFS. If you need the functionality of ZFS -- FreeBSD. Enough said on that.
Sunday, September 23, 2012
Crack-smoking Linux zealots
Okay, let me tell you a story. I installed Fedora 17 on a 64GB SSD to manage my RAID arrays that serve data to my home network. For grins and giggles I installed Thunderbird and told it about a couple of my email accounts. I clicked through on a link in one of those email accounts that went to a page that had a video embedded. Well, that *would* have a video embedded, on Windows or MacOS. On Linux? Just a blank box and a message about a plugin that simply doesn't exist for Linux that needs to be installed, probably a Quicktime plugin. Now I'm sure you're saying, "but that's not Linux's fault, that's Apple's fault for patenting the algorithm used for that plugin!" But see, the deal is, end users don't care whose fault it is. All they know is that they can't see that embedded video with Linux, and they can see it with Windows or MacOS. BTW, same applies to playing MP3 files -- they simply won't play. Again, a patent issue, but Joe Sixpack doesn't care why his music files won't play on his Linux system -- all he cares about is that they don't play on his Linux system. End of game.
Now let's look at another issue, one where the excuse of patents does not hold. The SSD came out of an old Asus Aspire One netbook, which I'd put it in as part of an attempt to build a mobile GPS system, one of a couple of failed attempts that eventually ended up successful with the iPad, thus rendering the need for an SSD in the Aspire One obsolete. So I grabbed an old 160GB hard drive to put into the Aspire One to take the place of the SSD, and imaged it using the rescue disks that I'd purchased to put an image onto the SSD in the first place. Except it didn't boot. Okay, no big deal, I'll just haul a Windows XP rescue disk over there ... err... I don't happen to have one burned? No biggie, I'll just burn one. And since I have my beautiful Linux desktop sitting here, I'll just use that to do so.
So I pop the blank CD/RW disk into the Asus SATA CD/DVD writer, and attempt to burn it using the stock Brasero disk burner... and it's utter fail. Won't do it. In fact, locks up the system for 30 seconds because it locks up the SATA bus while not doing it. What the BLEEP?! So I go check Google, and it looks like Brasero has been broken on Fedora FOR YEARS, it'll write DVD's (sometimes) but CD's? No way! So I try a couple of other programs, and have similar results. Then I go down to the underlying 'wodim' program and again the same results. At that point I'm, like, "okay, maybe it's broken CD recorder hardware". So I pull out an external USB CD recorder drive -- one that I recently used on another system that doesn't have an internal DVD-RW drive -- and attempt to use that. Same result.
So maybe it's a bad disk? So I sling the disk into my MacBook Pro, erase it, and record it. It Just Works. As would have been the case, I'm 99% certain, if I had been trying to do this under Windows 7 -- it would have Just Worked.
And lest you think this is just my physical chunk of hardware and the particular version of Linux here at home, I have similar (lack of) success recording CD-R's at work on my Centos 6.3 desktop system. There, again, I have to record CD's on my MacBook Pro because Linux simply refuses to do it. Which infuriates me, because I could write CD's for *years* under Linux, but it's broken now, and nobody seems to care (at least, it's been broken in every release of Fedora since Fedora 10, which was, what, four years ago? Five years ago?), so ...
So let's recap: I can't view videos, I can't play music, and I can't burn CD-R's. I *can* do all of those things on Windows or MacOS. What Linux does well is serving data to networks. It does that very well, my Linux box serves as the Time Machine backup for my MacBook Pro as well as being the central data repository for the various Windows laptops I have hanging around. But the desktop? When it can't do simple desktop tasks that Windows and MacOS have done for literally years? Crack. That's my only explanation for why anybody would ever make a ludicrous statement like "this is the year of desktop Linux!" given the current state of Linux.
-ELG
Wednesday, September 12, 2012
This is the droid you're looking for
So far it's mostly all good. Battery life is bad, but we already knew that. I tried several different home screen programs but I'm sticking with TouchWiz for now because the updated one for the Galaxy S3 works as well as anything else I tried, even the backported Jellybean launcher. It has lousy reception inside company HQ but so did the iPhone 4, just an AT&T thing I guess (my Verizon iPad has great reception inside company HQ). I'm still looking for a clean solution for automatically syncing my photos into iPhoto, but iSyncr is doing a reasonably good job of getting them onto my Macbook so I'm not too displeased.
Thus far I've found substitutes for everything I did on my iPhone except one: There is no good offline GPS program like the Magellan program that I used on the iPhone. Supposedly TomTom is going to be remedying that soon. We'll see.
So anyhow, I have found one bug in the Galaxy S3's ICS Android version: It does not handle exFAT very well. I found this out the hard way when my 64GB microSD card quit working and reported, "Damaged SD Card". Indeed, checking the Internet, it appears that random exFAT corruption is an epidemic on the Galaxy S3. This afflicts any microSD over 32GB, since Microsoft officially says FAT32 won't go over 32GB. This is, of course, a lie -- FAT32 is quite capable of handling terabyte-sized filesystems -- but because Microsoft enforces this limit in all their filesystem tools, nobody knew it was a lie until they actually looked at FAT32 and realized hey, this will work with bigger filesystems! (Though there is still that nasty 4GB limit on file size to contend with).
So how did I resolve this problem? First, I put the flash into a Windows 7 laptop and ran chkdisk on it. This found and fixed some problems. But when I put it back into the Galaxy S3 it *still* said "Damaged SD Card" despite the fact that Windows 7 said it was clean. So I resolved to reformat as FAT32. I copied the data off, and then had to go find a tool that would actually format a 64GB microSD card as FAT32 since the Windows disk manager won't do so: EaseUS Partition Master.
At that point it was just a matter of copying the data back on, which was very... very... slow since Windows operates SD cards in sync mode. As in, an hour slow. I know where the async flag lives in Windows and could have flipped it, but it was trash night so I did chores around the house instead. At the end of the process I inserted the microSD into the Sammy and... no more "Damaged SD Card".
Executive summary: If you buy a microSD card with greater than 32GB capacity, it is likely that it is formatted with Microsoft's proprietary exFAT filesystem and will not work well Android unless you reformat it, even if it appears to work correctly at first. exFAT support is not supported well because it is patented by Microsoft and thus does not have the magic of dozens of eyes of Open Source developers noticing and fixing bugs in it. So reformat it using the EaseUS tool above (NOT the internal Samsung formatter, it'll put the buggy exFAT filesystem back onto it) *before* you put stuff on it. Otherwise you'll be going through this whole time-consuming dance yourself sooner or later. Fun, it was not.
-ELG
Saturday, August 25, 2012
Windows 8 and taste
What brings this to mind is Windows 8, which I'm using to type this while eval'ing the RTM product. I'm not disclosing any NDA stuff here, it's pretty much the same product you downloaded earlier as the "Consumer Preview" with a few pieces of missing functionality filled in (and undoubtedly many bugs fixed). Windows 8 is Microsoft's attempt to re-invent the user interface, but fails primarily because of two reasons: A lack of courage, and a lack of that chief designer.
The lack of courage part is where Microsoft flinched at the notion of completely re-inventing the desktop. As a result, they have the "classic" desktop available by hitting a button on the "Modern" desktop. The end result is a bizarre mishmash of two different desktop environments in one, twice the amount of stuff to learn if you're a user because the "Classic" desktop environment doesn't *exactly* work the same as the well-known Windows 7 desktop environment, while the "Modern" desktop... well, it's entirely different, period. Twice the amount for end users to learn is user environment fail, period.
The lack of that chief designer, however, shows even more in the design of the "Modern" desktop. A good design is clean, looks simple (even if it isn't), everything's laid out in an obvious manner, there's a limited number of things for end users to learn in order to be productive, and, for lack of a better word, it is tasteful. It doesn't look like a mishmash of unrelated ideas from multiple independent teams all smashed together into one product.
That, however, doesn't describe the "Modern" desktop at all. One of the things I noted about Gnome 3 was that you had to basically know one gesture -- how to move your mouse pointer to the top left of the screen (or touch the top left of the screen on a touchscreen) -- to make it useful to you. Everything else is pretty obvious touch an icon or touch and drag an icon (or the click-on and click-on-and-drag with a mouse) or scroll up and down using the mouse wheel or two fingers. With the "Modern" desktop, every single corner of the screen does something -- and does something *different* (with the exception of the right-hand corners, which does something the *same*). Furthermore, moving to a corner, waiting for the hover timeout, then moving your mouse up and down does something even *different*. And right-clicking does something even *more* different. The confusing number of things you can do, indeed, need to know how to do to make the environment useful, are well past the three things you need to know how to do to use Gnome 3.
In essence, it's as if a bunch of geeks got together and decided to take every idea from every touchscreen environment ever created anywhere, and put them all into the same user interface. It's as if every geek critic of Gnome 3's tasteful design got together and designed their perfect touchscreen environment with every feature they could think of. It's as if Larry Wall designed the thing. Folks, Perl is many things, but clean and easy to use are not among those things -- it's an ugly, nasty, piece of work that will spit you in the eye if you look at it wrong just like the camel on the cover of the definitive book on the language. Like said camel it also happens to be very useful (thus why I wrote the virtualization management infrastructure for our virtualized product line in Perl, because it was the most reasonable way to parse the output of all the low-level virtualization-related utilities that the various virtualization systems use for their low-level management), but nobody has ever suggested that end users be given Perl as their user interface to their computers.
So the question is, will Windows 8 succeed? Well, define "success". The majority of personal computers in the world next year will ship with Windows 8 pre-installed. And because everything in post-Gates Microsoft is an API and Microsoft is quite open with their API's (Apple, not Microsoft, is the "Do Evil" company in the post-Gates era), sooner or later someone is going to come up with a means to tame this mess. But I have to say that Windows 8 is, in the end, a disappointment to me. Microsoft had an opportunity to re-define how personal computers worked, and they have all the pieces needed in Windows 8 to do so. They just needed a tasteful Chief Designer with the power to impose order and taste upon this mess -- and, alas, it appears they have no Jon Ives or Sergei Korolev to do so.
-ELG
Linux block layer, BTRFS, and ZFS On Linux
What I'm finding is that things are a bit of a mess in the 2.6.32 kernel when it comes to device pulls and device removals. When I chug down into the scsi midlayer I see that it's supposed to be completing all bios with -EIO, but there's still situations where when I yank a drive out of the chassis, I don't get all of my endios back with errors because of races in the kernel between device removal and device teardown. The net result is I have no idea what actually made it to disk or not. Note that you will NOT see this racy behavior on a normal system where the completion (almost) always wins the race, I was generating thousands of I/O's per second to 48 disks with CPU usage pretty much maxed out as part of load testing to see how things worked at the limits.
Now, that's no problem for my particular application, which is somewhat RAID-like, or for the Linux MD layer, or for single standalone block device filesystems for that matter. What's on the disk is on the disk, and when the standalone filesystem is remounted it'll know its state at that point by looking at the log. For the RAID type stacking drivers, when it comes back the RAID layer will note that its RAID superblock is out of data and rebuild the disk via mirror or ECC recovery, a somewhat slow process but the end result is a disk in known state. So when I get the disk removal event I mark the device as failed, quit accepting I/O for it, and mark all the work pending for that device that hasn't already endio'ed as errored, and if an endio sneaks in afterwards and tries to mark that work item again as errored, no big deal (although I put a check in the endio so that it simply noops if the work already was completed by the disk removal event). This means I have to keep a work pool around, but that's a good idea anyhow since otherwise I'd be thrashing kalloc/kfree, and if the drive comes back I'll re-use that pool again.
So traditional RAID and standalone devices don't have a problem here. Where a problem exists is with filesystems like btrfs and zfs that do replication on a per-file-block level rather than on a per-block-device-block level. If they can't log whether a block made it or not because they never got an endio, they can get confused. btrfs appears to err on the side of caution (i.e., assumes it didn't get replicated, and replicate it elsewhere if possible) but when the missing volume comes back and has that additional replica on it, strange things may happen. ZFSonLinux is even worse, since its SEL (Solaris Emulation Layer) appears to assume that bios always complete, and deadlocks waiting for bio's to complete rather than properly handle disk remove events. (Note that I haven't really gone digging into SEL, I'm basing this solely on observed behavior).
The good news: The popularity of btrfs among kernel developers appears to be motivating the Linux kernel team to fix this situation in newer kernels. I was chugging through the block subsystem in 3.5 to see if there was something that could be backported to make 2.6.32 behave a bit better here, and noticed some significant new functionality to make the block subsystem more flexible and robust. I didn't backport any of it because it was easier to just modify my kernel module to behave well with the default 2.6.32 behavior (I'm talking *extensive* changes in the block layer in recent kernels), but it appears that the end result is that btrfs on the 3.5 kernel should be *significantly* more reliable than the backported version of btrfs that Red Hat has put into their 2.6.32 kernel on RHEL 6.3.
So that's my recommendation: If you want to run btrfs right now, go with the latest kernel, whether it's on RHEL 6.3 or Fedora 17 or whatever. And you know the reason for my recommendation now. Red Hat has *not* backported any of those block layer changes back to RHEL 6.3, so what you have with btrfs on their stock 2.6.32 kernel is the equivalent of having a knight in shining armor that's missing the breast-plate. Sort of renders the whole exercise useless, in the end.
-ELG
Thursday, July 5, 2012
Open Source community and project failure
So anyhow, I was scoping out the tape format that we were going to use. I had a pile of tape hardware that filled an entire lab, and a pile of tape drive vendor's SCSI programming manuals that was stacked about four feet high on my desk. We had decided that we were going to keep the tape catalog in a MySQL or PostGreSQL database, but we also wanted a copy of the tape catalog on the tape itself so that tapes could be quickly re-imported into a new install of the software in the event, say, of the building burning down and the off-site backups needing to be pulled in on a new server. Without an on-tape copy of the catalog importing a tape would be a slow and painful process of reading the entire tape from front to back. The question was, where would we put the tape catalog? My boss said, "what about a partition at the beginning of the tape?" That seemed rather interesting, because usually once you start writing a tape, all you can do is either overwrite it, or append to the end of it -- you can't come back to the start and start writing again (this is because of the way the tape drives' internal compression works, amongst other things). Could we in fact do this?
So I investigated that, and found that the tape partitioning ioctl in Linux only worked with Seagate 4mm DAT tape drives. It didn't work with Exabyte drives, or Tandberg drives, or that brand new HP LTO drive, just with Seagate drives. I investigated the CDB that was being sent by the tape driver and looked at the Seagate manual, Exabyte manual, and Tandberg manual, as well as at the SCSI SMC standards document itself, and realized: That "standard" had enough holes to drive a bus through. There were basically two different ways you could interpret it, and Seagate interpreted it one way, and everybody else interpreted another way. I came up with a way of detecting in real time which partition CDB format that the tape drive used based on reading the partition table via the mode page for that, and modified the tape driver to do it correctly for every tape drive that implemented tape partitioning support -- every single SCSI drive, other than Quantum's DLT. Which, uhm, was the most popular enterprise drive. Oh well. So we didn't use tape partitions, instead we simply set a tape mark at the end of a data stream and appended the catalog to the end of the tape instead.
So anyhow, I contacted the maintainer of the Linux tape driver with my patch and an explanation of what it was doing and why the old way only worked with DDS and this would work for (long list), and he looked at it and he didn't like it, so he re-wrote it a slightly more elegant way and sent it back to me. I tried it out, it didn't work on one of the drives, I fixed one thing he'd slightly mis-interpreted and sent it back to him. I think we did a couple of iterations of this, and finally it passed both my tests for whether it actually worked on my tape drives, and his taste for what he wanted his tape driver code to look like, and it went into the next version of the Linux kernel that was released.
The other issue with tape format was that we wanted to be able to quickly retrieve a single file. It turned out that even the primitive DLT drives implemented both block location inquiry and block seek. Our archive format already aligned headers at the start of tape blocks so you could start seeking at the start of a tape block and locate the file, this wasn't a gzip'ed stream, we did things a bit smarter than that (we did something similar to what ZFS does when you turn on ZFS compression). So I hacked our data engine to issue a block position ioctl at the start of each file (and also print the file name and position) and hacked it to accept a block location and issue a block seek ioctl to find a file, as a proof of concept to verify that this would work. This worked fine on Linux and worked fine on SGI Irix. It did not work at all on Solaris -- Sun hadn't implemented *any* of the modern features of tape drives in their tape driver. We hacked our data engine to use the Solaris sgen (SCSI Generic) device directly (i.e. issue raw SCSI CDB's to read, write, seek, etc.) rather than use the tape driver, but never were satisfied with that and put that aside.
Then there was FreeBSD. I liked FreeBSD. I ran FreeBSD on my own server at home. I tried this on FreeBSD and writing tapes was very... very... slow when I had the 'print position' code enabled. Ridiculously slow. So I looked at the FreeBSD tape driver and realized what was happening. There was a call to cache flush right before issuing the position request CDB. This caused every tape drive in our lab to basically come to a screaming halt every time the ioctl happened. I commented out that single line of code, and everything worked at full speed on every single enterprise-class SCSI tape drive that was currently shipping to paying customers anywhere in the Western world. So I contacted the FreeBSD tape driver maintainer to remove this unnecessary cache flush, and...
"But the SCSI standard says that the reported tape position may not be accurate unless you issue the cache flush."
"We've tested every single enterprise drive currently shipping on the planet. They all stall and become unusably slow when you issue a cache flush anywhere but at the end of a dataset, and they all report the position accurately without the cache flush, we can go back to the reported position and always find the data we expected there."
"But... the SCSI standard..."
"Have you found any drive that actually complied with the SCSI standard? The fact is that the cache flush makes the ioctl useless because it makes it too slow, and every tape vendor seems to ignore that little note in the SCSI standard and just do what we expect." (Followed with performance data on actual drives with / without cache flush and noting that this worked properly *without* the cache flush on both Linux and Irix, neither of which had the cache flush in their tape position ioctl).
It went on and on and on. I was an interloper from outside their little community, so I had to be put into my place, despite the fact that all I wanted was for the stupid ioctl to Just Work, as it did on Linux and Irix, so that we could support FreeBSD as a Tier 1 platform rather than relegated to a Tier 2 platform (one which could not host tape drives but merely be backed up to another server that was hosting tape drives). Eventually after much grumbling about "well okay, it is wrong according to the SCSI standard but if that's how the tape drives actually work, we'll accept this change" they queued it up for a future release of FreeBSD, but by that time it was rather too late in the process -- we'd moved on to actually implementing our product, and FreeBSD wasn't scoped because there was no version of FreeBSD currently shipping that had the tape driver functionality we needed for our product.
Whenever I think about that difference between the Linux and FreeBSD communities in 2000, the reason Linux rules the world and FreeBSD has been relegated to a side note becomes a bit clearer. At the beginning, FreeBSD was clearly technically superior to Linux. For example, the FreeBSD scheduler could handle heavy loads without falling over, and the FreeBSD memory management system could handle heavy memory pressure without falling over, and neither was true of Linux in 2000. But the deal is, the world is not a meritocracy. The majority of the world will accept "Good Enough" if it means they don't have to put up with a lot of friction. The FreeBSD community in 2000, reeling from loss after loss to Linux with their biggest deployment (Hotmail) being converted to lowly Windows, was defensive and paranoid and not very pleasant to deal with (it's considerably better now BTW). Experienced IT people going into that environment and getting that kind of attitude simply rolled their eyes and went with that Linux thing, which was Good Enough for a lot of things even if it wasn't as good as FreeBSD.
So what are my takeways? Well, if you're involved in an Open Source community, whether as a code contributor, supporter, or just general advocate, here's my takeaways:
- Stowe the attitude. If you appear defensive and hostile, experienced IT folks simply won't use your stuff.
- If someone contacts you with a problem, and a proposed solution, don't dismiss them as an idiot until you actually evaluate the technical content of their message. If you don't agree with them, give technical reasons why their solution doesn't work, don't make personal attacks upon the person calling them an idiot or stupid or incompetent or whatever.
- If it's clear that someone is entirely off base, either reply "Thank you for your contribution, we will consider it" or simply hit the DEL key.
- Police your fanboys if they're trashing your mailing list or forums giving attitude to folks who have problems, suggestions, or contributions. One of the things that hindered uptake of Linux in that era was the Linux fanboyz with their "Linux rulez Windows drulez" attitude. IT people want to solve problems, they're not interested in penis measuring contests, and they're going to use the solution to their problem that comes with the least baggage. It doesn't matter whether your project really *is* the best or not, I repeat once more: The real world is not a meritocracy. If some other product is Good Enough, Just Works, and comes without the baggage, guess whose product is going to win?
And that's my takeaway. Sorry about the long history lesson, but there was a purpose in it -- and hopefully you've figured that out by now. So it goes.
-ELG
