Setup Hetzner server with multiple drives without LVM

Most Hetzner servers come with multiple drives and if you need a lot of storage, you’re probably using one with a lot of them. In our case, I’m going to setup a GlusterFS brick on each drive, so I don’t need LVM for this.

First of all I’m going to configure the installimage and it should look like this:

PART swap swap 8G
PART /boot ext3 512M
PART / ext 4 50G
PART /home ext4 50G

This is all you need to do here.

First we have to create a new partition on the first drive (/dev/sda) with gdisk. You will have to enter gdisk by using the command gdisk /dev/sda, then press n and you can use all the defaults. Once you are ready, use the w command to write the changes to the partition table. After that the server requires a reboot.

Now we will create a partition on all the other drives, by using the same command gdisk /dev/sdb, press n, use all defaults, and then press w to write changes to the partition table.You will have to do this for each drive.

Once the partitions are created, we have to create a filesystem on the new partitions

mkfs.ext4 /dev/sda6
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdc1
mkfs.ext4 /dev/sdd1

And we’re done. Now we can mount the new partitions. Personally I will make four directories to easily recognize the drives. I will call them /sda, /sdb, /sdc, /sdd.

And I’m going to mount them with the following commands:

mount /dev/sda6 /sda
mount /dev/sdb1 /sdb
mount /dev/sdc1 /sdc
mount /dev/sdd1 /sdd

Unfortunately if you mount them like this, you will lose the mounts after a reboot. If you want them to be preserved, you will have to edit /etc/fstab and edit the following lines:

/dev/sda6 /sda ext4 defaults 0 0
/dev/sdb1 /sdb ext4 defaults 0 0
/dev/sdc1 /sdc ext4 defaults 0 0
/dev/sdd1 /sdd ext4 defaults 0 0

Make sure to change everything to suit your needs.

Leave a Reply

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