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

From Geekworm Wiki
Revision as of 20:07, 13 April 2022 by Harry (talk | contribs) (Created page with "{{GD Template Impl}} ==How to view the HDD== 1. Check USB device pi@raspberrypi:~ $ lsusb Bus 002 Device 004: ID 152d:0561 JMicron Technology Corp. / JMicron USA Technology...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to view the HDD

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.

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. (sda and 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.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xd830672c.

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: 0xd830672c

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.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y

The signature will be removed by a 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: 0xd830672c

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.

Filesystem/RAID signature on partition 1 will be wiped.

Command (m for help): q

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


Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.


Anonymous user #1

6 months ago
Score 0++

every time I boot the HDD is not mounted and I have to manually mount. What can I do to make it automatically mount first thing before any other process accesses it?

do something in /etc/fstab ?

Thanks in advance, great product!

Anonymous user #1

6 months ago
Score 0++
im using EXT4 on ubuntu server

Walker

6 months ago
Score 0++
Hello, can you provide your order number? Then you can contact us via our email: support@geekworm.com and describe your problem accurately to our technical staff, we will do our best to solve your problem