HDD Capacity size reporting wrong - often after RAID
Posted: 2024.01.04. 14:53
This small article deals with rather advanced methods of writing/erasing data on any storage device.
Use it with outmost care.
Below works best on a drive connected via SATA or even SAS, do not expect it to work with a USB dock. Maybe on newer, but it did not on mine.
I often end up with hdd's reporting the wrong sizes after picking them out of a raid to reuse them in something else.
Like now I have a WD Red, first of six, that I am replacing and refurbishing for other use. It should report 6TB but it is down to 1.3. This likely happens because the raid controller do not restore the original capacity and the drive still thinks it is part of a raid.
One might think that the old fdisk ( https://en.wikipedia.org/wiki/Fdisk ) might help with this in Windows, but in this scenario it is very crippled. Also missing in later versions of Windows, hence Linux.
Normal disk utilities from Seagate/WD, HGST or others, do not always address this properly. So I use linux dd or hdparm.
DD: https://linuxopsys.com/topics/linux-dd-command-with-examples
DD: https://www.maketecheasier.com/use-dd-command-linux/
A typical command to clear out the first few sectors could be, assuming disk to be /sdi ,
When that is not enough one can expand it to overwrite the entire disk, like
which will eventuall trigger "no space left on device" which is to be expected if you do not define the exact amount of space to overwrite.
hdparm
https://linux.die.net/man/8/hdparm
I have found that raid plays with hidden partitions. HPA mode.
https://superuser.com/questions/642637/harddrive-wipe-out-hidden-areas-like-hpa-and-dco-after-malware-infection/642765#642765
This actually helped me restore the HDD's capacity when everything else above failed.
It will give you the correct sector number and let you expand a crippled device restoring those, if HPA partitioning is used.
Like so
(assuming target disk is /sdc)
That means that there are hidden partitions and that only 12631728 out of 7814037168 is actually visible to any OS.
In order to restore these you use the cmd:
Fixed. On my SATA drives, by me, taking all the risks myself.
---
To be perfectly honest I thought HDSentinel would help with this, but from this article it describes no method to do that:
https://www.hdsentinel.com/hard_disk_case_capacity_is_not_correct.php
I find that very strange and a bit of a shortcoming.
Use it with outmost care.
Below works best on a drive connected via SATA or even SAS, do not expect it to work with a USB dock. Maybe on newer, but it did not on mine.
I often end up with hdd's reporting the wrong sizes after picking them out of a raid to reuse them in something else.
Like now I have a WD Red, first of six, that I am replacing and refurbishing for other use. It should report 6TB but it is down to 1.3. This likely happens because the raid controller do not restore the original capacity and the drive still thinks it is part of a raid.
One might think that the old fdisk ( https://en.wikipedia.org/wiki/Fdisk ) might help with this in Windows, but in this scenario it is very crippled. Also missing in later versions of Windows, hence Linux.
Normal disk utilities from Seagate/WD, HGST or others, do not always address this properly. So I use linux dd or hdparm.
DD: https://linuxopsys.com/topics/linux-dd-command-with-examples
DD: https://www.maketecheasier.com/use-dd-command-linux/
A typical command to clear out the first few sectors could be, assuming disk to be /sdi ,
Code: Select all
$: dd if=/dev/zero of=/dev/sdi bs=1048576 count=1024
Code: Select all
$: sudo dd if=/dev/zero of=/dev/sdi
hdparm
https://linux.die.net/man/8/hdparm
I have found that raid plays with hidden partitions. HPA mode.
https://superuser.com/questions/642637/harddrive-wipe-out-hidden-areas-like-hpa-and-dco-after-malware-infection/642765#642765
This actually helped me restore the HDD's capacity when everything else above failed.
It will give you the correct sector number and let you expand a crippled device restoring those, if HPA partitioning is used.
Like so
(assuming target disk is /sdc)
Code: Select all
$: hdparm -N /dev/sdc
/dev/sdc:
max sectors = 12631728/7814037168, HPA is enabled
In order to restore these you use the cmd:
Code: Select all
$: hdparm -N p7814037168 /dev/sdc
---
To be perfectly honest I thought HDSentinel would help with this, but from this article it describes no method to do that:
https://www.hdsentinel.com/hard_disk_case_capacity_is_not_correct.php
I find that very strange and a bit of a shortcoming.