Monday, October 26, 2009

SDcards and ZFS

I've gotten this question a few times. "Would SDcards make a good ZIL device?" "Would SDcards make good ZFS devices?" The answer to both is resoundingly no.

The reason for this is simple, and is the same reason you should never reformat SDcard media using your computer.

It boils down to the fact that you need to do some very "SDcard" specific optimizations when you layout your filesystems in order to get good performance. (The details for this are only available after signing an NDA with the SDcard trade association, btw.) Of course, general purpose computers use general purpose filesystem code, which is targetted for hard disks. So the optimizations, if there are any, are all wrong for SDcard media. (Note that this only matters when doing the initial filesystem layout .... i.e. when you are formatting the media.)

You can reclaim at least some of the performance you might have lost if you've made this mistake, by reformatting the media in your camera. But unless you have a much fancier camera than I do, your camera probably doesn't speak ZFS.

6 comments:

LeftWing said...

What about a file-backed slog on an SDcard as formatted by the manufacturer?

Garrett D'Amore said...

That's an interesting idea.... it might work. I've not tested it.

There is another issue though... in order to get any benefit, you have to beat the hard disk. SDcard has a theoretical maximum of 25 MB/sec (50 MHz, 4-bit wide bus.) In practice most SDcards max out for read performance between 10 and 15 MB/sec. (I've not tried some of the most expensive high end cards that might be faster.)

Write performance is usually significantly worse for SD card media.

Most hard drives can significantly outperform SDcard, so I don't think it makes sense to try to use this as any kind of accelerator for ZFS.

Doug said...

I had given some thought to using and SDcard as a root device with ZFS. Performance wouldn't have been a concern since there wouldn't be much in the way of writes for the application I was looking at (an embedded system). Then I found that you can't boot with ZFS on removable media due to the drivers not setting up the deviceID.

Watkins said...

I'm going to try it on Open Pandora for non-root filesystem. If it's a choice between ext4 on SD versus ZFS on SD, I'm guessing ZFS is going to win as it's more efficient. Not sure how well it would work with limited RAM and storage though, we'll see...

Watkins said...

I'm going to try it on Open Pandora for non-root filesystem. If it's a choice between ext4 on SD versus ZFS on SD, I'm guessing ZFS is going to win as it's more efficient. Not sure how well it would work with limited RAM and storage though, we'll see...

Stefano Rossi said...

I was wondering, would it be a good idea to use ZFS on a SDXC card, to have the checksumming features of ZFS, for low-cost backup purposes? And what do you think of having two SD cards in "RAID", to be able to recover the data in case of a card becoming corrupted?