Page cover image

Different types of storage

The different types of storage devices

SD Card

  • Built-in microSD card slot

  • Reasonably priced

  • Low power draw

  • Limited in size (max 2TB theoretically, but not yet available)

Regular Hard Drive or SSD

  • Most cost-effective for large storage

  • Requires external power supply for typical external drives

  • Internal drives need a USB adapter or enclosure

  • SSDs may be powered directly by the Pi, depending on power draw

What does solid state drive mean?

In the context of storage, SSD stands for Solid State Drive. An SSD is a type of non-volatile storage media that stores persistent data on solid-state flash memory.

Unlike a hard disk drive (HDD), an SSD has no moving parts, which gives it advantages such as faster access times, lower latency, and improved resistance to physical shock.

SSDs use a type of flash memory called NAND to store data, which allows for data retention even when the device is not powered. The lack of moving parts not only makes SSDs more durable but also significantly faster than traditional HDDs, as data can be read from or written to the storage almost instantly.

Linux Storage Concepts

Filesystems:

  • Windows: Drive letters (C:, D:, etc.), each treated as a separate entity

  • Linux: Unified filesystem, everything mounted under the root directory (/)

Device Naming:

  • Hard drives represented as /dev/sda, /dev/sdb, etc. (inherited from SCSI naming)

  • USB doesn't determine drive order, so sda/sdb can change on reboot

Partitions:

  • Hard drives can be divided into multiple partitions

  • Partition table tracks the start and end of each partition

  • Two main partition table formats: a) MBR (Master Boot Record): Older, 32-bit, 2TB size limit b) GPT (GUID Partition Table): Newer, 64-bit, 9ZB size limit, uniquely identifies partitions

Filesystem Formats:

  • NTFS: Windows default, widely compatible, best performance on Windows

  • ext4: Linux default, best performance on Linux, not natively supported on Windows/Mac

  • Choice depends on intended use (portability vs. performance)

Mounting:

  • Partitions must be mounted to be accessible in the filesystem

  • Mounted at a specific directory (e.g., /mnt/data)

  • Can be mounted anywhere, allowing flexible organization

Preparing the Drive

Partitioning with parted:

  • Create a new partition table (GPT recommended)

  • Create partitions for operating system (if desired) and data

  • Specify filesystem type (NTFS or ext4) and size for each partition

Formatting with mkfs:

  • Create the actual filesystem on each partition

  • Use mkfs.ntfs for NTFS partitions, mkfs.ext4 for ext4 partitions

  • Assign a label (name) to each filesystem

Mounting:

  • Create a mount point directory (typically under /mnt)

  • Mount the partition to the directory using the mount command

  • Configure /etc/fstab to mount the partition automatically on boot a) Use partition UUIDs to uniquely identify partitions b) Specify mount point, filesystem type, and options (e.g., noatime)

  • Reboot to test automatic mounting

By following these steps, you can add and configure storage on your Raspberry Pi, ensuring that it is mounted consistently and with the desired filesystem format. Regular backups are crucial to protect your data and configuration throughout the process.

Last updated

Was this helpful?