Installing my 3TB hard drive on Debian linux step by step

It is simple, here is what you need to know

You can format it EXT4, but ext2 and ext3 are also OK ! ext2 and ext3 allow up to 16TB disks, and file sizes of up to 2TB, ext4 allows much more.

Any linux kernel newer than 2.6.31 should work just fine with “Advanced format” drives using the exact same steps in this article.

MBR only supports 2TB drives, you need GPT, so let us get started

1- apt-get update
2- apt get install parted
3- parted /dev/sdc
4- mklabel gpt
5- Answer yes to: Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
6- mkpart primary ext4 0% 100% (to make a partition as big as the disk (will occupy starting from first megabyte (for alignment) to the end of disk))
7- quit

FYI, if you want multiple partitions, here are the 2 lines that should replace step 6
6- mkpart primary ext4 0% 40%
6- mkpart primary ext4 40% 100%

and remember to format both (sdc1 and sdc2) when you are done with parted

Now to formatting the drive

mkfs.ext4 /dev/sdc1

Before mounting it, i like ext4, but i don’t want a journaling OS on this drive that is not the system drive, so i will need do a few things to the drive first

Lazy writeback
tune2fs -o journal_data_writeback /dev/sdc1

No Journaling
tune2fs -O ^has_journal /dev/sdc1

Now to check what we have

dumpe2fs /dev/sdc1 |grep ‘Filesystem features’
Or maybe if you want the whole thing on the screen
dumpe2fs /dev/sdc1 |more

if has_journal option exist when executing the first – you have journal on the file system

And there we are, Now we need to mount it at boot time by adding it to fstab, to do that, we will need the disk’s unique ID !

8- Now executing the following command will give you the unique ID of this new partition for use with fstab (The disk list we will edit below in step 10)
blkid /dev/sdc1
9- create the directory where you want to mount your hard disk, for example
mkdir /hds
mkdir /hds/3tb
10- Now, we add the following line to fstab, notice that noatime increases performance, but some applications might need or rely on it. postfix does not and i have verified that.

UUID=b7a491b1-a690-468f-882f-fbb4ac0a3b53       /hds/3tb            ext4     defaults,noatime                0       1

11- Now execute
mount -a

You are done,. if you execute
df -h
You should see your 2+TB hard drive in there !

To make sure the drive is aligned correctly, i like to write a file on it and see how fast that goes… so let us use a 2GB file

dd if=/dev/zero of=/hds/WD2000_3/deleteme.img bs=1M count=2000

Outcome came out (for a western digital black 2TB)
First run: 2097152000 bytes (2.1 GB) copied, 5.94739 s, 353 MB/s
Consecutive runs: 2097152000 bytes (2.1 GB) copied, 11.1405 s, 188 MB/s
Outcome came out for a western digital green 3TB
First run: 2097152000 bytes (2.1 GB) copied, 8.32337 s, 252 MB/s
Consecutive runs: 2097152000 bytes (2.1 GB) copied, 14.376 s, 146 MB/s

the consecutive runs give close results, what i printed here is the average

4 thoughts on “Installing my 3TB hard drive on Debian linux step by step”

  1. Using shell ZSH for this, I had to put ^has_journal in quotes like so:

    tune2fs -O ‘^has_journal’ /dev/sdc1

  2. Very useful tutorial ! Thanks a lot 😉

    Just in your case, for example, it’s not :
    dd if=/dev/zero of=/hds/WD2000_3/deleteme.img bs=1M count=2000
    but :
    dd if=/dev/zero of=/hds/3tb/deleteme.img bs=1M count=2000

  3. Sorry bro, you FAIL. Still only sees my 3TB disk as 735G

    root@Netspective-Webfilter:~# df -h -x tmpfs -x devtmpfs
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda1 36G 8.8G 25G 27% /
    /dev/sdb1 735G 69M 698G 1% /hds/3tb
    root@Netspective-Webfilter:~# dd if=/dev/zero of=/hds/3tb/deleteme.img bs=1M count=2000
    2000+0 records in
    2000+0 records out
    2097152000 bytes (2.1 GB) copied, 87.5511 s, 24.0 MB/s
    root@Netspective-Webfilter:~# uname -a
    Linux Netspective-Webfilter 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux

Leave a Reply

Your email address will not be published. Required fields are marked *