Feb 22

Format a large 3TB drive under Debian and mount it

Category: Linux   — Published by tengo on February 22, 2012 at 10:47 am

fdisk does not support the newer very large disks, thus we need to rely on parted, which has the GPT option already built-in. In my case, I was installing large Hitachi HDS723030ALA640 3TB drives.

> parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 0 -1

(parted) print
(parted) quit

The mkpart primary 0 -1 means a partition from zero to what is there (-1), so the whole disk. print allows us to see if everything succeeded. After that, format the disk:

> mkfs.ext4 /dev/sdb1

By default, this formatting reserves 5% of the disk for root. But as this disk is not the system disk, we can safely remove  this limit:

tune2fs -r 0 /dev/sdb1

sets the reserved blocks (-r) to zero. After that you should plan where you want to mount your drive. In this example I want to mount the new drive at /mnt/drive, thus I do mkdir /mnt/drive, and then:

Use blkid /dev/sdb1 to find out the UUID of the new drive.

Then enter nano with nano /etc/fstab to update the fstab file like this:

UUID=<insertuuid> /mnt/drive     ext4    noatime,user_xattr,errors=remount-ro  0       1

Here we completely switched of atime (relatime might be a bettert option on desktop systems where some applications use the atime timestamp to for example schedule backups).

After that run mount -a to mount all stuff from fstab, including our newly created drive. df -H should now list your new drive.