Using video memory as a ramdisk in Linux

An old idea hit me again recently: Why can’t you use the memory that’s sitting unused on your video card (unless you’re playing Doom) as a ramdisk? It turns out you can, just not if you’re using Windows. Some Linux people have been doing <a href=”http://hedera.linuxnews.pl/_news/2002/09/03/_long/1445.html”>it</a> for two years.<p>Where’d I get this loony idea? Commodore, that’s where. It was fairly common practice to use the video RAM dedicated to the C-128’s 80-column display for other purposes when you weren’t using it. As convoluted as PC video memory is, it had nothing on the C-128, where the 80-column video chip was a netherword accessible only via a handful of chip registers. Using the memory for anything else was slow, it was painful, but it was still a lot faster than Commodore’s floppy drives.<p>

So along comes someone on Slashdot, asking about using idle video memory as swap space. I really like the idea on principle: The memory isn’t doing anything, and RAM is at least an order of magnitude faster than disk, so even slow memory is going to give better performance.<p>

The principle goes like this: You use the Linux MTD module and point it at the video card’s memory in the PCI address space. The memory is now a block device, which you can format and put a filesystem on. Format it ext2 (who needs journaling on a ramdisk?), and you’ve got a ramdisk. Format it swap, and you’ve got swap space.<p>

The downside? Reads and writes don’t happen at the same speed with AGP. Since swap space needs to happen quickly both directions, this is a problem. It could work a lot better with older PCI video cards, but those of course are a lot less likely to have a useful amount of memory on them. It would also work a lot better on newer PCIe video cards, but of course if your system is new enough to have a PCIe card, it’s also likely to have huge amounts of system RAM.<p>

The other downside is that CPU usage tends to really jump while accessing the video RAM.<p>

If you happen to have a system that has fast access to its video RAM, there’s no reason not to try using it as swap space. On some systems it seems to work really well. On others it seems to work really poorly.<p>

If it’s too slow for swap space, try it as a ramdisk. Point your browser cache at it, or mount it as /tmp. It’s going to have lower latency than disk, guaranteed. The only question is the throughput. But if it’s handling large numbers of small files, latency matters more than throughput.<p>

And if you’re concerned about the quality of the memory chips on a video card being lower than the quality of the chips used on the motherboard, a concern some people on Slashdot expressed, using that memory as a ramdisk is safer than as a system file. If there’s slight corruption in the memory, the filesystem will report an error. Personally I’m not sure I buy that argument, since GPUs tend to be even more demanding on memory than CPUs are, and the consequences of using second-rate memory on a video card could be worse than just some stray blips on the screen. But if you’re a worry wart, using it for something less important than swap means you’re not risking a system crash by doing it.<p>

If you’re the type who likes to tinker, this could be a way to get some performance at no cost other than your time. Of course if you like to tinker and enjoy this kind of stuff anyway, your time is essentially free.<p>

And if you want to get really crazy, RAID your new ramdisk with a small partition on your hard drive to make it permanent. But that seems a little too out there even for me.

Need a cheap NAS? Grab this floppy and an old Pentium and you’ve got it

I wanted to build a small-as-possible Linux for the purpose of creating a lightweight NAS a few years back. I even downloaded the uclibc development tools and started compiling for the purpose of doing it. Then I got distracted.

I guess it doesn’t matter. I think NASLite had beaten me to the punch anyway.Here’s how it works. You download the appropriate floppy for the network type (SMB for Windows networks, NFS for Unix) and network card you have. You find an old PC. As long as it has PCI slots, it’ll work. Drop in the NIC if there isn’t one there already, and then drop in as many as four IDE hard drives. (The disk will reformat the drives if there’s anything there, so make sure they’re new or scratch drives beforehand.) If the BIOS doesn’t support the drives because they’re too big, disable them in the BIOS. Don’t worry, Linux controls the drives directly so you don’t need the BIOS. Boot off the floppy, and it joins the network and you’ve got a bunch of disk space for the cost of the drives and possibly the NIC.

Nice, huh?

This isn’t suitable for use in most corporate environments since it creates wide-open storage (it might work well as a big file dump, so long as people realize there’s no security there, but I’ve learned the hard way that users tend not to listen, or at least not remember, when they’re told such things). For home networks it’s fine, unless you’ve got wireless, in which case anyone who can get into your wireless network would also be able to get to your NAS.

Even then, it’s useful if what you want is a central repository for programs like Irfanview and Mozilla Firefox that you install on all your PCs and want to keep handy.

At any rate, if you’re creative and careful and have a Linux box and know how to use the dd command (or have a fairly up-to-date copy of WinImage) to copy a 1.72-meg disk image to a floppy, this is a useful tool for you.

