Команда DF на Raspberry Pi Zero 2 W¶
Overview¶
The df command in Linux is used to report file system disk space usage.
On the Raspberry Pi Zero 2 W running Raspberry Pi OS, it’s an essential tool to check available storage.
It shows how much space is used, available, and where the file systems are mounted.
Basic Syntax¶
df [OPTIONS] [FILESYSTEM]
Examples on Raspberry Pi¶
Basic Usage
This command shows all mounted file systems and their disk usage:
df
Sample Output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7224064 2765484 4103292 41% /
devtmpfs 427508 0 427508 0% /dev
tmpfs 464620 0 464620 0% /dev/shm
tmpfs 464620 6668 457952 2% /run
/dev/mmcblk0p1 258095 54730 203365 22% /boot
Explanation of Columns¶
Filesystem: Device or partition.
1K-blocks: Total size in 1K blocks.
Used: Space used.
Available: Free space.
Use%: Percentage of space used.
Mounted on: Directory where the filesystem is mounted.
Useful Options¶
Show in Human-Readable Format
Use -h to display sizes in KB, MB, or GB:
df -h
Example Output:
Filesystem Size Used Avail Use% Mounted on
/dev/root 6.9G 2.7G 3.9G 41% /
/dev/mmcblk0p1 252M 54M 198M 22% /boot
Display Specific File System
You can also check a specific mount point:
df -h /boot
Show File System Type
Add -T to include file system type:
df -T
Combine Options
Combine options to show file system type and use human-readable format:
df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/root ext4 6.9G 2.7G 3.9G 41% /
/dev/mmcblk0p1 vfat 252M 54M 198M 22% /boot
Batch Scripting Use¶
The df command is useful in scripts to check for low disk space:
if df / | awk 'NR==2 {exit ($5+0 >= 90)}'; then
echo "Warning: disk usage above 90%!"
fi
Tip for Raspberry Pi Users¶
On Raspberry Pi Zero 2 W with limited SD card storage, regularly checking disk space with df -h helps prevent system issues caused by a full root partition.
df vs du¶
dfshows disk usage at the file system level.dushows disk usage for individual files and directories.
df means: “Disk Free”¶
Fun fact: the name stands for disk free, and it’s been a Unix tool for decades!
df helps you stay in control of your Pi’s storage!