Check my build...

Status
Not open for further replies.

jenaflex

Cadet
Joined
Oct 27, 2013
Messages
3
So, I've seen many a noobies lose their zpools over this topic, so I'm going to go into detail. If you aren't detail oriented and don't want to understand what is going on deep level in ZFS, then just go with ECC RAM. For those of you that want to understand just how destructive non-ECC RAM can be, keep reading. Remember, ZFS itself functions entirely inside of system RAM. Normally your hardware RAID controller would do the same function as the ZFS code. And every hardware RAID controller you've ever used that has a cache has ECC cache. The simple reason: they know how important it is to not have a few bits that get stuck from trashing your entire array. The hardware RAID controller(just like ZFS) absolutely NEEDS to trust that the data in RAM is correct.

For those that don't want to read, just understand that ECC is one of the legs on your kitchen table, and you've removed that leg because you wanted to reuse old hardware that uses non-ECC RAM. Just buy ECC RAM and trust ZFS. Bad RAM is like your computer having dementia. And just like those old folks homes, you can't go ask them what they forgot. They don't remember, and neither will your computer.

What you need to get across is that I'm far less concerned about random cosmic radiation flipping a bit once and bad RAM leading to stuck bits and/or random bit flips due to the breakdown of insulation and/or conductors in your RAM.

I'm going to keep this relatively simple(haha), so here's some assumptions I've made and some explanation for them:

1. We're going to deal with a system that has a single bit error. A memory location is stuck at "1". Naturally more than a single bit error is going to cause more widespread corruption. For my examples I'm going to provide a hypothetical 8 bits of RAM. Bit number 2 will be stuck at "1". I will properly mark it with an underline and bold for bits that end up corrupted. Later I will move this location, but I will discuss that with you at that time.

2. Most servers have very little RAM used by the system processes and large amounts of RAM for the cache, so we're going to assume that the system runs stable without problems as the errors are most likely in the cache. Even if the system happens to run into the bad RAM location resulting in a crash, you are more than likely going to reset it and keep going until you realize after multiple crashes in a short period of time that something else is wrong. At that point, you're going to already be in the "omfg" territory where you are begging for forgiveness.

3. I'm going to ignore any potential corruption of the file system for my examples. Clearly corrupting the file system itself is VERY serious and can be fatal for your data. I will cover this topic at the very end of this discussion.

4. No additional corruption from any other subsystem or data path will occur. Obviously any additional corruption won't make things any easier.

5. What I am about to explain is a limitation of ZFS. This is not FreeNAS specific. It is ZFS specific.

Now on to some examples:

What happens when non-ECC RAM goes bad in a system for file systems that don't do their own parity and checksumming?

So pretend a file is loaded into RAM and then saved to an NTFS/ext4/UFS/whatever-file-system-you-want-that-doesn't-do-its-own-parity/checksumming.

The file is 8bits long. 00110011.

Since our file got stored in RAM, its been corrupted. Now its 01110011. Then that is forwarded to the disk subsystems and subsequently stored on the disk trashed. If this were file system data you might have bigger problems too. So now, despite what your destination is, a hard disk, an SSD, or a redundant array, the file will be saved wrong. No big deal except for that file. It might make the file unable to be opened in your favorite office suite or it might cause a momentary corruption of the image on your streaming video.


What happens when non-ECC RAM goes bad in a ZFS system?

So pretend that our same 8bit file is stored in RAM wrong.

Same file as above and same length: 00110011.

The file is loaded into RAM, and since its going to be stored on your ultra-safe zpool it goes to ZFS to be paritied and checksummed. So your RAIDZ2 zpool gets the file. But, here's the tricky part. The file is corrupted now thanks to your bad RAM location.

ZFS gets 01110011 and is told to safely store that in the pool. So it calculates parity data and checksums for the corrupted data. Then, this data is saved to the disk. Ok, not much worse than above since the file is trashed. But your parity and checksum isn't going to help you since those were made after the data was corrupted.

But, now things get messy. What happens when you read that data back? Let's pretend that the bad RAM location is moved relative to the file being loaded into RAM. Its off by 3 bits and move it to position 5. So now I read back the data:

Read from the disk: 01110011.

But what gets stored in RAM? 01111011.