Dvorak’s PC Magazine Linux column: Crazy or Clueless? Clueless.

Linux zealots are arguing over whether Dvorak‘s latest in PC Magazine is stupid or crazy.

I won’t call it stupid. But it’s ignorant.

Linux doesn’t need Windows’ plug and play layer. When it comes to low-level devices, like SCSI and IDE chipsets, network cards, and stuff like that, Linux actually puts Windows to shame. I can take a hard drive out of a Linux box, put it in a completely different machine–different NIC, different SCSI card, everything–and have it up and responding on the network in five minutes flat.

Now, sound cards can sometimes give Linux some troubles. But those devices have historically been problematic under every OS. I was pretty sure I had a five-year-old war story about my battles with an Avance Logic sound card under Windows here somewhere, but maybe that was on my first site. Some cards won’t work in Linux without divine intervention. Others won’t work in Windows without said intervention. It’s irritating when it happens, but it happens. It doesn’t mean the operating system is worthless, but it might mean the card is.

Video is sometimes a headache. But that’s not a problem with the Linux kernel. That’s the XFree86 or the X.org guys, depending on the distribution. And this is where Dvorak’s argument falls apart. You see, what Dvorak is calling a “video driver” looks a lot more like an application than a driver, on the system level.

You need more than a driver to get a GUI. You need an API. Plugging the Windows drivers into the Linux kernel doesn’t give you the X Window API. I suppose Microsoft could provide the Windows API, but what good would that do? None of the graphical Linux software would run on it. Microsoft would have to write its own X server. They could do it–others have–but what’s the point? Where’s the benefit? It’s a lot more work than just kludging the Windows Plug and Play layer to run with the Linux kernel.

So, basically, Dvorak’s editorial proves he doesn’t really know how Linux is put together, on the system level. It’s nice theory for CIOs to talk about while they wait for their turn at the tee on the golf course. But it won’t play out in the real world, because it’s just not that easy.

Freesco still works as a router/firewall in a pinch

I set up a Freesco box over the weekend. It makes less sense now that router/switch/firewall combos from the likes of Linksys sell for $50 than it did when they sold for $200, but if you’re long on unused PCs and short on cash, it still works.

My old walkthrough no longer applies directly to the current version 33, but if you’re reasonably technically competent it should get you on your way.As far as what hardware to use, I had a Kingston 10 megabit (NE2000 clone) PCI card and a D-Link card based on a Realtek 8139 chipset. They worked fabulously. The 8139 is a workhorse; networking guru Donald Becker blasted it in print–it’s the only chipset I think he’s ever said anything bad about–but until you start routing between a 100-megabit network and a gigabit network you probably won’t notice, especially if you’re using a 200+ MHz machine as your router, which in these days of $30 Pentium II PCs, is likely.

All you need is a computer with 8 megs of RAM, two NICs, and a floppy drive. To make it easier on yourself, make sure it has PCI slots, use two PCI NICs, and and 16 megs of RAM or more. Since 32-meg sticks are useless to most people these days, they’re cheap.

I suspect that if you have a pile of unused hardware that you’re looking to turn into a router, chances are decent you have a pile of network cards in that stash. Try a few different PCI cards. Life sometimes goes a bit easier if the two cards have different chipsets on them, but it’s not usually necessary to mix it up.

Give yourself a time limit. Mess around with it for an hour. If you get frustrated after an hour, go out and buy a Linksys or a D-Link or a Netgear. If you don’t have it working after an hour but you’re fascinated and you’re learning a lot, then keep plugging away at it. The knowledge you’re gaining is worth more than 50 bucks.

A Linux-based GPL\’ed disk partition table recovery program

It seems like I’m recommending the program MBRwork to someone at least once a month. I recommended it two or three times just last week. But there are a couple of things I don’t like about it. One, it’s DOS. Creating DOS boot floppies isn’t as easy as it used to be. And two, it’s proprietary, so it could theoretically disappear any minute.

But similar tools exist for Linux.The most highly regarded is gpart (guess partition), which just happens to be included on the BG-Rescue Linux two-floppy rescue system. Download BG-Rescue Linux and burn the ISO image to a CD, or download the two-floppy version and write it to two floppies, and keep it in your toolbox. Or, of course, they’re on Knoppix.

When a partition table vanishes, or, a more likely scenario, a system quits booting mysteriously, you can boot BG-Rescue Linux and run gpart. You can also check FAT/FAT32 filesystems with dosfsck and NTFS partitions with ntfsfix.

