How to Add a New Hard Disk to Fedora 37

inside an open hard disk drive
Photo by Sergei Starostin on Pexels.com

Hello everyone, welcome to Manjaro.site. In this article, we will learn how to add a new hard disk to Fedora 37. I am using Fedora 37 installed on my MacBook M1 Pro using Parallels. But don’t worry, if you are installing your Fedora 37 in a different way, this should be the same. In this example, I have a Fedora 37 server virtual machine with two hard disks connected to it. One hard drive is for the Fedora system and then I added a new disk to it. So now, we will configure this new hard disk to work with Fedora 37.

First, we need to check if the new hard disk is detected by the system. In Terminal, use this command

sudo fdisk -l

Make sure the system can detect the new hard disk as you can see below.

As you can see, my new hard disk is detected as /dev/sdb. Now we are going to create a new partition on it and then format this disk so we can use it. See the following video to create a new partition on the new hard disk /dev/sdb. Change it to match your own situation.

We should now have a new partition /dev/sdb1 on the disk /dev/sdb. You can check it with the fdisk command again.

[dhani@localhost ~]$ sudo fdisk -l
Disk /dev/sda: 64 GiB, 68719476736 bytes, 134217728 sectors
Disk model: Fedora Linux-0 S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5B14AC61-4C35-45A8-8F00-8F50A74BB0C6

Device       Start       End   Sectors  Size Type
/dev/sda1     2048   1230847   1228800  600M EFI System
/dev/sda2  1230848   3327999   2097152    1G Linux filesystem
/dev/sda3  3328000 134215679 130887680 62.4G Linux LVM


Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: Fedora Linux-1 S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xc2af9c9a

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1        2048 20971519 20969472  10G 83 Linux

As you can see, now I have the /dev/sdb1 partition as shown above. Now we are going to format this.

sudo mkfs.ext4 /dev/sdb1

The command will format the partition to the ext4 filesystem. Finally, let’s mount it.

#Create a new directory for mount point
sudo mkdir /mnt/disk02

#Now mount it with this command
sudo mount /dev/sdb1 /mnt/disk02

Now check if it mounted correctly

sudo df -kh

#Example output:
[dhani@localhost ~]$ df -kh
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 4.0M     0  4.0M   0% /dev
tmpfs                    979M     0  979M   0% /dev/shm
tmpfs                    392M  1.1M  391M   1% /run
/dev/mapper/fedora-root   15G  2.0G   13G  14% /
tmpfs                    979M     0  979M   0% /tmp
/dev/sda2                960M  300M  661M  32% /boot
/dev/sda1                599M  6.5M  593M   2% /boot/efi
tmpfs                    196M     0  196M   0% /run/user/1000
/dev/sdb1                9.8G   24K  9.3G   1% /mnt/disk02

As you can see, the partition /dev/sdb1 is mounted at /mnt/disk02. To make it permanent during boot, we can add this line to /etc/fstab

sudo nano /etc/fstab

#Add the following lines
/dev/sdb1   /mnt/disk02  ext4   defaults    0   0

Done. At this point, we have successfully added a new hard disk to Fedora 37, create a partition, formatted it, and mount it. Thanks for reading this article. I hope you enjoy it.

Be the first to comment

Leave a Reply