Article Preview
Buy Now
FEATURE
Getting Raspberry Pi Drive Information
Using Declares on the Raspberry Pi
Issue: 23.5 (September/October 2025)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 8,193
Starting Page Number: 22
Article Number: 23503
Resource File(s):
project23503.zip Updated: 2025-09-01 16:19:19
Related Link(s): None
Excerpt of article text...
It is common to retrieve the total size of a hard drive—in this case, the Micro SD card where the operating system is installed—and the amount of available free space (see Figure 1).
This example uses declares from the free Raspberry Pi Functionality Suite, Version 1.7, which is available on GitHub (
https://github.com/eugenedakin/PiFS). Working code for this example is included.Available data includes the total number of bytes that the drive can store. This information is retrieved using the
statvfs_structstructure, which is populated by thestatvfs_method.To calculate the total storage in gigabytes (GB) on the Micro SD card of the Raspberry Pi, you multiply the number of blocks by the block size. This result is in bytes, and to convert it to gigabytes, you divide by 1024 three times—once for kilobytes (KB), once for megabytes (MB), and once for gigabytes (GB). This is because binary measurements are used (i.e., base-2), rather than the base-10 metric system.
Example Calculation:
...End of Excerpt. Please purchase the magazine to read the full article.







