Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Preclear vs Badblocks?

Featured Replies

I am about to add a new HDD, now I have been reading up about adding a HDD to my existing unRAID setup.

It seems recommended to run the Preclear script (via the GUI Plugin) in before, so that unRAID doesn't have to do this itself and keep the array offline for that period.

 

Now, I used to run my HDD's through Badblocks (https://wiki.archlinux.org/index.php/badblocks), is Preclear the same thing?

 

Thanks in advance.

 

Cheers,

Arndroid

 

  • Community Expert

Preclear clears a disk (sets it to all zeros) so it won't affect parity. Preclear also sets a "clear signature" on the disk so unRAID will know the disk is clear.

 

When adding a data drive to a new slot in an array that already has valid parity, the disk must be clear so parity will remain valid. That is the only scenario where a drive must be clear, and if you are in that scenario and haven't precleared the disk, unRAID will clear it. If using a version of unRAID before 6.2 (still RC) then it will take your array offline while it clears it. V6.2 does the clear while leaving the array online.

 

Even when you are not in that scenario, many use preclear as a thorough test of a drive before trusting it in their array. All bits of all disks must be trustworthy because all bits of all disks are needed to rebuild if one of them fails.

 

If you don't require a clear disk, then another testing method, such as badblocks, could be used. Also, the drive manufacturer usually has some utility that you can use to do the testing on another computer such as Windows.

  • Author

Ah cool, I ordered a brand new HDD, so I'll just only run it trough the default badblocks test (writing and reading 11111111, 10101010, 01010101 and finally 00000000 (like Preclear)).

Only after badblocks I trust the HDD, Preclear alone wouldn't even cut it, it seems.

 

Thanks for the info!

 

  • Community Expert

Ah cool, I ordered a brand new HDD, so I'll just only run it trough the default badblocks test (writing and reading 11111111, 10101010, 01010101 and finally 00000000 (like Preclear)).

Only after badblocks I trust the HDD, Preclear alone wouldn't even cut it, it seems.

 

Thanks for the info!

Note that badblocks will not set the "Clear signature", so even if you use badblocks to set the disk to all zeros, unRAID will not recognize it as a clear disk. Then if you add it to a new slot in an array that already has valid parity, unRAID will want to clear it anyway.

 

And preclear does do some pretty good testing besides just setting it to all zeros and writing the clear signature. Preclear by default reads all of the disk to make sure it can be read, writes zeros to all of the disk to make sure it can be written, then reads all of the disk again to make sure the zeros all got written and can be read.

 

There are options to preclear that will allow it to skip some of this. If you want to use badblocks, you might still do the preclear to just write all zeros and set the clear signature instead of that last pass with badblocks to set all zeros, if you are in the scenario that requires a clear disk.

Ah cool, I ordered a brand new HDD, so I'll just only run it trough the default badblocks test (writing and reading 11111111, 10101010, 01010101 and finally 00000000 (like Preclear)).

Only after badblocks I trust the HDD, Preclear alone wouldn't even cut it, it seems.

 

Thanks for the info!

Note that badblocks will not set the "Clear signature", so even if you use badblocks to set the disk to all zeros, unRAID will not recognize it as a clear disk. Then if you add it to a new slot in an array that already has valid parity, unRAID will want to clear it anyway.

 

And preclear does do some pretty good testing besides just setting it to all zeros and writing the clear signature. Preclear by default reads all of the disk to make sure it can be read, writes zeros to all of the disk to make sure it can be written, then reads all of the disk again to make sure the zeros all got written and can be read.

 

There are options to preclear that will allow it to skip some of this. If you want to use badblocks, you might still do the preclear to just write all zeros and set the clear signature instead of that last pass with badblocks to set all zeros, if you are in the scenario that requires a clear disk.

 

Badblocks is an outdated tool, IMHO. The main use for badblocks was (a long time ago) scan disk surface and output all bad sectors to a file, and then read that file while formatting the disk, so the filesystem was aware of which blocks to blacklist.

 

Note that nowadays all surface scanning and block blacklist control is done by the disk drive firmware, and if an error is recoverable, it's transparent to the OS. Because of that, you can have a successful badblocks scan while loads of sectors are being reallocated in the background.

  • Author

Ah cool, I ordered a brand new HDD, so I'll just only run it trough the default badblocks test (writing and reading 11111111, 10101010, 01010101 and finally 00000000 (like Preclear)).

Only after badblocks I trust the HDD, Preclear alone wouldn't even cut it, it seems.

 

Thanks for the info!

Note that badblocks will not set the "Clear signature", so even if you use badblocks to set the disk to all zeros, unRAID will not recognize it as a clear disk. Then if you add it to a new slot in an array that already has valid parity, unRAID will want to clear it anyway.

 

And preclear does do some pretty good testing besides just setting it to all zeros and writing the clear signature. Preclear by default reads all of the disk to make sure it can be read, writes zeros to all of the disk to make sure it can be written, then reads all of the disk again to make sure the zeros all got written and can be read.

 

There are options to preclear that will allow it to skip some of this. If you want to use badblocks, you might still do the preclear to just write all zeros and set the clear signature instead of that last pass with badblocks to set all zeros, if you are in the scenario that requires a clear disk.

 

I agree, I will skip the 00000000 test in badblocks, so Preclear can write that signature.

 

 

But like @gfjardim said, it writes and reads every sector and basically all possible combinations. If there is an error in one of these situations, the MFT (table) will learn about that.

And since it's a brand new HDD, that would be intolerable. If it was an old HDD, then at least that sector would be known and be "made transparent".

 

I just want to make really sure that the HDD I get will be able to live it's first few hours of life, r/w it completely multiple times/ways, with 0 issues. Otherwise, imo, it would die soon after anyways.

 

 

Though, I would really want to skip badblocks, it takes forever. :P

  • Community Expert

Most people just use preclear for testing. Some use multiple preclear cycles to make sure it gets a good workout in case of infant mortatlity. At the end of preclear you get a report that tells you if any were reallocated and if any are still pending. You can never be absolutely sure it won't go bad no matter how well it passes whatever test you use, and that is where unRAID parity comes in.

  • Author

Well, I'll try it.

Using the Preclear plugin, Clear mode, 3x, Size 2048mb (something about how much r/w at a time, right? Eats more RAM, but it faster.).

 

Now, we wait. :)

 

  • Community Expert

Well, I'll try it.

Using the Preclear plugin, Clear mode, 3x, Size 2048mb (something about how much r/w at a time, right? Eats more RAM, but it faster.).

 

Now, we wait. :)

I haven't had a reason to use the recent version of the plugin. Does Clear mode mean it will not do the pre-read and post-read? I recommend at least the post-read. I had an issue where the preclear seemed to go fine but then failed in the post-read due to an undiagnosed bad RAM stick. If more testing is your goal then why not do both the pre and post read at least for one of the cycles?
  • Author

Hmm, I actually don't know.

 

It says:

#  Step 1 of 5 - Pre-read in progress: 

 

I assume that the other 4 steps will do some writing and reading again.

  • Community Expert

Hmm, I actually don't know.

 

It says:

#  Step 1 of 5 - Pre-read in progress: 

 

I assume that the other 4 steps will do some writing and reading again.

That sounds like it is doing the full cycle so OK then.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.