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
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
06-17-2017, 07:46 PM
#1
LQ Newbie
Registered: Jun 2017
Posts: 3
Rep:
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.
06-18-2017, 02:56 PM
#2
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
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.
07-01-2017, 09:24 AM
#3
LQ Newbie
Registered: Jun 2017
Posts: 3
Original Poster
Rep:
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
07-01-2017, 04:22 PM
#4
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
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)
07-08-2017, 03:40 AM
#5
LQ Newbie
Registered: Jun 2017
Posts: 3
Original Poster
Rep:
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.
07-08-2017, 04:00 AM
#6
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
Quote:
Originally Posted by
timelyfiasco
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.
All times are GMT -5. The time now is 04:53 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News