Показаны сообщения с ярлыком dd. Показать все сообщения
Показаны сообщения с ярлыком dd. Показать все сообщения

пятница, 15 июля 2011 г.

Add disk as LVM group to Proxmox

Just a brief remind:

1. Add disk (/dev/sdb) to the host server

2. Do dd if=/dev/zero of={PhysicalVolume} bs=512 count=1
where PhysicalVolume will be /dev/sdb (we'll use whole disk, no partitions) - this will wipe whole disk, just in case.

3. Do pvcreate {PhysicalVolume} - this will give us physical volume named after disk itself (/dev/sdb)

4. Check if PV group created right: pvscan

5. Do vgcreate {VG-name} {PV-group-name}, VG-name should be speak-for-itself name of VG.

6. That's it! Now add the LVM group to the Proxmox VE storage list via web interface, and go to use it!

Clone VM disk

One of flaws of Proxmox is that it does not have ability to clone virtual hard disks. If you store VN disks as files then you simply create another machine, then go to CLI (ssh to cluster node) and cp VM disk (which is file on host machine disk) to file that store new machine disk. But it may be confused to clone disks that are stored on LVM groups.

Here is the solution: use dd instead of cp, and do it in such a way:

dd if=/dev/{sourceLVMGroupName}/vm-{$VMID_SOURCE}-disk-{#} of=/dev/{destLVMGroupName}/vm-{$VMID_NEW}-disk-{#}

For example, if I have such a setup:

# pvscan
PV /dev/sdb VG VG_vmstore lvm2 [931.51 GB / 899.51 GB free]


I simply do

dd if=/dev/VG_vmstore/vm-101-disk-1 of=/dev/VG_vmstore/vm-102-disk-1