One difference between DUP and RAID1 i can think off:
- If you have (like me) some SSDs that when not being used start to say that random sectors are not readable
- Then DUP can be PANIC, since one of that non readable sectors on the BTRFS partition header and BTRFS can not mount, read, etc. anything stored on it. While with RAID1 you mount the other (if there is not one of that non readable sectors on the other BTRFS partition header) and do a scrub to re-write non readable sectors.
- RAID1 implies two partitions each one with its header, so if one header got damaged (re-format partition), and the other partition header is correct, you can mount the other partition and acces on degraded mode and fix it (add another new partiton, delete the missing one, balance on RAID1 level)
Now my personal story with KingDian SSDs, that suffer form random non readable sectors after a long period of time (more than eigth days) without power; and how BTRFS RAID1 can come in save and let use such SSDs (until a collision on non readable sectors).
First i want to say thanks to BTRFS and its DUP (i will test it in a near future) and RAID1 (already tested with perfect results); it let me use my SSDs from brand KingDian. For brands Yucun and Samsung i do not yet see the "non readable sectors" problem that shows all three SSDs from brand KingDian.
I have in use a total of 11 SSDs, one KingDian died, so i only use now 10) and one KingDian 1TiB SSD that i am afraid to start using it (i was planing to use it in FAT32 or NTFS for TV playback my legally buy DVDs converted to H.264/2xAAC).
The problem with KingDian SSDs is really weird so i will tell what i do step by step to see the problem:
- Create a partition for only a 90% and format it, till some days ago i used Ext4 (Linux) / NTFS (Windows System partition); i really hate Windows but i am forced to used it.
- Install system on that partition
- Use the system every day --> No problem shown
- Power off and leave it of for more than eigth days --> Problem appears on KingDian SSs
- To see the problem i boot with a Live Linux distro (DVD / USB / etc), i mainly use SystemRescueCD, but any other that has "ntfsclone" / "partclone.*" / "partimage" or just a plain "dd" will serve
- I do a clone of the partition saving as a file (like saving system partition on BackUp media)
- The problem appear, there are some sectors (between a few upto near 25 or 30) that are not readable
- I take note (on a paper) what sectors are not readable
- Now the weird thing begins, i correctly power off and leave it off for another eigth or more days
- I repeat steps 4 to 7 to see what sectors are now not readable, the list changes a lot, most times both lists have no one in common, so all non readable sectors had become readable and others that were readable now are not readable
- I can repeat this a lot of times (with no write to the SSD at all) and all lists of non-readable sectors tend to not have any sector in common (among sometimes one is on two lists)
Why this SSDs (only with Brand KingDian) do such ugly and weird thing? randomly say some sectors are not readable after a long period (more than eigth days) without power supply, and after another period (more than eigth days) without power supply they became readable again.
The top weird is that after being non readable and then become readable again, they all allways have the correct data.
Also more, i consult SMART data and it says that there is no new reallocated sector (it has some because i once used on Windows a tool to force reallocation of non readable sector).
SMART info also says there is no read error, while some sectors are not readable, and also says there is no write error.
Obviously there is no "read" error, nothing "read" with "wrong" data... that is technically different to not been able to read... and SMART data has no field i can see that shows a non readable error count... etc.
By the way, if i re-write non readable sectors with data, they become readable again without any sector been re-mapped, maybe because the internal ones that are used are not the failing ones (remember SSD on writes uses different places to extend the live, SSD uses an internal map LBA - Real position inside chips).
By the way, cloning a partition with 30GiB of data on it and without that problem only took less than a minute (the SSD can read at 550MiB/s sustained while cloning the partition, aka, mostly secuential reads); but with 25 non readable sectors it took more than 24 hours (with ignoring such errors or else it does not end) and it will have some "corrupted" data (the one could not been read).
Here is where BTRFS cames in saving me:
- Firstly i was using two partitions in the same SSD on RAID1 level of BTRFS for DATA and METADATA
- Now i know about DUP instead of RAID1, i will test with DUP; and that will let me aboid running two clone partitions backup each time, just one; that would be great (it it works)
How it becames in saving me? Easy: Prior to do a clone to the BackUP media, i laund a scrub on what i want to clone so that non readable sectors will cause BTRFS to overwrite them with the other copy (hopping there is no non readable sector for both copies at the same time and same position).
With two partitions it worked fine (slow, but worked) and do not loose some sectors on the cloned data; now i must test with DUP on one partition instead of RAID1 on two identical size partitions.
It does not reduce the time to do the BackUP (also scrub takes its extra time), but at least i can be sure all data is correct... till one day two non readable sectors occur for the same data (colision) on the same position at the same time, that will be unrecoveable.
The other option is obvious: Not use at all any KingDian SSD anymore, taht are till now the only ones i had used that presents that problem (non readable sectors after long periors without power).
Imagine you go out on vacations, cut general power of the house, came back and your SSDs have non readable portions!!! Big problem for home user, not for datacenters where SSDs are allways powered.
Great BTRFS!!! Now think the other ugly part (for me), how to do something similar for the NTFS partition (windows system partition)? No way at all, NTFS has not that option (remember Windows HOME versions, not SERVERS, etc).
So thanks BTRFS, Linux is much better than i thought a few days ago... i am a Linux user since decades... but was refuse to try BTRFS because all BAD info about full corruption, etc.; till i encounter SSD problem and need something with redundancy.
The other option i was thinking of was ZFS, much more complicated, not integrated on GRUB2 bootloader, not integrated on Kernel (and maybe never will be because licensing system), etc.; so i fanally tried (yesterday) BTRFS... and what a surprise, it seems really stable, relative easy to use (warning when adding a ne disk, it adds it in RAID0, not RAID1, i do not use RAID5/6/etc nor want to use such), easy to recover from catastrofistic damage (re-format one of the two partitions) without data loose (on non KingDian SSDs), etc.
Of course i do not use sub-volumes, snapshots, etc... just only as a plain filesystem for Linux root "/" in RAID1; as i said i must test with DUP instead of RAID1, but i am afraid (i am a lot paranoid) i will stay with TWO partition on the same SSD on RAID1, since non-readable sector on partition header will imply all BTRFS not recoverable/readable.
If i can still se KingDian SSD among they present such randomly non readable sectors failire it would a money save, SSDs are not cheap since i only want to use single bit cell SSDs and that is really expensive, more as size increases (i say i am a lot paranoid), and have more than 10 off-line backup copies of all data with historic of more than one hundred last states (too paranoid, i know).