Ok, no problem. ZFS will check against its parity. Oops, the parity failed since we have a new corrupted bit. Remember, the checksum data was calculated after the corruption from the first memory error occurred. So now the parity data is used to "repair" the bad data. So the data is "fixed" in RAM. Now it's supposed to be corrected to 01110011, right? But, since we have that bad 5th position, its still bad! Its corrected for potentially one clock cycle, but thanks to our bad RAM location its corrupted immediately again. So we really didn't "fix" anything. 01111011 is still in RAM. Now, since ZFS has detected corrupted data from a disk, its going to write the fix to the drive. Except its actually corrupting it even more because the repair didn't repair anything. So as you can see, things will only get worse as time goes on.

Now let's think about your backups.

If you use rsync, then rsync is going to backup the file in its corrupted form. But what if the file was correct and later corrupted? Well, thanks to rsync, you've actually synced the corrupted copy to your backups! Great job on those backups! Yes, that last sentence was sarcasm.

What about ZFS replication? Surely that's better, right? Well sort of. Thanks to those regular snapshots your server will happily replicate the corruption to your backup server. And lets not forget the added risk of corruption during replication because when the ZFS checksums are being calculated to be piped over SSH those might be corrupted too!

But we're really smart. We also do religious zpool scrubs. Well, guess what happens when you scrub the pool. As that stuck memory location is continually read and written to, zfs will attempt to "fix" corrupted data that it thinks is from your hard disk and write that data back. But instead it is actually reading good data from your drive, corrupting it in RAM, fixing it in RAM(which doesn't fix it as I've shown above), and then writing the "fixed" data to your disk. So you are literally trashing your entire pool while trying to do a scrub. So good job on being proactive with your zpool, you've trashed all of your data because you couldn't be bothered to buy appropriate server hardware. Yes, that last sentence was sarcasm again.

So in conclusion:

1. All that stuff about ZFS self-healing, that goes down the drain because you didn't use ECC RAM.
2. Your backups quite possibly will be trashed because of bad RAM. Based on forum users over the last 18 months, you've got almost no chance your backups will be safe by the time you realize your RAM is bad.
3. Scrubs are the best thing you can do for ZFS, but they can also be your worst enemy if you use bad RAM.
4. The parity data, checksums, and actual data need to all match. If not, then repairs start taking place. And what are you to do when you need to replace a disk and your parity data and actual data don't match because of corruption? You lose your data. So was ZFS really that much more reliable than a hardware RAID because you wanted to go with non-ECC RAM?

To protect your data from loss with ZFS, here's what you need to know:

1. Use ECC RAM. Period. If you don't like that answer, sorry. It's just a fundamental truth.
2. ZFS uses parity, checksums, mirrors, and the copies parameter to protect your data in various ways. Checksums prove that the data on the disk isn't corrupted, parity/mirrors/copies corrects those errors. As long as you have enough parity/mirrors/copies to fix any error that ever occurs, your data is 100% safe(again, assuming you are using ECC RAM). So running a RAIDZ1 is very dangerous because when one disk fails you have no more protection. During the long(and strenuous) task of resilvering your pool you run a very high risk of encountering errors on the remaining disks. So any error is detected, but not corrected. Let's hope that the error isn't in your file system where corruption could be fatal for your entire pool. In fact, about 90% of users that lose their data had a RAIDZ1 and suffered 2 disk failures.
3. If you run out of parity/mirrors and your pool is unmountable, you are in deep trouble. There are no recovery tools for ZFS, and quotes from data recovery specialists start in the 5 digit range. All those tools you've used in the past for recovery of desktop file systems, they don't work with ZFS. ZFS is nothing like any of those file systems, and recovery tools typically only find billions of 4k blocks of data that looks like fragments to a file. Good luck trying to reconstruct your files. Clearly it would be cheaper(and more reliable) to just make a backup, even if you have to build a second FreeNAS server. Let's not forget that if ZFS is corrupted just badly enough to be unmountable because of bad RAM, even if your files are mostly safe, you'll have to consider that 5 digit price tag too.
4. Usually, when RAM goes bad you will normally lose more than a single memory location. The corruption is usually a breakdown of the insulation between locations, so adjacent locations start getting trashed too. This only creates more multi-bit errors.
5. ZFS is designed to repair corruption and isn't designed to handle corruption that you can't correct. That's why there's no fsck/chkdsk for ZFS. So once you're at the point that ZFS' file structure is corrupted and you can't repair it because you have no redundancy, you are probably going to lose the pool(and the system will probably kernel panic).

