I have two 3TB disks, which I hope to be exactly the same size. This means that I can use dd to copy them without being short or in excess of some bytes.

Therefore I tried to find out the capacity/size of the HDD block device and I used for this

fdisk /dev/sdX -l | grep "Disk /dev/sdX"

the two devices are in my case are accessible via /dev/sda and /dev/sdb and by using the command above I receive

Disk /dev/sda: 3000.6GB, 3000592982016


Disk /dev/sdb: 3000.6GB, 3000592982016

and to my happy relief it seems the two devices are really exactly the same size. This is they have the exact number of bytes.

My question

Can this information be trusted? Especially I would like to know if it is at least common practice/habit for the HDD devices to keep the number of bytes constant over time (i.e. neither lose or gain some bytes i.e. due to bad sectors etc.)?

  • It's worth noting that while the size will remain constant for a given drive, you aren't always guaranteed that e.g. two "3TB" drives will have the same exact size. The precise meaning of "3TB" really depends on the manufacturer's policies and marketing. – Jason C Oct 10 '14 at 17:02

Any adjusting that the 2 HDD's will perform over time will be to keep their usable space, that's not corrupted or damaged, at the same byte counts. All this happens at a lower level to you, the user of the HDD, so I'd would expect that both HDDs would report identical capacities over time.

NOTE: All modern HDDs include a extra reserve of space that they can draw from as sectors become defective or wear out. The HDD recognizes that these sectors are failing or becoming damaged and will reallocate from the reserve, marking the failing sector as unusable, so that it's no longer part of the total pool of available sectors.

The HDD should continue to operate normally until this space has been exhausted, assuming there are not other catastrophic types of failures. Once the space has been used up, the HDD will be forced to make due with any bad sectors that remain. It will attempt to relocate this failed data to good sectors, but will begin to exhibit I/O errors in the process.

NOTE: You can monitor the reserve space of a HDD over its lifetime using SMART. In looking at the SMART attributes I would suspect that this count would be #5:

5 - Reallocated Sectors Count The number of the unused spare sectors. When encountering a read/write/check error, a device remaps a bad sector to a "healthy" one taken from a special reserve pool. Normalized value of the attribute decreases as the number of available spares decreases.On a regular hard drive, Raw value indicates the number of remapped sectors, which should normally be zero. On an SSD, the Raw value indicates the number of failed flash memory blocks.

You can check this using the smartctl tool that's typically part of the smartmontools pacakge (that's what its called on Fedora 20 anyway).

$ sudo smartctl --all /dev/sda

There's a lot of useful info in this output:

smartctl 6.2 2014-07-16 r3952 [x86_64-linux-3.16.3-200.fc20.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

Device Model:     LITEONIT LMT-256M3M
Serial Number:    002244119905
LU WWN Device Id: 5 000000 000000000
Firmware Version: VZJ4
User Capacity:    256,060,514,304 bytes [256 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS, ATA/ATAPI-7 T13/1532D revision 4a
SATA Version is:  SATA 3.0, 6.0 Gb/s
Local Time is:    Fri Oct 10 12:32:12 2014 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (   10) seconds.
Offline data collection
capabilities:            (0x15) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Abort Offline collection upon new
                    No Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    No Selective Self-test supported.
SMART capabilities:            (0x0002) Does not save SMART data before
                    entering power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x00) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   1) minutes.
Extended self-test routine
recommended polling time:    (  10) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
  1 Raw_Read_Error_Rate     0x0003   100   100   070    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0003   100   100   000    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0002   100   100   000    Old_age   Always       -       2248
 12 Power_Cycle_Count       0x0002   100   100   000    Old_age   Always       -       706
171 Unknown_Attribute       0x0032   000   000   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   000   000   000    Old_age   Always       -       0
173 Unknown_Attribute       0x0032   000   000   000    Old_age   Always       -       12
174 Unknown_Attribute       0x0030   000   000   000    Old_age   Offline      -       126
178 Used_Rsvd_Blk_Cnt_Chip  0x0003   100   100   000    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0002   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0003   100   100   000    Pre-fail  Always       -       126
230 Unknown_SSD_Attribute   0x0032   100   100   000    Old_age   Always       -       24851
232 Available_Reservd_Space 0x0003   100   100   010    Pre-fail  Always       -       2784
241 Total_LBAs_Written      0x0003   100   100   000    Pre-fail  Always       -       86211
242 Total_LBAs_Read         0x0003   100   100   000    Pre-fail  Always       -       25145

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

Selective Self-tests/Logging not supported

The piece of info that I was referring to is in the last table, ID #5.


  • Thank you for confirmation of what I only have been guessing about. This way I do not right away blindly rely on something that is likely to change (i.e by occurance of bad sectors).... It would sure be crucial to know if the bad sector stuff is in case of healthy hdds always happening under the hood so that on the level of the block device I can remain ignorant and rely on the block device size (even though inside some overprovided space has been used by the hdd to cover for lost bad sectors?) So is the case bad sectors cause less device size possible? – humanityANDpeace Oct 10 '14 at 16:38
  • 1
    @humanityANDpeace - No, after a HDD has exhausted it's reserve, it will continue to report it's size as such, attempting to use bad sectors. – slm Oct 10 '14 at 16:40
  • 2
    @humanityANDpeace - yes this is typically at the end of it's life, I generally replace drives based on years of service rather than waiting for them to fail. – slm Oct 10 '14 at 16:55
  • 1
    @JasonC - comment fixed. – slm Oct 10 '14 at 16:55
  • 1
    @humanityANDpeace Yes; you would not expect to run into serious IO errors until after reserve space is depleted and the drive is nearing its end of life. You would expect to see the frequency of errors increasing until the drive becomes unusable. Always make backups, and use SMART to try to identify problems before you start losing data. – Jason C Oct 10 '14 at 16:56

If you want to know the size of a device (in bytes) you may use blockdev:

# blockdev --getsize64 /dev/sde

In this example /dev/sde is a 2TB disk, or at least, that's what the kernel sees. Naturally, fdisk, parted and others should show the same information.

This size does not change. Losing capacity due to bad sectors is not an option, it would cause no end of problems; reallocating sectors uses an internal reserve and the drive is usually dead completely before that's used up. You should replace before things get that bad.

Some people like to leave some small unpartitioned space (a few megs) at the end of the disk, since a replacement disk may not have exactly the same size as your old one, and may make things like raid member replacements more difficult if the new device appears to be a little too small.

  • The idea to leave some trailing space for inter-device compatibility is a smart idea. I do not use partition though but use the block device directly, so I need to find out how I can leave a trailing space unused at the end. Telling that the reducing of device space size as a result to bad sectors occuring would be unlikely because it would result in many problems seems convincing. The other answer anyway tells that this might happen. I hope there will be others being able to confirm any of the both views. – humanityANDpeace Oct 10 '14 at 16:44
  • 1
    I believe it's generally advisable to always use partitions. That conversation has come up here from time to time in the past. – slm Oct 10 '14 at 16:51
  • @sim I checked and there are pros and cons regarding to use partitions. At least there in most cases there is no real hazards when using the blockdevice directly and skip paritions – humanityANDpeace Oct 10 '14 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.