4

I just purchased a server from Hetzner, with two 4TB hard drives and one 1TB SSD. I want to setup the two hard drives (/dev/sda & /dev/sdb) in RAID1 and install the OS on them, and have the SSD (/dev/sdc) as an extra drive.

Until now, all my tentatives failed. The installimage script runs fine, and tells me that I just need to reboot. But when I reboot, I have this error:

enter image description here

I tried fixing the error without luck and gave up, as I suspect that the problem comes from my installimage script config.

Here's the configs I used for all my tries:

DRIVE1 /dev/sda
DRIVE2 /dev/sdb
#DRIVE3 /dev/sdc # commented to exclude it from the RAID setup
SWRAID 1
SWRAIDLEVEL 1
BOOTLOADER grub
HOSTNAME EX51

And here are the different partitioning schemes I tried:

1°) Nearly the default config

PART  swap   swap   32G
PART  /boot  ext3   512M
PART  /      ext4   all

2°) A try with LVM

PART  /boot  ext3   512M
PART  lvm    vg0    all

LV  vg0  swap  swap  swap  4G
LV  vg0  root  /     ext4  all

3°) Partitions smaller than 2TB in case that the system does not use grub2 (is it?)

PART  swap   swap   32G
PART  /boot  ext3   512M
PART  /      ext4   1T
PART  /p1    ext4   1T
PART  /p2    ext4   1T
PART  /p3    ext4   all

What am I doing wrong?

Thanks!

EDIT: disabling RAID works.

4
  • have you found a solution? – Freedo Aug 16 '18 at 20:59
  • Yep sorry, I forgot I asked that question! I posted the solution I found, hopefully it will help you! – Tim Autin Aug 16 '18 at 22:05
  • I want to do the inverse. Have my ssd be the system partition and raid 0 the hdds only. So I guess I just comment out the other drivers and install with swraid disabled, then I do it after installation – Freedo Aug 16 '18 at 22:18
  • Yes I'd do the same: comment the HDDs, and setup your RAID after the installation. – Tim Autin Aug 16 '18 at 22:52
6

Tim Autin's answer is brilliant (particularly if like me you don't have access to the console and cannot see the boot messages), but I'm going to add some additional bits as I think the installimage has changed slighly since his original answer - or I was simply too tired when following it to realise some of the probably obvious points I've highlighted below.

1) Follow Tim's step 1

2) In Tim's step 2 be aware that the current root file system is the installimage file system, not the servers file system, so you need to mount that first.

mkdir /rootPartition
mount /dev/md2 /rootPartition

3) Now complete Tim's step 2, but be aware that any reference to /etc/fstab should be changed to /rootPartition/etc/fstab

4) Reboot - but this probably won't work.

5) If it doesn't reboot then boot back into the Rescue Image (via the Hetzer Robot, mount the root partition (see this answers Step 2 above) and then follow Tim's step 3, remembering to prefix any reference to files (such as /etc/fstab) with /rootPartition.

6) Reboot. This time it should work (it did for me).

Big thanks to Tim for solving this - hope these additions help others.

2
  • Glad I helped! Thanks to you for adding this, if I go through this again (and I hope I won't...) I'll try to update my answer. – Tim Autin Sep 26 '18 at 9:39
  • Two years old, but thank you to both you and @TimAutin. Only note is that my drives were named a bit differently with the large extra drive being /dev/sda so if anyone finds this, make sure you check your own infrastructure and not just a raw copy/paste. – CGuess Aug 3 '20 at 23:57
5

So I finally got it working. I don't remember exactly what went wrong, but here's what I'm doing now:

1°) Use the following config:

DRIVE1 /dev/sda
DRIVE2 /dev/sdb
#DRIVE3 /dev/sdc
SWRAID 1
SWRAIDLEVEL 1
BOOTLOADER grub
HOSTNAME EX61
PART  swap     swap   32G
PART  /boot     ext3    512M
PART  /            ext4    all

2°) Once installimage finished, but before rebooting, create mount folder & update fstab:

Create the mount folder:

mkdir /mountFolder

Update fstab:

cat > /etc/fstab

Paste:

proc            /proc    proc  defaults  0 0
/dev/md/0  none     swap  sw        0 0
/dev/md/1  /boot    ext3  defaults  0 0
/dev/md/3  /            ext4  defaults  0 0
/dev/sdc1  /mountFolder   ext4  defaults  0 0

Then reboot.

3°) If the /dev/md2 error occurs, format the SSD:

parted /dev/sdc mklabel gpt
parted /dev/sdc print unit MB print free

Note the size of the disk for the next command

parted --align optimal /dev/sdc mkpart primary ext4 0% 960197MB // replace the size here
mkfs.ext4 /dev/sdc1

Check if fstab needs to be updated again, if so do it:

cat /etc/fstab

(paste the same as in step 2)

Finally create the mount folder and mount the drive:

mkdir /mountFolder
mount -a
1
  • This answer is great - I've added some clarifications in my own answer that should help point out some additional steps that may now need to be take as I believe the installimage has been updated since this answer was written. – Jamie McNaught Sep 25 '18 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.