Need to undelete some files in an emergency? You can even undelete files from NTFS partitions with ntfsundelete.

Clearly, skills with a handful of Unix utilities are very useful even in a strictly Windows shop.

Looks like I should explore these tools a bit more in-depth this week.

Lean, mean Linux

LinuxToday linked to a story today about Building a lo-fat Linux desktop. Basically it’s a list of applications you can run on a 233 MHz machine without feeling like you’re standing in line at the bank.

Most of the apps are things I’ve mentioned here before, but never in one place, at least not as a list of apps that run superfast. The closest I ever came was that last link. So I’m glad someone else did.

One nice thing: That last link was from 2002. Two and a half years-plus later, not much has changed. I think that’s good. It means things are stable.

Here’s a general principle to follow: KDE gives a nice, integrated environment and lots of apps that play well together, but the price is overhead. If you want something that reminds you of Windows and a Mac, run KDE. But don’t complain if Linux is slow on anything less than a cutting-edge machine, because it will be.

If you’ve heard that Linux runs fast even on ancient hardware and you want to live up to that expectation, Gnome apps are faster.

Sylpheed is a nice e-mail client if what you need is an e-mail client and not an all-out PIM. When I’m running Linux it’s what I like to use.

Dillo is a minimalist web browser. That has its advantages. Popups? Flash? Blinky ads? What are those? It’s a great choice for slower machines, and even for fast machines if what you’re wanting to do is get the information on the web without distractions and then get out.

Icewm is my default desktop no matter what machine I’m running. If I had a quad-CPU 3.4 GHz P4, I’d still run Icewm.

I haven’t used a newsreader since Google bought Dejanews, but back when I frequented newsgroups and ran my own client, Pan was tops. Pan did things that the for-pay newsreaders like Microplanet Gravity wouldn’t do. And that was something like five years ago. I’m sure it’s better now. Not only was it full-featured, it was fast.

I hadn’t heard of the picture viewers the article mentions. I’m not sure that I have a picture viewer installed on my current Linux desktop. I guess I just haven’t needed one. Hmm. But as I recall, GTKSee was reasonably quick, and its user interface was familiar, since ACDSee is a very popular program.

As far as links to the apps, I don’t provide them because you’ll need packages specific to your distribution, assuming your distribution didn’t already come with them (which it may very well have). Do a Google search on the app name and your distribution–“Sylpheed Mandrake” “Sylpheed Fedora” or what have you.

It’s a good article that I recommend reading, as is the follow-up, linked at the bottom.

Setting the MTU automatically in Debian

I run this website off a server running on an ADSL line in a spare bedroom of my home. That causes some weird issues from time to time, like the time I had to figure out setting the MTU automatically in Debian.

Why Debian?

My server of choice is Debian, because it’s Linux which makes it fast, reliable, and cheap, and Debian makes it pretty easy to install only what you want and need, so I can have a server OS that’s only using 125 megabytes of disk space, leaving most of my drive available for content. I like having space for content.

This will work in Debian-derived systems like Ubuntu and Linux Mint too.

PPPoE issues

Now, the downside of modern DSL: Southwestern Bell, like most ISPs these days, uses PPPoE. So not only can your IP address change with no notice whatsoever, you also have the hassles of PPPoE. With the default settings, some unknown but noticeably large percentage of web users won’t be able to access a web server running on a DSL connection using PPPoE.

The reason is MTU and fragmentation.Yes, you remember MTU if you used Windows 9x back in the bad old days of dialup. Tweakers would play around with the MTU settings in hopes of squeezing just a little more performance out of their 56K modems, and they would swear that one utility did a better job than any others, or that this MTU setting was optimal and the conventional wisdom of 576 stank… Remember those flamewars?

Well, with broadband, theoretically the right setting to use is 1500. Trouble is, PPPoE steals some of that packet space, and the result is something worse than slow speeds. In some scenarios, you completely vanish.

Setting the MTU

The way to make my website reappear is to issue the command ifconfig eth0 mtu 1472. The exact number doesn’t seem to matter much. It appears for me that 1472 is the maximum I can use. (It can vary from ISP to ISP, in case you’re wondering.)

Excellent. Problem solved.

Not so fast. Problem solved until my server reboots. Linux doesn’t need to reboot, right? Right you are. But here in St. Louis, the power likes to hiccup a lot, especially in the summertime. My server is on a UPS, but every once in a while, in the middle of the night, there must be a long enough power failure that my UPS dies, because every once in a while I fall off the ‘net again.

To set the default MTU permanently–that is, to change it automatically on bootup–one normally would change the ifup script or the rc.startup script. Except Debian doesn’t have either of those.

