In this document, we’ll go through how to setup a Hetzner purchased server, using 2 methods to mount your disks in Raid 0.
Make sure your server is in Rescue Mode.
Handy one liner!
echo x | installimage -p /boot:ext3:1G,/:ext4:all -l 0 -r yes -i images/Debian-1010-buster-64-minimal.tar.gz -a -n Hz && reboot
The above command requires no interaction at all. Simply ensure that your server is in rescue mode, then copy/paste the above! As we advise Debian 10 for new installs with our v3 launch of QB Pro coming up, this will install Debian 10 minimal on your server. Do keep in mind that this is for servers utilizing multiple same drives of same space (example: 2x3TB HDD, 3x2TB HDD, 2x1TB SSD etc). This should not be used if your server has various sized drives or utilizes an drive structure such as 1x250GB SSD + 2x3TB HDD. See further down in this article for more on that.
- Type the command
installimage
like shown below.
- You will now be presented with a Distro selection screen:
- Select either Ubuntu or Debian. The next screen will allow you to choose a version.
2 things here:- Go for a version QuickBox/QuickBox Pro Supports
- Select one ending with Your-Version-64-minimal. For example; Ubuntu-2004-focal-64-minimal
- After selecting your version the following screen appears:
- Leave SWRAID at 1, change SWRAIDLEVEL to 0 and type a proper HOSTNAME like Plex-Media-Server (can be done later as well during QuickBox set up) like shown below:
Method 1 – LVM
- Find the following lines and delete them:
- Now go up a bit and uncomment and change the LVM area lines to look like this:
It will take 512 megabyte and use it for boot and use the rest disk group you define a bit below.
Here you use 10G for swap, 20G for temp and all the rest of the storage for a /
mount.
Ps. the Swap line can be removed entirely on systems with lots of ram/space
- Hit F10 and Save:
Method 2
- Find this section below:
- and change the line into this:
It will use 8G for swap, 512 megabytes for boot and all the rest of the storage will be put in /
Ps. the Swap line can be removed entirely on systems with lots of ram/space
- Hit F10 and Save:
- Accept this warning:
Depending on the method chosen the final screen will look similar to this:
Notice the Raid level 0, and the Formatting partitions corresponds with the set up we made.
- Last thing to do is simply – run reboot command and then you can go for a QuickBox set up described in detail https://quickbox.io/knowledge-base/standard-install/
Advanced – Fresh Hetzner server with 2X 3TB HDD and 120GB SSD?
First steps.
- In the
installimage
comment out the 2 HDDS’s.- Just put an
#
in front of them.
- Just put an
- Make sure you disable SWRAID by setting it to 0 and SWRAIDLEVEL can be set to anything since it will not be utilizing it.
- Hit F10 and accept the warnings.
- After Linux is done installing, reboot as shown in the initial part of this guide located in the section above!
Secondly when reboot is done.
- First run
lsblk
to grab the name of each drive you’re looking for/dev/sda
and/dev/sdb
you wont need the SSD obviously
- For each drive you’ll need to type
fdisk /dev/sdx
replace the x with the letter of the drive. and you’ll want to use optionn
to make a new partition, just go ahead and use the smaller value for start and biggest value for last sector since I’m sure you want to utilize the whole drive, then optionp
to print the partition table then optionw
to finalize the whole thing. repeat for all the drives involved. - Once that’s done type the command
ls /dev/sd[a-d]*
this will list each of the drives and their partitions and the output should look something like the following:
/dev/sda /dev/sda1 /dev/sdb /dev/sdb1 /dev/sdc /dev/sdc1 /dev/sdd /dev/sdd1
You will only list devices within that scope therefore you’ll probably only have 4 entries.
- After that you’ll want to fire up
mdadm
and create a raid array but we will be doing it using the partition device files and not the disk devices. Make use of/dev/sda1
and/dev/sdb1
instead of/dev/sda
and/dev/sdb
for this.
mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sda1 /dev/sdb1
- Change
/dev/md0
in the command above to something not already being used and change/dev/sda1
and/dev/sdb1
to the appropriate letters and numbers. Take note of whatmdx
is being used when you runlsblk
you can also change the raid level from 0 to 1 if you want/need the security of not losing your files. - Next you’ll want to type the command
ls -l /dev/disk/by-uuid
and take note of the entries that are there. You should NOT see an entry for your new array. - Type the command
mkfs.ext4 -F /dev/md0
make sure you swap/dev/md0
with whatever you used before. - Type the same command again from the previous step:
ls -l /dev/disk/by-uuid
There should now be a new entry. Copy that new entry (but you only need the UUID) so as to look similar to the following:
lrwxrwxrwx 1 root root 11 Jul 18 17:12 c9399944-da22-456a-8c6b-d768ac3471b1 -> ../../md4
You will only be needing the c9399944-da22-456a-8c6b-d768ac3471b1
part.
Lastly we need to add the whole thing to your fstab file.
- Type
nano /etc/fstab
and add the entry.- You should be adding something like this to the bottom of the file:
UUID=c9399944-da22-456a-8c6b-d768ac3471b1 /path/to/mount ext4 auto 0 0
The only things you need to change are the UUID and the /path/to/mount
for obvious reasons.
- Hit ctrl+x then
y
and enter and you’re all good.
Now you may be wondering…
Why do you mount with the UUID instead of the
Random Internet Person/dev/mdx
format everyone uses?
The reason is because sometimes for no apparent reason that I can find, Linux likes to rename stuff. I setup my array using /dev/md4
and after a reboot it gets renamed to /dev/md127
. So had I mounted it in fstab as /dev/md4
the system won’t boot and creates a headache that takes you over a week to figure out why it doesn’t work.