Installed a new 4 TB disk, partitioned it – and only 2 TB show up? Then the disk still has an old MBR partition table (also called “msdos”). With 512-byte sectors it can manage 2 TiB at most. For larger drives you need a GPT partition table (GUID Partition Table). This guide shows how to partition a data disk with GPT on Ubuntu or Debian, format it and mount it permanently – entirely without a graphical interface.
Warning: creating a new partition table destroys all data on the disk. Always double-check that it is the right disk!
1. Find the right disk
lsblk -o NAME,SIZE,MODEL,SERIAL,MOUNTPOINTS
You can recognise the new disk by its size and model – and by the fact that it has no mounted partitions yet. In the following examples it is called /dev/sdb. sudo lshw -C disk provides more details.
2. Create the GPT partition table and the partition
With parted this takes a single command:
sudo parted /dev/sdb --script mklabel gpt mkpart storage ext4 1MiB 100%
mklabel gpt– writes a new, empty GPT partition tablemkpart storage ext4 1MiB 100%– creates a partition named “storage” spanning the whole disk. Starting at 1 MiB ensures correct alignment, which matters especially for SSDs and disks with 4K sectors.
Check the result and the alignment:
sudo parted /dev/sdb print
sudo parted /dev/sdb align-check optimal 1
print should show “Partition Table: gpt”, and align-check should report “1 aligned”.
By the way: the widespread claim that fdisk cannot handle GPT has not been true for a long time. Current fdisk also creates a GPT table with the g command. parted has the advantage of being easy to use in scripts, though.
3. Create the file system
sudo mkfs.ext4 -L storage /dev/sdb1
-L storage assigns a label that makes the partition easy to find later. For a pure data disk it is also worth reducing the space reserved for root from 5 % to 1 % – on 4 TB that is roughly 160 GB more usable storage:
sudo tune2fs -m 1 /dev/sdb1
4. Mount permanently
Device names such as /dev/sdb1 can change on the next boot. In /etc/fstab you therefore use the UUID:
sudo mkdir -p /mnt/storage
sudo blkid /dev/sdb1
Enter the UUID shown in a new line of /etc/fstab:
UUID=1234abcd-… /mnt/storage ext4 defaults,nofail 0 2
nofail makes sure the system still boots if the disk happens to be missing. Test before you reboot:
sudo systemctl daemon-reload
sudo mount -a
df -h /mnt/storage
If mount -a reports no error and df shows the full size, you are done.
What about booting from GPT disks?
For pure data disks this does not matter. If the system is supposed to boot from the GPT disk as well, you need either a machine with UEFI (then an additional EFI system partition) or, with a classic BIOS, a small “BIOS boot” partition for GRUB. The Ubuntu installer creates both automatically. If nothing boots any more after changes to the partitions, the article Repairing GRUB will help.
Originally published in 2015, revised in December 2026.