Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 23 in printed book and digital formats -- plus a one-year subscription (beginning with 24.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are short, so hurry today and order this special bundle before the offer goes away!

Recent issues

Article Preview


Buy Now

Issue 23.5 ('Shared Notes App')
Instant purchase and download via GumRoad!

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):

Download Icon 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_struct structure, which is populated by the statvfs_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.