list all the available disks
First, list all the available disks to see if the new HDD is recognized.
sudo fdisk -l
This will display all the connected disks. The devices are usually named /dev/sda
, /dev/sdb
, and so on, depending on the order of connection.
Check for Partitions
When If partitions exist, you may see a partition like /dev/sdb1
on /dev/sdb
when no partitions exist, Use fdisk to create a new partition on the HDD
sudo fdisk /dev/sdb
Create a Filesystem
create a filesystem on the new partition
sudo mkfs.ext4 /dev/sdb1
Create a Mount Point, and mount it
Create a directory where the new HDD will be mounted
sudo mkdir /mnt/data
sudo mount /dev/sdb1 /mnt/data
Make the Mount Permanent
add a line on /etc/fstab
/dev/sdb1 /mnt/data ext4 defaults 0 0
sudo vi /etc/fstab
Verify the mount
df -h
I studied again. Thanks, our teacher ChatGPT