Debian add hard drive

Debian add hard drive

Here I will explain Debian add hard drive. It is a little more to it than just connect the hard drive. Not much more, but a little bit more.

After you have connected the new hard drive to your Debian system and switched it on, your Debian system doesn’t know how to use your new hard drive. Debian knows it is there, but can’t use it for anything.

I have divided the process into four steps.

Debian add hard drive – Step 1

Partition your new hard drive. Even if you don’t need several partitions, you will need to create at least one partition.

Find all detected hard drives.
sudo fdisk -l | grep ‘Disk’

That will output something like this.
Disk /dev/sda: 500.1 GB, 500107862016 bytes
Disk identifier: 0x00000000
Disk /dev/sdb: 60.0 GB, 60022480896 bytes
Disk identifier: 0x7d09ee5f

sdb is new hard drive here. A small SSD I want to run MySQL databases on.

So we know the hard drive is there. Lets create that partition.

sudo fdisk /dev/sdb

Type n to create a new partition. And accept all default values. Once all the values are accepted, type w to write the new partition table and exit. If you messed up something and don’t want to write the new partition table, type q to exit without saving any changes. Everything you do in fdisk is just saved in memory until you hit w .

Debian add hard drive – Step 2

Format the new hard drive.

Here we decided we want to use ext3 partition on our new drive.

Type in:
sudo mkfs.ext3 /dev/sdb1
(sdb1 is the new partition you created in the previous step)

Debian add hard drive – Step 3

Mount the new hard drive

We still can’t use the new hard drive until we mount it. That means we make it useable in our Debian System.

First we create a folder to mount our new hard drive to.

sudo mkdir /disk1

Then we mount sdb1 to the new folder.

sudo mount /dev/sdb1 /disk1

Now your new hard drive should be usable by the system. To verify this, type in df -h
You should find something like this:
/dev/sdb1 60G 22G 35G 39% /disk1

If you restart your system at this point, you will not see your new hard drive. That’s because we haven’t told the system to mount it automatically on boot.

Debian add hard drive – Step 4

Make the new hard drive automatically mounted on boot.

Open your /etc/fstab file. You can do that with vim, nano or some other text editor. I like vim.
sudo vim /etc/fstab

Add this to the bottom of the file.
/dev/sdb1 /disk1 ext3 defaults 1 2

Save and close the file. In vim you do that by first pressing the ESC key, and type :wq

That is how you add a new hard drive to a Debian System.

If you need to download Debian, go to this address https://www.debian.org

Happy hard driving!

About Author

Related Posts

php8 gd

PHP8 gd Activate after installation

PHP8 GD activate after installation. GD doesn’t get activated by default. Not even a reboot after installation will activate it. So how do we do it? In…

Debian 12: linux-image-6.1.0-10amd64

Troubleshooting dependency issues in Debian 12: Resolving linux-image-6.1.0-10amd64 package dependency problems. If you installed the Debian 12 from the live image the issue is the raspi-firmware. Even…

4 Best Free Nas Software That Is Open Source

Free NAS software or operating systems that are free to use and will turn a computer into a NAS more advanced than the dedicated boxes sold. What…

Raspbian default password

Raspbian default password

Looking for the Raspbian default password? It is the most essential username and password that you will need for your raspberry. At least if you are running…

OpenMediaVault default password

OpenMediaVault default password

OpenMediaVault default password is printed in the documentation. I did not see it the first time I installed it either. So I had to do some detective…

Debian change dns

Debian change DNS settings to a new DNS

Debian change DNS settings for speed improvement or privacy. It is really easy to do. So let us see how it’s done and get to it. The…

Leave a Reply