web analytics

Hetzner server with > 2TB disk

Recently I ordered a Hetzner server for one of our clients. The server had two 3TB disks. Hetzner provides a command line installation of the desired OS once we login to their server. As such, I logged in to the server and installed Centos6 by executing “installimage” option as suggested by Hetzner.

After installing OS and rebooting the server, I noticed that the 3T disk is not showing full space.

[root@abc ~]#df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        99G  2.5G   91G   3% /
tmpfs           463M     0  463M   0% /dev/shm
/dev/sda2       976M  126M  800M  14% /boot

/dev/sda4   2.3T     123M   2.2T  1% /home

If the disk size is greater than 2T you cannot use normal fdisk to create partition. Instead you should use parted. However, with Hetzner, the installation was all automated so there was no way to make changes.

[root@slave1 ~]# parted –list

Model: ATA ST33000650NS (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

I noticed that the partition table was msdos, and would need to change it to GPT if I need to use the disk space fully.

With Hetzner, to get this working, I added the following line to the custom installation setup just before where the partitions were mentioned. Make sure to add the line in bold before the partitions.

FORCE_GPT 2

PART swap swap 16G

PART /boot ext4 512M

PART / ext4 1024G

PART /home ext4 all

After that when the OS was installed, it showed full usage of the disk.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>