WARNING: This page is archived and not updated. Please bear in mind any information may be incorrect and any code may not work. Use at your own risk.
James Gardner: Home > Blog > 2009 > New Hetzner Server

New Hetzner Server

Posted:2009-06-10 14:14
Tags:Web, Virtulization, Hosting

I bought a new Hetzner EQ4 Server last week. Here are the specs:

CPU

This is supposed to be a quad-core CPU but according to Wikipedia it has "Re-implemented Hyper-threading. Each of the four cores can process up to two threads simultaneously, so the processor appears to the OS as eight CPUs."

http://en.wikipedia.org/wiki/Intel_Core_i7

Here's the output of /proc/cpuinfo:

Debian-50-lenny-64-minimal:~# cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 0
cpu cores   : 4
apicid              : 0
initial apicid      : 0
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5350.87
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 1
cpu cores   : 4
apicid              : 2
initial apicid      : 2
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.45
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 2
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 2
cpu cores   : 4
apicid              : 4
initial apicid      : 4
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.45
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 3
cpu cores   : 4
apicid              : 6
initial apicid      : 6
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.45
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 4
vendor_id   : GenuineIntel
cpu family  : 6s

model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 0
cpu cores   : 4
apicid              : 1
initial apicid      : 1
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.44
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 5
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 1
cpu cores   : 4
apicid              : 3
initial apicid      : 3
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.45
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 6
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 2
cpu cores   : 4
apicid              : 5
initial apicid      : 5
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.46
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

processor   : 7
vendor_id   : GenuineIntel
cpu family  : 6
model               : 26
model name  : Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
stepping    : 4
cpu MHz             : 1600.000
cache size  : 8192 KB
physical id : 0
siblings    : 8
core id             : 3
cpu cores   : 4
apicid              : 7
initial apicid      : 7
fpu         : yes
fpu_exception       : yes
cpuid level : 11
wp          : yes
flags               : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm ida
bogomips    : 5346.45
clflush size        : 64
cache_alignment     : 64
address sizes       : 36 bits physical, 48 bits virtual
power management:

Disk Configuration

There are two disks in a software RAID-1 configuration.

Debian-50-lenny-64-minimal:~# fdisk -l

Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000969c3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         523     4200997   fd  Linux raid autodetect
/dev/sda2             524         785     2104515   fd  Linux raid autodetect
/dev/sda3             786       91201   726266520   fd  Linux raid autodetect

Disk /dev/sdb: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006e990

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         523     4200997   fd  Linux raid autodetect
/dev/sdb2             524         785     2104515   fd  Linux raid autodetect
/dev/sdb3             786       91201   726266520   fd  Linux raid autodetect

Disk /dev/md0: 4301 MB, 4301717504 bytes
2 heads, 4 sectors/track, 1050224 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 2154 MB, 2154954752 bytes
2 heads, 4 sectors/track, 526112 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md2: 743.6 GB, 743696826368 bytes
2 heads, 4 sectors/track, 181566608 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

You can see this gives us 652G free space to play with:

Debian-50-lenny-64-minimal:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md2              688G  625M  652G   1% /
tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
udev                   10M   96K   10M   1% /dev
tmpfs                 4.0G     0  4.0G   0% /dev/shm
/dev/md1              2.0G   86M  1.9G   5% /boot

Memory

There is 8Gb RAM:

Debian-50-lenny-64-minimal:~# free -m
             total       used       free     shared    buffers     cached
Mem:          8001         84       7917          0          6         23
-/+ buffers/cache:         54       7947
Swap:         4102          0       4102
Debian-50-lenny-64-minimal:~#

Re-Installation with LVM

Note

I wasn't sure how to make an exist RAID partition into an LVM2 one so instead I re-installed the whole OS. This section is a tutorial you can follow to do the same.

Log into the Hetzner server, under Main Functions -> Servers you can select your server. Choose the rescue tab, choose 64bit and then activate request. Make a note of the password.

Reset a server Reset a server

Now login to the server via SSH and restart it, the rescue system will boot. You've only got 5 mins though:

Debian-50-lenny-64-minimal:~# reboot

