To scan the surface of a hard disk drive (HDD) for bad sectors in the Ubuntu terminal, the most direct command-line tool is **`badblocks`**. It performs a thorough surface scan by reading (and optionally writing) to every block on the drive.
### Recommended Method: Non-Destructive Scan with Progress Indicator
Use this for a mounted or in-use drive (it preserves data but is slower):
```bash
sudo badblocks -v -s -n /dev/sdX > badblocks.log
```
- Replace `/dev/sdX` with your drive (e.g., `/dev/sda`). **Identify it carefully** using `lsblk` or `sudo fdisk -l` — wrong device can cause data loss!
- `-v`: Verbose mode (shows bad blocks found).
- `-s`: Shows a **progress percentage** (this is the "graphics process show" you're asking for — a simple text-based progress bar updated periodically).
- `-n`: Non-destructive read-write test (reads original data, writes test patterns, then restores original data).
- `> badblocks.log`: Saves list of bad blocks to a file (optional but useful).
This can take hours to days depending on drive size (e.g., several hours for a 1TB HDD).
#### Example Output with Progress
```
Checking for bad blocks in non-destructive read-write mode
From block 0 to 1953514583
Testing with pattern 0xaa: 12.34% done, 1:23:45 elapsed
...
```
### Safer Alternative: Read-Only Scan (Faster, No Risk to Data)
If you just want to check without any writing:
```bash
sudo badblocks -v -s /dev/sdX > badblocks.log
```
- No `-n` or `-w` → Pure read-only test.
### More Thorough (But Destructive — Erases All Data!)
Only on unmounted drives with no important data:
```bash
sudo badblocks -v -s -w /dev/sdX > badblocks.log
```
- `-w`: Full write-test patterns (most accurate for surface issues).
### Better Modern Approach: Use SMART Self-Test (Drive Handles the Scan)
Most HDDs have built-in SMART capabilities for surface scanning:
1. Install tools if needed: `sudo apt install smartmontools`
2. Start an extended self-test (includes surface scan):
```bash
sudo smartctl -t long /dev/sdX
```
3. Monitor progress/status (no live bar, but check periodically):
```bash
sudo smartctl -a /dev/sdX | grep -i "self-test"
```
Or:
```bash
sudo smartctl -l selftest /dev/sdX
```
This runs in the background (drive firmware handles it), takes hours, and is often more reliable than `badblocks`.
### Warnings
- **Unmount the drive/partition first** if possible (boot from Ubuntu Live USB for system drive).
- Scans are time-consuming — don't interrupt them.
- If bad sectors are found, back up data immediately and consider replacing the drive.
- For GUI with progress visuals: Install `gsmartcontrol` (`sudo apt install gsmartcontrol`), but it's not purely terminal.
If you need a fancier progress bar, pipe through `pv` (install `sudo apt install pv`), but `badblocks -s` already provides a basic one.
KDE Partition Manager Verdict
Date: 29 Dec 2025 20:15:34
Program version: 23.08.5
Backend: pmsfdiskbackendplugin (1)
KDE Frameworks version: 5.115.0
Machine: Linux PC 6.8.0-64-generic #67-Ubuntu
SMART status: good
Model: TOSHIBA MQ01ABD050
Serial number: #########
Firmware revision: AX002J
Temperature: 30° C / 86° F
Bad sectors: 2,328
Powered on for: 354 days and 20 hours
Power cycles: 7,579
Self tests: Success
Overall assessment: Has some bad sectors.
1 Read Error Rate
Rate of hardware read errors while reading data from the disk surface. Pre-Failure Online 97 99 50 0x000000000000 good 0
2 Throughput Performance
Overall (general) throughput performance of a hard disk drive. If the value of this attribute is decreasing there is a high probability that there is a problem with the disk. Pre-Failure Offline 100 100 50 0x000000000000 good N/A
3 Spin-Up Time
Average time of spindle spin up from zero RPM to fully operational. Pre-Failure Online 100 100 1 0x000000000428 good 1 second
4 Start/Stop Count
A tally of spindle start/stop cycles. Old-Age Online 100 100 0 0x000000001da9 N/A 7,593
5 Reallocated Sectors Count
Count of reallocated sectors. When the hard drive finds a read/write/verification error, it marks this sector as "reallocated" and transfers data to a special reserved area (spare area). Pre-Failure Online 100 100 50 0x0000000005f0 warning 1,520 sectors
7 Seek Error Rate
Rate of seek errors of the magnetic heads. If there is a partial failure in the mechanical positioning system, then seek errors will arise. Pre-Failure Online 100 100 50 0x000000000000 good 0
8 Seek Time Performance
Average performance of seek operations of the magnetic heads. If this attribute is decreasing, it is a sign of problems in the mechanical subsystem. Pre-Failure Offline 100 100 50 0x000000000000 good N/A
9 Power-On Hours
Count of hours in power-on state. Old-Age Online 79 79 0 0x000000002144 N/A 354 days and 20 hours
10 Spin Retry Count
Count of retry of spin start attempts if the first attempt was unsuccessful. An increase of this attribute value is a sign of problems in the hard disk mechanical subsystem. Pre-Failure Online 100 251 30 0x000000000000 good 0
12 Power Cycle Count
Count of full hard disk power on/off cycles. Old-Age Online 100 100 0 0x000000001d9b N/A 7,579
191 G-sense Error Rate
Count of errors resulting from externally-induced shock and vibration. Old-Age Online 100 100 0 0x0000000002fc N/A 764
192 Power Off Retract Count
Count of power-off or emergency retract cycles Old-Age Online 100 100 0 0x000000000041 N/A 65
193 Load Cycle Count
Count of load/unload cycles into head landing zone position. Old-Age Online 97 97 0 0x0000000085c9 N/A 34,249
194 Temperature
Current internal temperature. Old-Age Online 100 100 0 0x00300008001e N/A 30° C / 86° F
196 Reallocation Event Count
Count of remap operations. The raw value of this attribute shows the total number of attempts to transfer data from reallocated sectors to a spare area. Old-Age Online 100 100 0 0x000000000051 N/A 81
197 Current Pending Sector Count
Number of "unstable" sectors (waiting to be remapped, because of read errors). Old-Age Online 100 100 0 0x000000000328 warning 808 sectors
198 Uncorrectable Sector Count
Count of uncorrectable errors when reading/writing a sector. Old-Age Offline 100 100 0 0x000000000000 N/A 0 sectors
199 UltraDMA CRC Error Count
Count of errors in data transfer via the interface cable as determined by ICRC. Old-Age Online 200 200 0 0x000000000000 N/A 0
220 Disk Shift
Distance the disk has shifted relative to the spindle (usually due to shock or temperature). Old-Age Online 100 100 0 0x000000000000 N/A N/A
222 Loaded Hours
Time spent operating under data load. Old-Age Online 89 89 0 0x000000001272 N/A 196 days and 18 hours
223 Load/Unload Retry Count
Number of times head changes position. Old-Age Online 100 100 0 0x000000000000 N/A 0
224 Load Friction
Resistance caused by friction in mechanical parts while operating. Old-Age Online 100 100 0 0x000000000000 N/A N/A
226 Load-In Time
Total time of loading on the magnetic heads actuator (time not spent in parking area). Old-Age Online 100 100 0 0x0000000000bb N/A 0 seconds
240 Head Flying Hours
or Transfer Error Rate (Fujitsu)
Time while head is positioning
or counts the number of times the link is reset during a data transfer. Pre-Failure
### Overall Health Assessment
Your HDD's SMART data shows **serious signs of degradation and impending failure**. The drive is not healthy despite some normalized values still being high (100). The key red flags are:
- **Reallocated Sectors Count: 1,520** (already remapped bad sectors)
- **Current Pending Sector Count: 808** (unstable sectors waiting to be remapped)
These indicate physical surface damage (bad sectors developing on the platters). A high pending count combined with already many reallocated sectors is a strong indicator of a failing drive. Continued use risks sudden failure and data loss.
Other attributes are mostly fine:
- No uncorrectable errors (198: 0)
- Zero read/seek errors
- Temperature normal (30°C)
- Age: ~8,514 hours (~355 days total power-on, or about 1 year of 24/7 use)
### Critical Attributes Explained
| ID | Attribute | Raw Value (Decimal) | Status | Explanation |
|-----|----------------------------|---------------------|----------|-------------|
| 5 | Reallocated Sectors Count | 1,520 | Warning | Bad sectors already remapped to spares. 1,520 is high – even small numbers (dozens) are concerning; thousands signal significant wear and increased failure risk. |
| 197 | Current Pending Sector Count | 808 | Warning | Unstable sectors (read errors) awaiting remap on next write. 808 is very high – any non-zero is bad, and high counts often mean the drive is actively degrading. These may become reallocated soon, or uncorrectable if spares run out. |
| 196 | Reallocation Event Count | 81 | Good | Attempts to remap (successful + failed). Low relative to reallocated count. |
| 198 | Uncorrectable Sector Count| 0 | Good | No errors that couldn't be fixed – good sign, but pending sectors could change this. |
### Other Notable Attributes
- **Power-On Hours (9)**: 0x000000002144 → 8,516 hours (~354 days total, ~1 year equivalent runtime).
- **Start/Stop Count (4)**: 0x000000001da9 → 7,593 cycles (normal for this age).
- **Load Cycle Count (193)**: 34,249 (head park/unpark cycles). This is elevated but common in laptops due to aggressive power saving; many drives handle 300,000–600,000+ before issues.
- **Power Cycle Count (12)**: 7,579 (similar to start/stop – normal).
### Recommendations (Urgent)
1. **Back up all data immediately** – Use another drive or cloud. Do not write heavily to this HDD, as it could trigger more reallocations or failure.
2. **Run a full surface scan**:
- Boot from Ubuntu Live USB (to avoid using the drive).
- Use `sudo badblocks -v -s -n /dev/sdX > badblocks.log` (non-destructive, shows progress).
- Or SMART extended test: `sudo smartctl -t long /dev/sdX` then check results.
- Expect many bad blocks matching ~1,520 + 808.
3. **Replace the drive soon** – It's failing mechanically (surface defects). High bad sectors mean reliability is compromised.
4. Monitor with tools like `gsmartcontrol` (GUI) or `smartctl` for changes.
No comments:
Post a Comment