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!