[SOLVED] Restore to ZFS ("volume size must be a multiple of volume block size")

michaeljk

Renowned Member
Oct 7, 2009
60
3
73
When I try to restore a RAW image to a new server with ZFS, I get this error:

Code:
restore vma archive: lzop -d -c /mnt/pve/pmxnfs/dump/vzdump-qemu-165-2016_08_26-16_55_26.vma.lzo|vma extract -v -r /var/tmp/vzdumptmp176751.fifo - /var/tmp/vzdumptmp176751
CFG: size: 272 name: qemu-server.conf
DEV: dev_id=1 size: 40000000000 devname: drive-ide0
CTIME: Fri Aug 26 16:55:27 2016
TASK ERROR: command 'lzop -d -c /mnt/pve/pmxnfs/dump/vzdump-qemu-165-2016_08_26-16_55_26.vma.lzo|vma extract -v -r /var/tmp/vzdumptmp176751.fifo - /var/tmp/vzdumptmp176751' failed: zfs error: cannot create 'tank/vm-disks/vm-165-disk-1': volume size must be a multiple of volume block size

ls -l /var/lib/vz/images/165/
total 38665648
-rw-r--r-- 1 root root 40000000000 Aug 26 17:47 vm-165-disk-1.raw

cat /etc/pve/qemu-server/165.conf
...
ide0: local:165/vm-165-disk-1.raw,format=raw,size=39062500K
...

This is an old machine which we migrated from a physical (IDE) harddisk some years ago. Problem seems to be the filesize of the RAW image, but how can I solve this? Resizing the image (adding zeros at the end) until it reaches a multiple of the volume block size?
 
40000000000 seams to be a very strange size (4K aligned, but not 8K for ZFS). Adding a single 4K block at the end will be sufficient.
 
I tried adding 4096 bytes (zeros) at the end of the raw image:

Code:
ls -l
total 77331296
-rw-r--r-- 1 root root 40000000000 Aug 28 17:05 vm-165-disk-1.raw

dd if=/dev/zero bs=1 count=4096 >> vm-165-disk-1.raw
4096+0 records in
4096+0 records out
4096 bytes (4.1 kB) copied, 0.00849172 s, 482 kB/s

ls -l
total 77331300
-rw-r--r-- 1 root root 40000004096 Aug 28 17:10 vm-165-disk-1.raw

Then I made the backup again and started the import on the zfs volume:

Code:
restore vma archive: lzop -d -c /mnt/pve/pmxnfs/dump/vzdump-qemu-165-2016_08_28-17_11_30.vma.lzo|vma extract -v -r /var/tmp/vzdumptmp31389.fifo - /var/tmp/vzdumptmp31389
CFG: size: 271 name: qemu-server.conf
DEV: dev_id=1 size: 40000004096 devname: drive-ide0
CTIME: Sun Aug 28 17:11:33 2016
new volume ID is 'vm-disks:vm-165-disk-1'
map 'drive-ide0' to '/dev/zvol/tank/vm-disks/vm-165-disk-1' (write zeros = 0)
progress 1% (read 400031744 bytes, duration 1 sec)
progress 2% (read 800063488 bytes, duration 3 sec)
[...]
progress 99% (read 39599996928 bytes, duration 170 sec)
progress 100% (read 39999963136 bytes, duration 172 sec)

** (process:31392): ERROR **: restore failed - got wrong block address - write bejond end
/bin/bash: line 1: 31391 Done                    lzop -d -c /mnt/pve/pmxnfs/dump/vzdump-qemu-165-2016_08_28-17_11_30.vma.lzo
     31392 Trace/breakpoint trap   | vma extract -v -r /var/tmp/vzdumptmp31389.fifo - /var/tmp/vzdumptmp31389
temporary volume 'vm-disks:vm-165-disk-1' sucessfuly removed
TASK ERROR: command 'lzop -d -c /mnt/pve/pmxnfs/dump/vzdump-qemu-165-2016_08_28-17_11_30.vma.lzo|vma extract -v -r /var/tmp/vzdumptmp31389.fifo - /var/tmp/vzdumptmp31389' failed: exit code 133

I found another topic from 2014 with the same problem:
http://pve.proxmox.com/pipermail/pve-user/2014-December/008135.html

Should I also try to resize the raw file to a 64KiB-multiple?
 
Restore with 64k multiple works:

Code:
40000000000/(64*1024) = 610351.5625
610352*(64*1024) = 40000028672

dd if=/dev/zero bs=1 count=28672 >> vm-165-disk-1.raw
28672+0 records in
28672+0 records out
28672 bytes (29 kB) copied, 0.124548 s, 230 kB/s