• sales

    +86-0755-88291180

How to View/Partition/Format/Mount HDD/SSD

How to view the HDD/SSD

1. Check USB device

pi@raspberrypi:~ $ lsusb
Bus 002 Device 004: ID 152d:0561 JMicron Technology Corp. / JMicron USA Technology Corp. JMS551 - Sharkoon SATA QuickPort Duo
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The first line indicates that the USB device has been correctly recognized by the OS.

If you cannot find the corresponding USB device, please check that your USB device is tightly connected, or replug the USB3 connector, or replace the USB3 connector with a USB-A to USB-A cable.

Sometimes, insufficient power supply may also cause the USB device not to be found, so we can also try to replace a high-quality power adapter.


2. View HDD/SSD

pi@raspberrypi:~ $ fdisk -l
fdisk: cannot open /dev/ram0: Permission denied
fdisk: cannot open /dev/ram1: Permission denied
fdisk: cannot open /dev/ram2: Permission denied
fdisk: cannot open /dev/ram3: Permission denied
fdisk: cannot open /dev/ram4: Permission denied
fdisk: cannot open /dev/ram5: Permission denied
fdisk: cannot open /dev/ram6: Permission denied
fdisk: cannot open /dev/ram7: Permission denied
fdisk: cannot open /dev/ram8: Permission denied
fdisk: cannot open /dev/ram9: Permission denied
fdisk: cannot open /dev/ram10: Permission denied
fdisk: cannot open /dev/ram11: Permission denied
fdisk: cannot open /dev/ram12: Permission denied
fdisk: cannot open /dev/ram13: Permission denied
fdisk: cannot open /dev/ram14: Permission denied
fdisk: cannot open /dev/ram15: Permission denied
fdisk: cannot open /dev/mmcblk0: Permission denied
fdisk: cannot open /dev/sda: Permission denied
fdisk: cannot open /dev/sdb: Permission denied

The last two lines indicate that 2 SSDs devices were found. (/dev/sda and /dev/sdb)


3. Check if the hard disk is partitioned.

pi@raspberrypi:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors
Disk model: Tech            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x65b1c901

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1       65535 156301487 156235953 74.5G 83 Linux

Partition 1 does not start on physical sector boundary.

Command (m for help): 

The above result tells us that SDA already has a partition: /dev/sda1

pi@raspberrypi:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors
Disk model: Tech            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x65b1c901

Command (m for help): 

The above result tells us that SDA has no partitions

If the hard disk is not partitioned, we need to partition the hard disk

How to Partition a HDD

pi@raspberrypi:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors
Disk model: Tech            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x65b1c901

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (65535-156301487, default 65535): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (65535-156301487, default 156301487): 

Created a new partition 1 of type 'Linux' and of size 74.5 GiB.

Command (m for help): p
Disk /dev/sda: 74.53 GiB, 80026361856 bytes, 156301488 sectors
Disk model: Tech            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x65b1c901

Device     Boot Start       End   Sectors  Size Id Type
/dev/sda1       65535 156301487 156235953 74.5G 83 Linux

Partition 1 does not start on physical sector boundary.

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Note: If you need to support partitions larger than 2TB, you need to use the parted command

How to format HDD/SSD

pi@raspberrypi:~ $ sudo mkfs.ext4 /dev/sda1
mke2fs 1.46.2 (28-Feb-2021)
/dev/sda1 alignment is offset by 512 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Creating filesystem with 19529494 4k blocks and 4882432 inodes
Filesystem UUID: dc0c2c55-145e-440d-a648-c4909b13c021
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (131072 blocks): 
done
Writing superblocks and filesystem accounting information: done


'/dev/sda1'/ is the first partition of the SDA . If you divide SDA into multiple partitions, there may be /dev/sda2, /dev/sda3, etc.

How to mount HDD/SSD Partition

pi@raspberrypi:~ $ sudo mount /dev/sda1 /mnt
pi@raspberrypi:~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       30354572 8071072  20942064  28% /
devtmpfs          793780       0    793780   0% /dev
tmpfs             958644       0    958644   0% /dev/shm
tmpfs             383460    1296    382164   1% /run
tmpfs               5120       4      5116   1% /run/lock
/dev/mmcblk0p1    258095   50413    207683  20% /boot
tmpfs             191728      24    191704   1% /run/user/1000
/dev/sda1       76314492      24  72392188   1% /mnt

'/dev/sda1' is mounted under '/mnt' folder

TAG: 1.54 inch Passive NFC e-Paper ink (G) RYBW Display Screen No Need Battery Wireless Power & Data Transfer EC200U C4-P01 Development Board QuecPython LTE Cat-1 Bluetooth GNSS Positioning NVIDIA-acess User Guide Raspberry Pi Pico 2 RP2350 CAN Onboard XL2515 CAN Controller RP2350A Industrial ESP32-S3 Relay 8-Channel 8-Ch ESP32-WROOM IOT WiFi Bluetooth HAT For Arduino ESP32-S3 Development Board 4 inch LCD TouchScreen Display 480x480 RS485 /SHT20 /Relay For Arduino LVGL 86 TVbox ESP32 S3 5 inch LCD Development Board 800x480 TouchScreen Display TVBOX LVGL HMI Sensor CAN RS485 ISX031C GMSL Camera H100 Image Sensor IP67 protection rating For Jetson Orin And MAX9296 GMSL camera ESP32 C6 Development Board 1.43 inch AMOLED QSPI Display 1.43inch TouchScreen Dual MIC AudioI Deepseek N16R8 ST servo driver DeepSeek XiaoZhi AI Chat Robot ESP32-S3 1.54 inch LCD N16R8 MUMA Development Board Display Screen Wifi Weather Station TimeClock Raspberry Pi 5 Tang Nano FPGA Demo Code ESP32 0.85inch LCD Program Spotpear DeepSeek XiaoZhi AI Voice Chat Robot BOX ESP32-S3 Development Board 3.5 inch QSPI LCD N16R8 Touchscreen Display 6-Axis /Camera /SD ESP32 S3 AI 1.75 inch Development Board with 1.75inch AMOLED Touchscreen Round Screen Deepseek MPTPU Raspberry Pi 5 TPU AI Kit 2TOPS PCIe to TPU HAT Pi5 For Google Coral Edge TPU RV1103