The system is going down for reboot NOW!nny-64-minimal (pts/0) (Tue Jun  9 13
Debian-50-lenny-64-minimal:~# Connection to 188.40.40.131 closed by remote host.
Connection to 188.40.40.131 closed.
james@dirac:~$

If all goes well, after a minute or two you'll be able to sign into the rescue system. You can now SSH into the server but use the new password you've just been given. You'll see this unless you remove the entry from /home/james/.ssh/known_hosts or delete the file completely:

james@dirac:~$ ssh root@188.40.40.131
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
5a:ad:96:fe:28:53:eb:52:d6:bf:59:4b:26:51:7a:40.
Please contact your system administrator.
Add correct host key in /home/james/.ssh/known_hosts to get rid of this message.
Offending key in /home/james/.ssh/known_hosts:18
RSA host key for 188.40.40.131 has changed and you have requested strict checking.
Host key verification failed.

Then you can login:

Linux rescue 2.6.28 #3 SMP Mon Feb 2 15:21:43 CET 2009 x86_64

------------------------------------------------------------------

  Welcome to the Hetzner Rescue System.

  This Rescue System is based on Debian 5.0 (lenny) with a newer
  kernel. You can install software like in a normal system.

  To install a new operating system from one of our prebuilt
  images, run 'installimage' and follow the instructions.

  For more information take a look at http://wiki.hetzner.de

------------------------------------------------------------------

-bash: .oldroot/nfs/functions.sh: No such file or directory
Hardware data:

   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   CPU  Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
   RAM  7975 MB
   Disk /dev/sda: 750.1 GB  (=> 715 GIB)
   Disk /dev/sdb: 750.1 GB  (=> 715 GIB)

root@rescue ~ #

You then run the installimage command:

Img 8111 Img 8114 Img 8116

You'll want to edit a few settings:

HOSTNAME = fourier

The problem with the Hetzner setup is that you can't create a load of partitions and then create a single LVM volume group accross them all.

PART /boot ext3 512M boot
PART lvm vg_root 50G
LV vg_root root / ext3 20G
LV vg_root swap swap ext3 8G
LV vg_root tmp /tmp ext3 2G
PART /vg0 ext3 50G
PART /vg1 ext3 50G
PART /vg2 ext3 50G
PART /vg3 ext3 50G
PART /vg4 ext3 50G
PART /vg5 ext3 50G
PART /vg6 ext3 50G
PART /vg7 ext3 50G
PART /vg8 ext3 50G
PART /vg9 ext3 50G

You'll edit /etc/fstab after the install so that all these partitions aren't used and are instead put into one big volume group.

Img 8116 Img 8116 Img 8116 Img 8116

Now reboot:

root@rescue ~ # reboot

Broadcast message from root@rescue (pts/0) (Tue Jun  9 14:04:17 2009):

The system is going down for reboot NOW!
root@rescue ~ # Connection to 188.40.40.131 closed by remote host.
Connection to 188.40.40.131 closed.
james@dirac:~$

Once again you'll need to remove the entry from /home/james/.ssh/known_hosts then you can login.

You'll need to use the same password you used when you logged into the rescue system, not the one you were originally given.

This time:

fourier:~# fdisk -l

Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006627a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          66      530144+  fd  Linux raid autodetect
/dev/sda2              67        6594    52436160   fd  Linux raid autodetect
/dev/sda3            6595       13122    52436160   fd  Linux raid autodetect
/dev/sda4           13123       91201   627169567+  85  Linux extended
/dev/sda5           13123       19650    52436159+  fd  Linux raid autodetect
/dev/sda6           19651       26178    52436159+  fd  Linux raid autodetect
/dev/sda7           26179       32706    52436159+  fd  Linux raid autodetect
/dev/sda8           32707       39234    52436159+  fd  Linux raid autodetect
/dev/sda9           39235       45762    52436159+  fd  Linux raid autodetect
/dev/sda10          45763       52290    52436159+  fd  Linux raid autodetect
/dev/sda11          52291       58818    52436159+  fd  Linux raid autodetect
/dev/sda12          58819       65346    52436159+  fd  Linux raid autodetect
/dev/sda13          65347       71874    52436159+  fd  Linux raid autodetect

Disk /dev/sdb: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000eda4d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          66      530144+  fd  Linux raid autodetect
/dev/sdb2              67        6594    52436160   fd  Linux raid autodetect
/dev/sdb3            6595       13122    52436160   fd  Linux raid autodetect
/dev/sdb4           13123       91201   627169567+  85  Linux extended
/dev/sdb5           13123       19650    52436159+  fd  Linux raid autodetect
/dev/sdb6           19651       26178    52436159+  fd  Linux raid autodetect
/dev/sdb7           26179       32706    52436159+  fd  Linux raid autodetect
/dev/sdb8           32707       39234    52436159+  fd  Linux raid autodetect
/dev/sdb9           39235       45762    52436159+  fd  Linux raid autodetect
/dev/sdb10          45763       52290    52436159+  fd  Linux raid autodetect
/dev/sdb11          52291       58818    52436159+  fd  Linux raid autodetect
/dev/sdb12          58819       65346    52436159+  fd  Linux raid autodetect
/dev/sdb13          65347       71874    52436159+  fd  Linux raid autodetect

Disk /dev/md0: 542 MB, 542769152 bytes
2 heads, 4 sectors/track, 132512 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 53.6 GB, 53694562304 bytes
2 heads, 4 sectors/track, 13109024 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md2: 53.6 GB, 53694562304 bytes
2 heads, 4 sectors/track, 13109024 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/md3: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md3 doesn't contain a valid partition table

Disk /dev/md4: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md4 doesn't contain a valid partition table

Disk /dev/md5: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md5 doesn't contain a valid partition table

Disk /dev/md6: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md6 doesn't contain a valid partition table

Disk /dev/md7: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md7 doesn't contain a valid partition table

Disk /dev/md8: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md8 doesn't contain a valid partition table

Disk /dev/md9: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md9 doesn't contain a valid partition table

Disk /dev/md10: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md10 doesn't contain a valid partition table

Disk /dev/md11: 53.6 GB, 53694496768 bytes
2 heads, 4 sectors/track, 13109008 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk identifier: 0x00000000

Disk /dev/md11 doesn't contain a valid partition table

Disk /dev/dm-0: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-1 doesn't contain a valid partition table

Disk /dev/dm-2: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-2 doesn't contain a valid partition table

You can now unmount the /vg0, /vg1 etc partitions:

# umount /vg*

Edit /etc/fstab and comment out the lines with those partitions:

proc /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/md0 /boot ext3 defaults 0 0
# /dev/md1 belongs to LVM volume group 'vg_root'
#/dev/md2 /vg0 ext3 defaults 0 0
#/dev/md3 /vg1 ext3 defaults 0 0
#/dev/md4 /vg2 ext3 defaults 0 0
#/dev/md5 /vg3 ext3 defaults 0 0
#/dev/md6 /vg4 ext3 defaults 0 0
#/dev/md7 /vg5 ext3 defaults 0 0
#/dev/md8 /vg6 ext3 defaults 0 0
#/dev/md9 /vg7 ext3 defaults 0 0
#/dev/md10 /vg8 ext3 defaults 0 0
#/dev/md11 /vg9 ext3 defaults 0 0
/dev/vg_root/root  /  ext3  defaults 0 0
/dev/vg_root/swap  swap  ext3  defaults 0 0
/dev/vg_root/tmp  /tmp  ext3  defaults 0 0

Now remove the directories:

# rm -r /vg[0-9]

Now initialise the physical volumes LVM will use:

# pvcreate /dev/md2 /dev/md3 /dev/md4 /dev/md5 /dev/md6 /dev/md7 /dev/md8 /dev/md9 /dev/md10 /dev/md11
  Physical volume "/dev/md2" successfully created
  Physical volume "/dev/md3" successfully created
  Physical volume "/dev/md4" successfully created
  Physical volume "/dev/md5" successfully created
  Physical volume "/dev/md6" successfully created
  Physical volume "/dev/md7" successfully created
  Physical volume "/dev/md8" successfully created
  Physical volume "/dev/md9" successfully created
  Physical volume "/dev/md10" successfully created
  Physical volume "/dev/md11" successfully created

Now create a volume group. You can do this all one go by specifying all devices in the first command and not using the second or by creating a volume group and extending it:

fourier:/# vgcreate vg_data /dev/md2 /dev/md3 /dev/md4 /dev/md5 /dev/md6 /dev/md7 /dev/md8
  Volume group "vg_data" successfully created
fourier:/# vgextend vg_data/dev/md9 /dev/md10
  Volume group name vg_data/dev/md9 has invalid characters
fourier:/# vgextend vg_data /dev/md9 /dev/md10
  Volume group "vg_data" successfully extended
fourier:/# vgextend vg_data /dev/md11
  Volume group "vg_data" successfully extended

Now check the setup:

fourier:/# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_data" using metadata type lvm2
  Found volume group "vg_root" using metadata type lvm2

We want to create a different logical volume for each virtual machine so that we can take snapshots of virtual machines indivdually.

I'm writing separate tutorials on configuring the OS and setting up OpenVZ, just drop me an email if you want the first drafts.

If you have a problem and need to mount an LVM volume via a rescue disk you can do this:

root@rescue /mnt # lvdisplay | grep "LV Name"
  LV Name                /dev/vg_root/root
  LV Name                /dev/vg_root/swap
  LV Name                /dev/vg_root/tmp
root@rescue /mnt # vgchange -a y vg_root
  3 logical volume(s) in volume group "vg_root" now active
root@rescue /mnt # mount /dev/vg_root/root /mnt/test/

That's it so far!

Update 2009-08-31: A few people have asked why I've used so many physical partitions instead of just one. The answer is so that if I ever want to re-arrange the physical partitions I stand a good chance of being able to do so by moving data around to other partitions. If I had one partition and wanted to change the structure I wouldn't have any other partitions to move the data to so I would be stuck with the initial configuration. The reason for a large number of partitions is that the more you have, the more flexibility you have to start with and since they can all be grouped into one volume group or one logical volume anyway there is no harm in doing so. Do people think this is a sensible approach? James.

(view source)

James Gardner: Home > Blog > 2009 > New Hetzner Server