I bought an 8GB microSDHC card. Which terminal command should show me the size as at least = 8,000,000,000 bytes ? The size should include the partition table and every byte of the card. fdisk -l
is showing the size as 7948206080 bytes. I'm using a microSD adapter to read the card, assuming that it won't reduce the detectable size.
-
7948206080 bytes is the size of the card, if I am not mistaken– solsTiCeDec 8, 2014 at 18:54
-
Disks have always measured bytes using the metric system rather then the binary system since day 1 of the IBM 350 hard disk: 5MByte was 5,000,000 6-bit bytes... (yes, I'm an old fart)– FabbyDec 8, 2014 at 20:23
5 Answers
f3 is a great tool for testing if your SD card is a fake or not. It comes with two handy command-line tools: f3write and f3read. The package is just named f3 on GNU/Linux distributions, so dnf -y install f3 or apt-get install f3 to get it.
Source: https://linuxreviews.org/HOWTO_test_SD_cards_and_identify_fake_ones_(mostly_sold_on_ebay)
HowTo:
Just run from terminal:
f3write /media/username/yoursdcard
Output might look like this:
F3 write 7.2
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
Free space: 29.24 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... 3.62% -- 5.98 MB/s -- 1:29:38
It will fill your sdcard with testfiles to see how much fits on it. Afterwards you run:
f3read /media/username/yoursdcard
to see if the sdcard is faulty/corrupt/wrong size ...
First connect the memory card through a card reader or something similar.
Then run the application named Disks (search in dash or run this command in terminal: gnome-disks
)
Now you should see the device on the left panel of the application, click on that.
You'll get all the informations from there. It'll show the model name, size and serial number. I'm attaching a screenshot that i've tested with my pen drive.
 
 
To check the size only, you can also right click on the drive in your file manager. simply open the file manager, open the memory card, right click and click properties. I'm attaching another screenshot of it:
When you ran fdisk -1
and you observed the size of that card, what information did it present about partitions on that card? Usually when you buy a new SD card it will most likely have the reserved space Mitch mentions on a separate partition, which MIGHT account for you seeing a lower value than you expect.
Also, I think that one thing Mitch is forgetting is that manufacturers print "plain" information when trying to sell to consumers. For instance, my test-linux box has a 120GB maxtor hdd in it. That is what is on the label, that was the number printed on the package, yet when I run fdisk
it reports 120,000,000,000.0 in bytes, not 128,849,018,880 bytes. The USB flash drive I have on me atm (8GB) shows 8,006,926,336 bytes, not 8,589,934,592.0000
bytes if we measured it in binary. My external SSD drive (256GB) weighs in as 256,055,212,769 bytes, not the 274,877,906,944 we would see if measuring in binary.
So, while WE measure file sizes in binary, manufacturers don't always seem to do so with mass-consumer products.
I will say, however, that I have never had an SD card report the total number of bytes at what the advertised capacity is. My 2GB SD card that I have plugged in to my linux box only shows 1,962,856,448 bytes. I can't remember an SD card EVER showing the advertised bytes. Putting my phone's 2gb SD card into my PC...that one registers as 1,976,303,616. It's the same brand as the other card, same size, same age, etc etc, yet still shows something different from the other card, and neither show a full 2,000,000,000 bytes.
-
1Disks have always measured bytes using the metric system rather then the binary system since day 1 of the IBM 350 hard disk 5MByte was 5,000,000 6-bit bytes... (yes, I'm an old fart)– FabbyDec 8, 2014 at 20:22
See if this makes sense.
File sizes are traditionally measured in binary, and so are counted in multiples of 1024, which is 2^30
GB here means 2^30, and not 10^9.
2^30*8=8589934592
10^9*8=8000000000
So the size of your 8GB card is 8589934592
, the difference in size, is reserved for card functionality, and OS reserved.
One kilobyte is a little more than one thousand bytes, specifically 1,024. A megabyte represents more than a million bytes or 1,048,576. A gigabyte is 1,073,741,824 bytes and so on. The exact number is gained by taking 2^n power. Example: KB = 2^10; MB = 2^20; GB = 2^30.
All computer data is stored in a binary format as either a one or zero (called a bit). Eight of these bits together are most commonly called a byte. Storage capacity is measured by a prefix to the B (byte) to represent a specific amount, ie K (Kilobyte), M (Megabyte), G (Gigabyte), T (Terabyte) etc. Since all computers are based on the binary system, these prefixes represent base 2 amounts. Each level is an increment of 2 to the 10th power or 1,024.
The common prefixes are as follows:
Kilobyte (KB) = 1,024 Bytes MegaByte (MB) = 1,024 Kilobytes or 1,048,576 Bytes Gigabyte (GB) = 1,024 Megabytes or 1,073,741,824 Bytes Terabyte (TB) = 1,024 Gigabytes or 1,099,511,627,776 Bytes
This is very important information because when a computer operating system or program reports the available space on a drive, it is going to report the overall total of available bytes or reference them by one of the prefixes. So, an OS reporting a total space of 74.51 GB actually has around 80,004,503,306 Bytes of storage space.
Advertised vs. Actual
Since consumers don't think in base 2 mathematics, manufacturers decided to rate most drive capacities based on the standard base 10 numbers we are all familiar with. Therefore, one Megabyte equals one million bytes while one Gigabyte equals one billion bytes. This isn't too much of a problem with fairly small numbers such as a Kilobyte, but each level of increase in the prefix also increased the total discrepancy of the actual space compared to the advertised space.
Here is a quick reference to show the amount that the actual values differ compared to the advertised for each common referenced value:
Megabyte Difference = 48,576 Bytes Gigabyte Difference = 73,741,824 Bytes Terabyte Difference = 99,511,627,776 Bytes
Based on this, for each Gigabyte that a drive manufacturer claims, they are over reporting the amount of disk space by 73,741,824 Bytes or roughly 70.3 MB of disk space. So, if a manufacturer advertises an 80 GB (80 billion bytes) hard drive, the actual disk space is around 74.5 GB of space, roughly 7% less than what they advertise.Information Technology, Mangalam Publishers
-
1The microSD manufacturers consider GB = 10^9*8 bytes. On the packaging of SanDisk micrsoSDHC card I bought, SanDisk has written that 1GB = 1.000.000.000 bytes. So according to SanDisk, the size should be 10^9*8 bytes and I want to verify the size.– gomDec 8, 2014 at 18:12
-
-
1en.wikipedia.org/wiki/Binary_prefix. size for hard disk are usually reported by manufacturer in GB so in SI (or decimal) prefix not binary prefix– solsTiCeDec 8, 2014 at 18:22
-
Disks have always measured bytes using the metric system rather then the binary system since day 1 of the IBM 350 hard disk 5MByte was 5,000,000 6-bit bytes... (yes, I'm an old fart)– FabbyDec 8, 2014 at 20:22
sudo blockdev --getsize64 /dev/sdc
will give you the exact number of bytes of your device /dev/sdc
.