I have been using Hetzner for a while and the Rescue System can be confusing, so I’m going to help you setup LVM to use all drives if you’ve got a multi-drive server.
First I’m going to configure the installimage and disable software RAID, because I don’t need it.
Then I will configure the partitions and LVM. So the installimage should look like this:
SWRAID 0 PART /boot ext3 512M PART lvm vg0 all LV vg0 root / ext4 50G LV vg0 swap swap 4G LV vg0 tmp /tmp reiserfs 5G LV vg0 home /home ext4 50G
Make sure to comment their default drive configuration and then you’re ready to go.
After you boot in your newly installed operating system, there isn’t much left to do.
First you have to add a physical volume to LVM (one for each drive):
pvcreate /dev/sdb /dev/sdc /dev/sdd
Then we’ll extend the volume group with the newly added physical volumes:
vgextend vg0 /dev/sdb /dev/sdc /dev/sdd
Now we add all the free space we have left to the logical volume:
lvextend -l +100%FREE /dev/vg0/root
And finally we extend the file system:
Now you can mount it:
mkdir /storage mount /dev/mapper/vg0-home /storage
Please note that
resize2fs only works with
ext4. If you want to use XFS you will have to use
3 thoughts on “Setup LVM on Hetzner and use all drives”
Nice description, especially since Hetzner does not provide sufficient info on this.
1. Instead of “pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1”, I used “pvcreate /dev/sdb /dev/sdc /dev/sdd” (no trailing “1”)
2. There is a typo in “lvextend vg0 /dev/sdb1 /dev/sdc1 /dev/sdd1”. It should be “vgextend”, i.e. “vgextend vg0 /dev/sdb1 /dev/sdc1 /dev/sdd1” (and again, I found the device names /dev/sdb, without the “1”).
Thanks for the comments. I have edited the post, it seems like I’ve written it in a hurry.
LV vg0 swap swap 4G – fails
You need 3 swaps.