My kludgy solution: cron. Log in as root, issue the command crontab -e, and add the following line:

*/2 * * * * ifconfig eth0 mtu 1472

With this in place, only seconds will elapse between the time my power comes back on for good and I reappear on the ‘net. I can live with that.

More Debian tricks

If you change your network card or motherboard, you don’t have to reinstall Debian but you may lose eth0. Here’s how to get eth0 back. And here’s how to get a list of the installed packages in Debian.

Scribus isn\’t a bad open-source DTP program

A Slashdot mention of a MadPenguin review of Scribus brought up a very insightful lament: No reviews of Scribus appear online from someone very familiar with the competition, namely Adobe PageMaker and InDesign, and QuarkXPress.

As a University of Missouri journalism graduate, I’m going to tell you what I think of Scribus and simultaneously try to amuse you.Let me first get something out of the way: Microsoft Publisher is a toy. And I mean “toy” in the most condescending manner possible. I’m not talking a charming vintage toy that brings good feelings of quality and nostalgia. No sir, I’m bringing to mind cheap, mass-produced junk from a factory that makes its workers pay to work there, sold in vending machines in seedy-looking stores in seedy neighborhoods.

And I’m not talking the nice vending machines that take two quarters either.

I’ve been forced to do production work in Microsoft Publisher. I wish they’d just gone all the way and handed me a copy of Print Shop and told me to use that. At least Print Shop doesn’t have any delusions of grandeur.

I didn’t go to the best journalism school in the country and endure classes taught by professors with nicknames like “The Nazi”–I took a class from the instructor who inspired Brad Pitt to drop out of journalism school and run away to Hollywood when he was a mere three hours from a journalism degree, and I endured her class and I passed it, but I do have to say I don’t blame him–I’m sure I lost your train of thought there, but I didn’t endure all of that to have my hand held by a misguided wizard that looks like a #^%@$ paperclip.

There. I feel a lot better now.

Wait. Let me say one more thing. Microsoft Publisher isn’t the competition for this program, nor should it be.

The proper introduction to desktop publishing is Adobe PageMaker. It’s the easiest to learn of the “serious” DTP tools, and while it’s not well suited to particularly complex designs, and quite possibly the buggiest piece of software not manufactured by Microsoft that I’ve ever had the displeasure of dealing with, it does the best job of teaching people how to throw a bunch of text into columns onto a piece of paper without overwhelming them with too many tools.

But QuarkXPress is king. At Mizzou, once we’d learned QuarkXPress, we j-students were known to ditch word processors entirely and just use XPress for everything because of its enormous text-handling capabilities. And in spite of its features, it’s a much leaner, meaner program than any word processor on the market, taking up less memory, loading faster, and generally doing everything else faster. I even used it to write term papers for my history classes. I hate Quark the company, but I’ll tell you how I feel about its product.

Rolls-Royce tries to be the QuarkXPress of cars.

(I couldn’t tell you if Rolls-Royce ever succeeded or not, having never ridden in one of its cars.)

OK, so what about Scribus?

Well, you already know my bias. From an ease of use standpoint, I found it somewhere between PageMaker and QuarkXPress. That’s not necessarily a bad thing. Ease of use has never been the goal of this type of software. Frankly I don’t know how you make a program of this type any easier to use without dumbing it down to Publisher’s level, and by the time you do that, you might as well just go all the way and create a Print Shop clone. That way you’ve actually created something useful.

Concentrating too much on making DTP software easy to use is like trying to make a chainsaw that’s incapable of injuring the operator. The end result isn’t going to be very useful.

But I’ve digressed again.

Feature-wise, I’ve found it to be at least the equal of PageMaker. Whether it lacks some of the features of QuarkXPress or I wasn’t able to quickly find them, I’m not sure. So while I wasn’t able to quickly figure out how to make it bend and distort text, it took me about 30 seconds to figure out how to do the really important things like scaling text and changing tracking and leading.

I wasn’t able to work as quickly in Scribus as I could in QXP, but that’s not a fair comparison. For a semester I spent more time in QXP than I spent in Word, if that tells you anything.

I also spent more time in QXP than I spent in Civilization and Railroad Tycoon combined. (Not by choice though. Yes I’m crazy, but not that crazy.)

I guess I should come to a conclusion here.

I’m really glad to see Scribus. I think it’s pretty good stuff. I think it’s really incredibly good stuff for the price. You see, QuarkXPress is priced like a Rolls-Royce. Scribus is free.

Better than Publisher? Of course. Then again, so is a trip to the dentist.

