speeding up disk-based laptop by moving /usr to flash?

Tom Metro tmetro-blu-5a1Jt6qxUNc at public.gmane.org
Thu Dec 3 13:45:26 EST 2009


Brendan Kidwell wrote:
> I hadn't thought of that. ZFS looks nice, but it's not well supported on
> Linux yet.

I mentioned it just as an example. I wouldn't recommend ZFS for your 
application, as its current implementation as a FUSE driver on Linux 
would make using it for a boot disk somewhere between impractical and 
impossible.


> Lifehacker actually suggests mounting /dev/your-flash-memory as a secondary
> swap device. I don't see how that'll do any good unless you have far too
> little RAM.

Yeah, I don't see the logic in that either.


> Doesn't swap get cleared whenever you shut down, so you have no
> accumulated effect of keeping often-used objects in cache?

That would be my assumption. I haven't studied the Linux swap 
architecture, but I expect that it doesn't so much get cleared on 
reboot, but effectively overwritten. There are probably in-memory 
indexes for the data stored in swap, and if they're initialized, as 
would happen on reboot, swap is effectively empty.


As Mark pointed out, the kernel already caches the files read from the 
disk, and although it dynamically sizes that cache, there are probably 
settings you can tweak to force it to allocate more memory to that. The 
problem is that this cache wouldn't be persistent. Unless someone has a 
kernel patch to use a block device for the cache.


> I'd love it if I could find a good Linux based "ReadyBoost"-like
> flash-aware cache module.

Have you tried a web search on that term plus "linux?"

I'd be surprised if a project that accomplishes this doesn't already 
exist. There are similar projects used in the embedded space for doing 
things like layering a RAM disk over a Flash file system.

I'd also take a look a UnionFS, which might be able to do part of what 
you want. It has some ability to layer two file systems. You might be 
able to configure it to send writes to the HD, while reads come from the 
Flash, if the file is found, otherwise the HD. You'd have to code up 
your own tools to populate the Flash (for example, a script triggered by 
inotify that copies a requested file from the HD to the Flash in the 
background, so it is there for future use). You'd probably have to 
reinvent your own cache logic, which is messy and error prone, so not 
ideal. And I think UnionFS is also a FUSE driver, so you'd likely need 
to use it post-boot.

Or perhaps the simplest thing to do is to create a 16 GB partition on 
your HD (or whatever size matches your Flash), trim down your OS to fit 
within that, and set up a RAID 1 mirror between that partition and the 
Flash. The set of "cached" files will remain static and limited to 16 
GB, but it should be easy to set up, low risk, and usable during boot.

  -Tom

-- 
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/





More information about the Discuss mailing list