When I need to properly wipe a harddrive, I tend to use shred on the whole device, i.e. pointing shred to the /dev/sdX without regard to particular partitions; however I noticed that the device size listed by shred command in the progress lines is always approx. 7 % smaller than the device size listed by fdisk (on a 500 GB disk, shred would be showing 466 GB). Thus I wanted to ask, if shred really wipes the whole drive properly using the method above, or if there still might be some areas of the disk, that remain untouched (or perhaps if it just incorrectly shows the size, calculates it differently...)

  • 2
    Nitpick: A lowercase b stands for bits. For bytes use B instead. – CodesInChaos Oct 22 '14 at 18:57
  • yeah I somehow get that always wrong, edited to ensure everyone is happy :) – cyber-guard Oct 22 '14 at 22:18

You are seeing a consequence of the ongoing war between binary and decimal systems.

Namely, 210 = 1024, which is close to 1000. Hence a widespread habit of saying "kilobyte" (as in "1000 byte") for a quantity of 1024 bytes. When we go to megabytes and gigabytes, the deviation increases: 220 = 1048576, and 230 = 1073741824. Therefore, if tool A displays a size in "decimal gigabytes", it will show a number that is 7.37% higher than tool B that sticks to the traditional "binary gigabytes". This is what you observe here: fdisk uses "true gigabytes" (1000000000 bytes each) while shred reports the same size with "binary gigabytes" (1073741824 bytes each).

Some people have tried to solve the ambiguity by talking of kibibytes (and mebibytes, gibibytes...) for quantities related to the "1024" scale. This would solve the issue if the names were not so ridiculous.

In older times, the "binary" versions were prevalent, but in the late 1990s, hard disk vendors figured out that they could put stickers with bigger numbers on their disks if they switched to the "correct" (decimal) units (the kilo/mega/giga prefixes are part of an international standard that extends way beyond computer matters). RAM vendors resisted, and still use the binary scale (so when you have a "1 GB RAM chip" you actually get 1073741824 bytes of RAM). On the other hand, the telecom industry has used decimal for decades (100 Mbit/s ethernet works at 100 MHz, not 104.9 MHz).

  • Just as a clarification, an 'i' is frequently inserted into the abbreviation to tell people the difference between them. GB is 1000 MB is 1000000 KB etc., while GiB is 1024 MiB which is 1048576 KiB and so on. They also have different names, Kibibyte, Mebibyte, Gibibyte, and so on. It really is something and not just an attempt to solve the ambiguity =) – Desthro Oct 22 '14 at 20:18
  • (moved to a comment since it bugged some) How are you using shred? E.g., are you running it while on the same drive? Or are you mounting the drive on another machine to run shred? If you're running shred on the same machine you're looking to wipe, there will likely be remanence. Here is a very thorough article summarizing everything for you: "Shred Files and Wipe Disks" – munkeyoto Oct 22 '14 at 21:40
  • @munkeyoto: Did you forget to add the actual link in the comment? – Jan Hudec Oct 23 '14 at 4:51

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.