Better than PageMaker? I’m inclined to say yes. Better enough that if both programs cost the same amount of money, I’d buy Scribus.

Will I use Scribus again? You bet.

I can’t wait to see what they come up with for version 2.0.

Suddenly I wish I could buy Mopar spark plugs at Autozone

The most evil of evil software companies, SCO, has finally made good on its threats to sue a big Linux user, filing harrassing lawsuits against AutoZone and DaimlerChrysler.

Of course, SCO has yet to prove it even owns the copyrights it claims it owns, not to mention it voided any claims it might have by distributing Linux under the GPL. But that doesn’t seem to stop them from filing frivolous lawsuits.

The enemy of your enemy is your friend. Support freedom by shopping at AutoZone, or if you don’t have an AutoZone, buy anything Mopar that happens to fit your car, such as spark plugs and oil filters.

Munich\’s unexpected migration costs prove nothing so far

I saw an article in the Toronto Star in which Steve Ballmer was, um, well, talking gleefully about the city of Munich’s highly publicized and controversial migration to Linux, server to desktop, costing more money than expected.

So I suppose Mr. Ballmer is prepared to reimburse one of my clients for its unexpected expenses in migrating from VMS to Windows then, eh?

Yeah, that’s what I thought.I wouldn’t call myself a migration specialist, per se, but it seems that during my career, just as often as not I’ve been involved in projects that are migrations to something or other, and more often than not, they’ve been migrations to Windows. I helped one of the first OS/2 networks outside of IBM itself migrate to Windows NT. I helped lots of smaller clients migrate from various versions of Mac OS to Windows NT. I’ve done a couple of small projects that migrated something Windows- or VMS-based to Linux. Last year I helped a client migrate from VMS to Windows 2003. Right now I’m working on a project that migrates another client from VMS to Windows 2000/2003.

I’m not trying to prove that I’m a migration expert, but I do think I’ve learned a few things along the way. And one of the first things I learned is that if you’re trying to migrate in order to save money right away, you’re migrating for the wrong reason and your project is probably going to fail very quickly. It’s very hard for a migration to save you that much money that quickly, and if it does, then that means its predecessor was so broken that somebody ought to be fired for not replacing it five years earlier.

The other thing I’ve learned is that a migration always always has unexpected costs, for a very simple reason. It’s impossible to know everything that’s going on on your network. I don’t know everything that’s going on on my home network, and most of the time, I’m the only one using it.

You might say I’m scatterbrained. I say you might be right. But let me give you an example from a network other than mine. In my first job, they decommissioned DOS-based WordPerfect years before I was born started working there. But since the system didn’t prevent people from installing software, people just smuggled in their copies of WordPerfect from home, installed it, and went right on using it, creating new data. Then I came along to migrate them to Windows NT, and they planned the same charade all over again. Only this time, they weren’t able to install their copy of WordPerfect. When told it was illegal to install and we weren’t going to do it, they said they needed that data in order to do their job.

That, my friend, is an unexpected expense.

The city of Munich undoubtedly has data in obsolete formats, being used every day by people, without anyone else knowing about it. I have a client still running something they rely on every day in dBASE II. Yes, TWO! Yes, when the account manager told me that, I made a joke about CP/M. For those of you who haven’t been around that long, dBASE II was obsoleted more than 20 years ago, although some people continued to use it after it was replaced by dBASE III. Some longer than others, it seems…

In this line of work, you find weird stuff. I know weird stuff is attracted to me, but I know I’m not the only one who finds this.

And weird stuff like that, my friend, can sometimes be an unexpected major expense.

The unexpected expenses my current client paid in its current migration paid for me to have a box full of my dad’s old Lionel trains fixed up better than new, and then to buy a bunch of new stuff. Trust me, it wasn’t cheap. And trust me, only a percentage of what my employer got trickled down to me.

I’m sure the city of Munich went into this knowing some or all of this. I’m also sure this wasn’t about money, even though Microsoft is gloating about money now.

What Steve Ballmer wants everyone to forget is that Microsoft came in with the lowest bid. Maybe not initially, but in the end they did. And Munich went with a Linux-based solution anyway.

Why? I’ll tell you why. New Microsoft Office releases every two years. New versions of operating systems every three to four years. New bloatware service packs that guarantee you’ll have to replace your hardware every three years, released every year. Annual antivirus subscription rates. Lost productivity when a virus slips through the cracks anyway. Lost productivity when spyware breaks some required business app.

MCSEs work cheap, and the software is inexpensive at first. But you get nickled and dimed to death.

Linux is more costly than expected this year. But the next four years will be less expensive than anticipated.

And Munich may be betting on that.