So now that you're convinced that ECC really is that important, you can build a system with ECC for relatively cheap...

Motherboard: Supermicro X9SCM-F ($160ish)
CPU: Pentium G2020 ($60ish)
RAM: KVR16E11K4/32 32GB of DDR3-ECC-1600Mhz RAM($350ish)

So total cost is about $570. Less if you don't want to go to a full 32GB of RAM. If you went with a 2x8GB RAM stick kit you can get the total price down about $370. The G2020 is a great CPU for FreeNAS.

Of course, if you plan to use plugins like Plex that can be CPU intensive for transcoding you will need a little more power. Be wary of what CPUs do and don't support ECC. All Xeons do, and some i3s do. Check with Intels specification sheets to be sure before you spend the money. I use an E3-1230v2(about $250) and it is AMAZING! No matter what I throw at it I can't get more than about 30% CPU usage. Don't go by the TDP to try to pick the "greenest" CPU either. TDP is for full load heat output. That provides no information on what kind of power usage you will see when idle(which is what your system will probably be doing 99% of the time). My system with no disks installed and the system idle is at about 35w. Unfortunately I can't help with AMD CPUs since I'm not a fan of AMD. I do know that trying to go with "Green" CPUs for AMDs has disappointed many people here. "Green" CPUs perform slower than other CPUs, so be careful and don't buy a CPU that can't perform fast enough to make you happy.

The motherboard I listed above is ideal too. It has dual Intel Gb LAN, IPMI(never need a keyboard, mouse and monitor ever again!), and PCIe slots for that M1015 SAS controller you might want someday. I can't tell you how awesome IPMI is. But its basically remote desktop for your system. Except you can even use it during bootup. For example, you can go into your BIOS and change settings remotely! And you can mount CDs without a CD-ROM on the computer, remotely! How cool is that!? Add in the ability to remotely power on and off the server with IPMI and you have something for that server you want to shove in the corner and forget about.

ECC RAM can only detect and correct single bit errors. When you have multi-bit errors(if my experience is any indication) the system can detect(but not correct) those errors and immediately halts the system with a warning message on the screen with the bad memory location. Naturally, halting the system is bad as the system becomes unavailable. But its better to halt the system and let you remove the bad DIMM than to let your zpool get corrupted because of bad RAM. Remember, the whole goal is to protect your zpool and a system halt is the best bet once you've realized things are going badly in RAM.

List of victims if you don't want to believe all of this "hogwash".

http://forums.freenas.org/threads/freenas-crash-stuck-on-auto-import-volume.15816/



Hi, I am a newbie in FreeNAS in real practice. But I have some sorts background knowledge of general computer science stuffs because I have a electrical and computer engineering major.

