Adding a new HDD

Adding a new HDD

We have a nice HDD tower with plenty of slots for our drives and a few new discs, but how to connect them respective make them visible in Linux? First of all, put them into place, meaning connect them to the computer.

Then, open a terminal and type

sudo fdisk -l | grep '^Disk'

to see a list of all detected drives. This should look then something like this

Disk /dev/sdg: 7.3 TiB, 8001563222016 bytes, 15628053168 sectors
Disklabel type: gpt
Disk identifier: 16854A25-1530-4CE8-A58C-XXXXXXXXXXXX
Disk /dev/sdn: 9.1 TiB, 10000831348736 bytes, 19532873728 sectors
Disklabel type: gpt
Disk identifier: 019399A0-2058-6249-84AA-XXXXXXXXXXXXX
Disk /dev/sdo: 9.1 TiB, 10000831348736 bytes, 19532873728 sectors

The important part here is the last row, you see the disc at /dev/sdo that looks somewhat different from the others, e.g. it does not have a disc identifier. This is the new disc that we want to add to our file system.

For that, we start fdisk with that identifier as paramter like this

sudo fdisk /dev/sdo

The default partition is usually a DOS partition and is restricted to 2Tb, so this is nothing that we want, hence we create a new GPT table by typing just ‘g’. Once we have that, we add a new partitition by typing ‘n’, followed by just confirming the default settings. This will create one large partitition. If you want to have some smaller ones, of course that can be done also, just by repeating this n step, with different partitition numbers.

Once we have created our partitition table, it is time to write it to the disc and type ‘w’. This brings us back to the terminal, but now the table is written to the disc. We can confirm this by running again the fdisk -l command we tried already earlier. Now we can see, that the disc has a label and also an identifer.

The next step is now to format the drive. This can be done like this (please notice, that we have to specify also the partitition number, hence it is sdo1 instead of sdo…)

sudo mkfs.ext3 /dev/sdo1

After that, we create the mount point somewhere and transfer the ownership to us, e.g.

sudo mkdir /media/myDisc6
sudo chown daniel /media/myDisc6
sudo chgrp daniel /media/myDisc6

Once we have that we can mount the drive

sudo mount /dev/sdo1 /media/myDisc6/

Further we can include our drive to the fstab so that it will be mounted automatically, once we login. For that we edited the corresponding file (here with the editor vim)

sudo vim /etc/fstab

and add to the bottom of the file

/dev/sdo1               /media/myDisc6           ext3    defaults        1 2

and save it. That’s it, next time we login the drive should be mounted automatically. Actually, instead of using the name, it would be better to use the identifier of the drive, as this remains always the same, so I should change this part here at one point…

Leave a Reply

%d bloggers like this: