Raspberry Pi Disk Drives
The output from the sudo fdisk -l
command you provided displays detailed information about all the disk drives currently recognized by your Raspberry Pi's operating system.
sudo fdisk -l
Here's a breakdown of what this output tells you:
RAM Disks
/dev/ram0 to /dev/ram15: These entries represent RAM disks, which are block devices mapped to segments of your system's RAM. They are shown with a size of 4 MiB each, and a total of 16 such devices are listed. These are used by the system for operations that require fast data access, temporary storage, or testing purposes. Each RAM disk has:
Sector size (logical/physical): 512 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes
Total sectors: 8192 sectors
microSD Card
/dev/mmcblk0: This device represents your microSD card, which is the primary storage device for Raspberry Pi. It is shown with a total size of 238.75 GiB.
This is typical for a Raspberry Pi setup as the microSD card often contains the operating system and user data.
Sector size (logical/physical): 512 bytes
I/O size (minimum/optimal): 512 bytes
Total sectors: 500695040 sectors
This suggests that the entire microSD card is treated as a single block device without separate partitions listed under it, which might mean it has a basic data layout or is being read as a whole unit.
USB Flash Drive
/dev/sda: This is a USB Flash Drive connected to the Raspberry Pi, showing a total capacity of 28.91 GiB. This drive has a DOS disklabel type and contains two partitions:
/dev/sda1:
Type: W95 FAT32 (LBA)
Size: 512M
This is likely a boot partition, formatted with the FAT32 filesystem, commonly used for Raspberry Pi boot partitions or for general compatibility with various operating systems.
/dev/sda2:
Type: Linux
Size: 28.4G
This is a larger partition likely used for Linux files and data storage.
MicroSD Card
To properly analyse the microSD card on your Raspberry Pi, you can use the sudo fdisk -l
command to identify the device name and then use additional commands to gather more information.
Here's how you can analyse the microSD card:
Identify the microSD card device:
sudo fdisk -l
Output
Disk /dev/mmcblk0: 238.75 GiB, 256355860480 bytes, 500695040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Based on the output you provided, the microSD card is represented by the device /dev/mmcblk0
.
It has a total size of 238.75 GiB.
Find Partition Numbers
To find the actual partition numbers for your microSD card, you can use the lsblk
command, which lists block devices and their partitions. Here's how you can find the partition numbers:
Run the following command:
lsblk
This command will display a tree-like output showing the block devices and their partitions.
Look for the entry corresponding to your microSD card (usually /dev/mmcblk0
).
Output
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 28.9G 0 disk
├─sda1 8:1 1 512M 0 part /boot/firmware
└─sda2 8:2 1 28.4G 0 part /
mmcblk0 179:0 0 238.8G 0 disk
Check the partition layout
sudo parted /dev/mmcblk0 print
Output
Model: SD EE4S5 (sd/mmc)
Disk /dev/mmcblk0: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 256GB 256GB ext4
This command displays the partition table of the microSD card, showing the partition numbers, start and end positions, sizes, and file system types.
Check the file system usage:
df -h /dev/mmcblk0*
Output
Filesystem Size Used Avail Use% Mounted on
udev 3.8G 0 3.8G 0% /dev
This command displays the file system disk space usage for partitions on the microSD card.
It shows the total size, used space, available space, and mount points of each partition.
Check the file system type:
sudo blkid /dev/mmcblk0*
This command displays the file system type and UUID (Universally Unique Identifier) of each partition on the microSD card.
Check the file system health (this is if your MicroSD card has partitions)
sudo fsck /dev/mmcblk0p1
sudo fsck /dev/mmcblk0p2
Replace mmcblk0p1
and mmcblk0p2
with the actual partition numbers of your microSD card.
The fsck
command checks the file system integrity and can fix minor issues.
Analyse disk usage visually:
sudo apt install ncdu
sudo ncdu /mount/point
Replace /mount/point
with the actual mount point of the microSD card partition you want to analyse.
ncdu
provides an interactive way to explore the disk usage of directories and files on the microSD card.
Check for bad blocks
sudo badblocks -v /dev/mmcblk0
This command scans the microSD card for bad blocks, which are physical defects on the storage media. It's a destructive test, so make sure to have a backup of your data before running it.
By following these steps, you can gather detailed information about your microSD card, including its partitions, file system types, disk space usage, and health status. This information can help you understand how your Raspberry Pi's storage is organized and identify any potential issues.
Remember to be cautious when running commands with sudo
and double-check the device names and mount points to avoid accidentally modifying or damaging your system.
Last updated
Was this helpful?