Saturday, September 01, 2007

Installing new hard disk on Debian

I got a new disk 40GB disk (found it on the office ether of unused stuff) and installed it on my little Debian server that only has a 20GB disk on it.

The usage of the new disk would be something very productive for the organization, we will use it to share movies!. Ok probably IT Security will kick my ass if they found out but we will deal with that later.

So the steps to add the disk are quite simple. This is an IDE disk and the first step is to connect the hardware (power, ide cable etc). Power up and the fun begins.

a) run fdisk /dev/hdb to partition the disk (check dmseg to see the name it has, in my case hdb that is the standard).
b) on fdisk I just created a primary partition and used 100% of the disk. This depends on the purpose of the disk so study your options. Once the partition is created quit fdisk saving the changes.
c) next step is to format the partition. I am using ext3 so the command to run is
mkfs.ext3 /dev/hdb1
d) next you create a mount partition
mkdir /media/muploads
e) next you mount the disk
mount /dev/hdb1 /media/muploads
f) finally change your fstab settings so the disk is mounted on every boot.
vi /etc/fstab
add the following line
/dev/hdb1 /media/muploads ext3 defaults 0 2


That was all. I am sure betting things can be done for RAID, etc. Notes are welcome (almost).
Good luck

2 comments:

Anonymous said...

Thanks for this post. Since it's a procedure that's so important to get right every time, I've used this post for reference every time I format a new drive: at least 10 times this year!

I use cfdisk instead of fdisk - might be worth considering.

Anonymous said...

Thanks! I need that tut.