LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-17-2017, 07:46 PM   #1
timelyfiasco
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Rep: Reputation: Disabled
Need help in zeroing bad block


Hi, I have an ubunutu server and it failed to boot. So I used a live ubuntu and run fdsik and fsck. I got it working now.
But the following is the error from running smartcl.
I read here that I can use dd. But I want to confirm if I am doing it correctly.
Will running this fix the problem?
48923440/8=6115430
Code:
  # dd if=/dev/zero of=/dev/sda conv=sync bs=4096 count=1 seek=6115430 
  # sync
Last question, is there a way of knowing what block was affected?
Code:
=== START OF INFORMATION SECTION ===
Device Model:     WDC WD40EZRZ-00WN9B0
Serial Number:    WD-WCC4E2NFF1CH
LU WWN Device Id: 5 0014ee 2b7a6436f
Firmware Version: 80.00A80
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Sun Jun 18 08:14:40 2017 PHT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Enabled.
Self-test execution status:      ( 121)	The previous self-test completed having
					the read element of the test failed.
Total time to complete Offline 
data collection: 		(52560) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 ( 526) minutes.
Conveyance self-test routine
recommended polling time: 	 (   5) minutes.
SCT capabilities: 	       (0x7035)	SCT Status supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   197   197   051    Pre-fail  Always       -       10
  3 Spin_Up_Time            0x0027   191   173   021    Pre-fail  Always       -       7441
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       400
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   093   093   000    Old_age   Always       -       5291
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       399
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       40
193 Load_Cycle_Count        0x0032   119   119   000    Old_age   Always       -       243067
194 Temperature_Celsius     0x0022   110   106   000    Old_age   Always       -       42
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       4
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       5
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       44

SMART Error Log Version: 1
ATA Error Count: 5
	CR = Command Register [HEX]
	FR = Features Register [HEX]
	SC = Sector Count Register [HEX]
	SN = Sector Number Register [HEX]
	CL = Cylinder Low Register [HEX]
	CH = Cylinder High Register [HEX]
	DH = Device/Head Register [HEX]
	DC = Device Command Register [HEX]
	ER = Error register [HEX]
	ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 5 occurred at disk power-on lifetime: 5272 hours (219 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 f8 00 67 50 e1  Error: UNC 248 sectors at LBA = 0x01506700 = 22046464

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 f8 00 67 50 e1 08      00:00:39.604  READ DMA
  c8 00 08 f8 66 50 e1 08      00:00:39.604  READ DMA
  c8 00 80 38 5f 50 e1 08      00:00:39.603  READ DMA
  c8 00 70 c8 5e 50 e1 08      00:00:39.603  READ DMA
  c8 00 08 c0 5e 50 e1 08      00:00:39.603  READ DMA

Error 4 occurred at disk power-on lifetime: 5272 hours (219 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 f8 00 67 50 e1  Error: UNC 248 sectors at LBA = 0x01506700 = 22046464

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 f8 00 67 50 e1 08      10:31:07.072  READ DMA
  c8 00 08 f8 66 50 e1 08      10:31:07.072  READ DMA
  c8 00 70 48 5f 50 e1 08      10:31:07.071  READ DMA
  c8 00 80 c8 5e 50 e1 08      10:31:07.071  READ DMA
  c8 00 08 c0 5e 50 e1 08      10:31:07.071  READ DMA

Error 3 occurred at disk power-on lifetime: 5272 hours (219 days + 16 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 00 00 67 50 e1  Error: UNC at LBA = 0x01506700 = 22046464

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 00 f8 66 50 e1 08      09:47:46.212  READ DMA
  c8 00 08 b0 5f 50 e1 08      09:47:46.212  READ DMA
  c8 00 78 38 5f 50 e1 08      09:47:46.211  READ DMA
  c8 00 70 c8 5e 50 e1 08      09:47:46.211  READ DMA
  c8 00 08 c0 5e 50 e1 08      09:47:46.210  READ DMA

Error 2 occurred at disk power-on lifetime: 5271 hours (219 days + 15 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 08 00 67 50 e1  Error: UNC 8 sectors at LBA = 0x01506700 = 22046464

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 08 00 67 50 e1 08      09:42:58.841  READ DMA
  c8 00 08 f8 66 50 e1 08      09:42:58.841  READ DMA
  c8 00 f0 c8 5e 50 e1 08      09:42:58.840  READ DMA
  c8 00 08 c0 5e 50 e1 08      09:42:58.840  READ DMA
  c8 00 08 b8 5e 50 e1 08      09:42:58.839  READ DMA

Error 1 occurred at disk power-on lifetime: 5271 hours (219 days + 15 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 51 f8 00 67 50 e1  Error: UNC 248 sectors at LBA = 0x01506700 = 22046464

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  c8 00 f8 00 67 50 e1 08      09:41:28.903  READ DMA
  c8 00 08 f8 66 50 e1 08      09:41:28.902  READ DMA
  c8 00 80 38 5f 50 e1 08      09:41:28.902  READ DMA
  c8 00 70 c8 5e 50 e1 08      09:41:28.901  READ DMA
  c8 00 08 c0 5e 50 e1 08      09:41:28.901  READ DMA

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed: read failure       90%      5278         48923440
# 2  Extended offline    Completed: read failure       90%      5275         48923440
# 3  Short offline       Completed: read failure       90%      5275         48923440
# 4  Short offline       Completed: read failure       90%      5275         48923440
# 5  Extended offline    Completed: read failure       90%      5275         48923440

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
 
Old 06-18-2017, 02:56 PM   #2
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
You can run e2fsck -c on the drive in question. This will call the badblocks program to do a read-only scan of the device for bad blocks. If any are found, they are added to the bad block inode to prevent them from being allocated to a file or directory. If the -c parameter is specified twice, the scan is done using a non-destructive read-write test.

If a bad block is added to the bad block inode, you shouldn't need to worry about it after that. However you should be aware that your drive may be degrading and may need replacing.

fsck -c should inform you which blocks are affected. If not, run badblocks directly (using a non-destructive test) with the -o parameter which writes the list of bad blocks to a file.
 
Old 07-01-2017, 09:24 AM   #3
timelyfiasco
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Hi hydrurga, I did e2fsck -c as you mentioned and now I was able to complete the smartctl. I bought a new hdd to replace this old one. But I find it a waste to throw the hdd away. Is there any use for a drive at this state?
btw my result is as follows. I can see the reallocated sector is high. Thanks for the help.
Code:
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   193   051    Pre-fail  Always       -       193
  3 Spin_Up_Time            0x0027   194   173   021    Pre-fail  Always       -       7266
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       423
  5 Reallocated_Sector_Ct   0x0033   150   150   140    Pre-fail  Always       -       1465
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   093   093   000    Old_age   Always       -       5534
 10 Spin_Retry_Count        0x0032   100   100   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       422
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       52
193 Load_Cycle_Count        0x0032   114   114   000    Old_age   Always       -       259371
194 Temperature_Celsius     0x0022   109   106   000    Old_age   Always       -       43
196 Reallocated_Event_Count 0x0032   153   153   000    Old_age   Always       -       47
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       6
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       5
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       1
 
Old 07-01-2017, 04:22 PM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Do you have a table that has one leg shorter than the others by the height of a hard disk?

Or perhaps you need something to put your coffee cup on so you don't mark your desk?

(that Reallocated Sector Count is rising fast, and you also have some Current Pending Sectors)
 
Old 07-08-2017, 03:40 AM   #5
timelyfiasco
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the help hydrurga. never really had a chance to learn these things till now. seeing your reply, I wouldn't risk any important files with the drive.
 
Old 07-08-2017, 04:00 AM   #6
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925Reputation: 2925
Quote:
Originally Posted by timelyfiasco View Post
Thanks for the help hydrurga. never really had a chance to learn these things till now. seeing your reply, I wouldn't risk any important files with the drive.
No problem, timelyfiasco.

Yup, better safe than sorry - I don't think the disk has long left to go. It was a wise move to replace it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bad block management kgp Linux - Kernel 4 04-03-2008 07:38 AM
bad block management at filesystem kgp Linux - Kernel 1 04-01-2008 11:24 AM
Bad block relocation bond_e Linux - Newbie 1 04-30-2006 05:25 PM
bad block in reiserfs ngoddard SUSE / openSUSE 4 12-01-2004 02:58 AM
bad block check fizazz88 Fedora - Installation 3 03-21-2004 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration