6 червня 2019 р.

Disk & Proxmox

Роблю для себе нотатки: Proxmox та робота з накопичувачами.

Physical disk to kvm

lshw -class disk -class storage
...

           *-disk
                description: ATA Disk
                product: ST3000DM001-1CH1
                vendor: Seagate
                physical id: 0.0.0
                bus info: scsi@3:0.0.0
                logical name: /dev/sda
                version: CC27
                serial: Z1F41BLC
                size: 2794GiB (3TB)
                configuration: ansiversion=5 sectorsize=4096
... 
ls -l /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
ls -l /dev/disk/by-id | grep Z1F41BLC
add to kvm :
qm set  592  -virtio2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
update VM 592: -virtio2 /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC
check:
grep Z1F41BLC /etc/pve/qemu-server/592.conf
virtio2: /dev/disk/by-id/ata-ST3000DM001-1CH166_Z1F41BLC,size=2930266584K

 

How to add an existing virtual disk to Proxmox

The first step is to place the disk image into the directory belonging to the virtual machine, on my system that would be /var/lib/vz/images/<id>/
Obviously the disk image should be in one of the formats supported by Proxmox, such as qcow2 or raw. Use qemu-img convert to convert between formats.
Next, go to Proxmox and check if the disk shows up under “Hardware” as an unused disk:

Converting between image formats

qemu-img convert: raw, qcow2, qed, vdi, vmdk, vhd

qemu-img convert -f raw -O qcow2 image.img image.qcow2
qemu-img convert -f vmdk -O raw image.vmdk image.img

VBoxManage: VDI (VirtualBox) to raw

VBoxManage clonehd ~/VirtualBox\ VMs/image.vdi image.img --format raw

 

Import existing disk image to VM

$zfs list
NAME                  USED  AVAIL  REFER  MOUNTPOINT
zpool                43.4G  2.59T    96K  /zpool
zpool/images         1.13G  2.59T  1.13G  /zpool/images

$qm importdisk 100  /zpool/images/FreeBSD-12.0-RELEASE-amd64.qcow2  zpool

$zfs list
NAME                  USED  AVAIL  REFER  MOUNTPOINT
zpool                43.4G  2.59T    96K  /zpool
zpool/images         1.13G  2.59T  1.13G  /zpool/images
zpool/vm-100-disk-0  10.3G  2.60T    56K  -
zpool/vm-100-disk-1  32.0G  2.62T  1.81G  -
Unused Disk 0

Немає коментарів:


Коли забув ти рідну мову, біднієш духом ти щодня...
When you forgot your native language you would become a poor at spirit every day ...

Д.Білоус / D.Bilous
Рабів до раю не пускають. Будь вільним!

ipv6 ready