5

I am going to use (for now) btrfs on a couple of external USB HDD archives, in single-mode (no DUP, no RAID, no nothing; I will just keep it simple for now). So my idea is that I have two (manually copied) identical copies of an archive on two separate btrfs USB HDDs, one being the main where I change the archive and sometimes copy all the changed stuff to the other USB HDD.

The reason I want to use btrfs is merely that I can easily check at any time whether the all files on the main archive ok, and if not, I can copy those files back from the other HDD, manually. So I presume I will use btrfs scrub for finding the errors, and then e.g. Finding files with BTRFS Uncorrectable Errors to find which files have those errors and need to be replaced from the backup.

However, I also see there is a "btrfs check" command as well. Reading both scrub and check manual pages, it wasn't clear to me what the difference is and what their exact purpose is.

So if I just want to see whether my btrfs volume's files are ok with no errors and bitrot and corruption, am I supposed to run both check and scrub, or is mere scrub enough?

timppu
  • 115
  • 1
  • 8
  • 2
    [`btrfs check`](https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-check) seems to verify and optionally attempt repair of the structure of the filesystem. [`btrfs scrub`](https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub) verifies (and possibly repairs) the checksums of every data and metadata block. – rickhg12hs Oct 22 '20 at 19:47
  • So I gather then that both should be normally run, one after another? Probably check first... – timppu Oct 25 '20 at 16:09
  • I'm not sure either **directly** addresses your desire to insure each file is uncorrupted. Files are stored in blocks (checked by `scrub`) and blocks make up the structure of the btrfs filesystem (checked by `check`). I'm wondering why you don't want to configure btrfs to use some redundancy automatically (DUP, RAID) rather than doing it manually yourself. – rickhg12hs Oct 25 '20 at 16:16
  • Yes I have understood scrub does not tell directly which files are affected, only that there errors. However, I had a link in my question to how to find the affected files. I am not using DUP or RAID for now because then I would need more hard drives to keep the same amount of data and keep the same level of redundancy. For instance if I use DUP, then I can keep only half of my data on one hard drive, and divide my data between them. In that case I lose half of my data if either USB HDD gets broken or lost. OTOH if I use RAID, then I need to connect both hard drives if I need some files. – timppu Oct 27 '20 at 06:11
  • Also, I am not yet fully sure if I will use btrfs with both hard drives (archives). It depends how well WinBtrfs works ie. if I can at least read the archive files also in Windows. If not, I'll probably keep the secondary archive with NTFS, and the primary with BTRFS. Then I just from time to time "rsync -avzc --delete" everything from the primary BRTFS archive HDD to the secondary (NTFS or BTRFS) archive HDD, and use that on Windows. – timppu Oct 27 '20 at 06:23

1 Answers1

0

I think rickhg12s in the comments had the right answer:

"btrfs check seems to verify and optionally attempt repair of the structure of the filesystem. btrfs scrub verifies (and possibly repairs) the checksums of every data and metadata block."

timppu
  • 115
  • 1
  • 8