I bought a surplus HP slim business desktop, not a workstation,
model name: hp dc5800s9
CPU: Intel Core 2 Duo CPU E4600 @ 2.40GHz
MB: Q33 (doesn't support ECC sadly)
Stock RAM: 2 x 1GB DDR2 800 NON-ECC
Stock HDD: WD 80 GB

New stuff has been purchased:
WD Red 2TB

Stuff plan to order:
1. APC BE 550G UPS
2. TP Link 1000m 8 port switch (because I don't want upgrade my wireless router now)

My Backup:
My primary Time Machine backup is on a 2.5inch Seagate Firewire 800 external 500GB, which is offline at most off the time and used for backup every week.
I am still a student in senior year and always backup my latest homework and projects on Dropbox. So far, I feel safe enough for now.
But I tend to forget to plug on my "offline" Time Machine External HDD occasionally, so I want to make my NAS a secondary Time Machine backup every day.

My main purpose:
1. Use this NAS as a secondary Time Machine backup for my Macbook Pro.
2. Use this NAS as a secondary and quicker access to my archive data. (I have "offline" backup for my archive data)
3. Use this NAS as a secondary backup for my photos.
4. Streaming iTune Music and Podcast to my Macbook and iPod (I don't care if I lose iTunes downloads, because my iTunes musics have another primary "offline" backup on anther USB external HDD)

My Question:
1. So far, did I have a good plan for data storage and backup for a student, sooner going to graduate school(I don't want to lose my thesis or paper or research stuffs! lol)
2. I have a dilemma of choosing UFS, or ZFS, or even another Linux-like NAS system using Ext3 or 4.

Using Linux-like Ext 3 or 4 is the easiest way to get data out if something goes wrong. I can simply find a Ubuntu computer in any computer lab and read my data out.
UFS seems to be the second easiest. I may be able to find access to use a Unix system to read my data out.
ZFS, I am a newbie to ZFS. It looks a "blackbox" to me!

So far I have limited budget - a couple hundred dollar. It seems to me I need to stick with my HP so far.

NON-ECC is BAD for ZFS with RAID, but What about ZFS with single disk mode (I guess, one stripe for my each disk - one 80GB, one 2TB).
Is NON-ECC not safe in my case?

3. If I have to use UFS, I want a separate AFP share with its directory for Time Machine Only. However, I can only see "\mnt\disk1" in "Add AFP Share: Path". Can I somehow make a directory, like "\mnt\disk1\timemachine", and use it for Time Machine only and make a directory , like "\mnt\disk1\sharedata" for data, and so on... I know about mkdir, but I am not so sure how to use it in my case.
 

jenaflex

Cadet
Joined
Oct 27, 2013
Messages
3
Don't fool yourself with that answer. I got into a discussion with iX over this when they posted a thread about their new "mini plus" on Amazon. The deleted the thread when I called them out on it.



^ That's the truth. If you want to gamble, feel free to stick with non-ECC. But don't be shocked when your RAM goes bad and you have a pool that won't mount. Just told someone the bad news 2 days ago. It's your risk vs reward.


Hi, cyberjock,

I was wondering if you can look up my case and help me to find a solution at #32.

Thank you.

Jenaflex
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I made your own thread since you were kind of going off-topic from the original thread...

ZFS, I am a newbie to ZFS. It looks a "blackbox" to me!
ZFS on linux is a possibility. But make sure it will work before you use it.

So far I have limited budget - a couple hundred dollar. It seems to me I need to stick with my HP so far.

NON-ECC is BAD for ZFS with RAID, but What about ZFS with single disk mode (I guess, one stripe for my each disk - one 80GB, one 2TB).
Is NON-ECC not safe in my case?

Non-ECC RAM is not really a good idea for servers at all. All of the data is at risk. ZFS even more so. I wouldn't be using non-ECC with ZFS in any configuration just based on the destruction for users that have had bad RAM with ZFS. It's kind of the anti-thesis of ZFS to want reliability, then choose components that don't really provide good reliability.

3. If I have to use UFS, I want a separate AFP share with its directory for Time Machine Only. However, I can only see "\mnt\disk1" in "Add AFP Share: Path". Can I somehow make a directory, like "\mnt\disk1\timemachine", and use it for Time Machine only and make a directory , like "\mnt\disk1\sharedata" for data, and so on... I know about mkdir, but I am not so sure how to use it in my case.

Sure, go to the command line in FreeNAS and make the directory. Then it'll be available in FreeNAS.
 

jenaflex

Cadet
Joined
Oct 27, 2013
Messages
3
I made your own thread since you were kind of going off-topic from the original thread...


ZFS on linux is a possibility. But make sure it will work before you use it.



Non-ECC RAM is not really a good idea for servers at all. All of the data is at risk. ZFS even more so. I wouldn't be using non-ECC with ZFS in any configuration just based on the destruction for users that have had bad RAM with ZFS. It's kind of the anti-thesis of ZFS to want reliability, then choose components that don't really provide good reliability.



Sure, go to the command line in FreeNAS and make the directory. Then it'll be available in FreeNAS.

Thank you. So, I am gonna go with UFS until I can afford better server.

In terms of make different directory, If I make different directory for different applications, such as Time Machine, FileShare, etc, they won't interfere each other? I am scared by the user guide of FreeNAS talking about that using same volume in ZFS for different application is problematic (because the manual is mainly for ZFS)
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You shouldn't share the same files with different protocols. Each protocol maintains its own file locks. For example, if you share out files with afp and CIFS(or any combination of protocols) you run the risk of corrupting those files if they happen to be opened by both protocols at the same time. Many OSes will open files without your permission, so don't assume that if you didn't double click the file it won't be opened.
 
Status
Not open for further replies.
Top