0

I want to use btrfs as filesystem on my server, and i am still research about it in all worst case condition.

Currently i want to test the raid system crash, the condition that i want to test is :

  1. if my disk broken, how to replace it
  2. if i can't replace it, how to save my data
  3. if accidentally i am (or my team) formated one of the disk, how to fix it
  4. if accidentally one of my disk stollen (i think this case not possible, just for the worst case condition), how to replace it

for all question i am writen above, i just can answer two of my question.

  1. answer number one is, i can use replace method before unplug the broken disk.
  2. answer number two, i can plug external harddrive, and then mounting it, and i can use restore method to save my data

for the other question, i failed to test it.

for question number 3 and 4(if i replace it with another disk), i tried to use mount -o degraded but i can't mount it it shows error wrong fs type, bad option, bad superblock on /dev/sdb. i am tried to rebalance it with balance method, but i can't mounting it.

please, i need answer to my question number 3 and 4.

yuda
  • 1,907
  • 3
  • 16
  • 23

1 Answers1

0
  1. The replace option needs to be done before the disk completely dies or else the replace operation won't work (and will likely screw up the array). If the disk is already unreadable, then yank it and mount with the degraded option. Add a new disk into the array and tell it to delete missing devices and it should sort it all out.

  2. If your array has redundancy on both data and metadata a single failed disk shouldn't cost you any of your data. If, for some reason, the array is corrupted and won't accept a replacement disk, you can use btrfs recover to copy as much as is recoverable out of the array and into a different storage system. Then rebuild the array.

  3. Formatting a disk is no different from having one go bad except you don't actually need a new physical disk. If your array is redundant, mount degraded, add the formatted disk back in, and delete missing. It should automatically rebalance the affected data. Running a scrub when you're done might also be wise.

  4. A stolen disk is the same as having one go bad. Mount degraded, add in a new one, and delete missing.

Your bad superblock issue is most likely caused by attempting to mount the disk that was formatted/replaced. Formatting will remove the BTRFS filesystem identifiers, so the system won't be able to detect the other drives in the array. Use one of the devices that's still a part of the array for the mount command and it should be able to detect the rest. If it doesn't, then probably your array was not in a consistent state before you removed/formatted the disk and there is insufficient redundancy to repair it. btrfs recover may be your only option at that point. Depending on circumstances you may need to run btrfs device scan to re-detect what devices are and are not part of the array.

Perkins
  • 121
  • 6