correct percent data used after backup and restore disk

This is the normal behavior of dd.
You write all blocks even the zero one.
 
This is the normal behavior of dd.
You write all blocks even the zero one.
You right, But must be a solution for resolve it, for example compact the zero blocked or defragment disk or prevent to write zero block with dd.
Be like defrag in vmware or use VBoxManage modifyhd in the virtualbox. ( +, + ), that resolve same problem for itself.
 
I never tried but
Code:
blkdiscard
should do it
 
  • Like
Reactions: mikeboiko
I never tried but
Code:
blkdiscard
should do it

This do discard all blocks on the device (and remove all partitions and data on disk!)
This command was very dangerous and scary, and I had the chance to do that on a test environment.


Code:
root@pve:~# lvs
  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data          pve twi-aotz-- 16.25g             3.14   1.62
  root          pve -wi-ao----  7.75g
  swap          pve -wi-ao----  3.88g
  vm-100-disk-1 pve Vwi-a-tz-- 32.00g data        0.00
  vm-101-disk-1 pve Vwi-aotz--  2.00g data        25.50
  vm-102-disk-1 pve Vwi-a-tz--  2.00g data        0.00
root@pve:~# dd if=/dev/pve/vm-101-disk-1 of=/dev/pve/vm-102-disk-1
4194304+0 records in
4194304+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 127.083 s, 16.9 MB/s
root@pve:~# lvs
  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data          pve twi-aotz-- 16.25g             15.45  6.74
  root          pve -wi-ao----  7.75g
  swap          pve -wi-ao----  3.88g
  vm-100-disk-1 pve Vwi-a-tz-- 32.00g data        0.00
  vm-101-disk-1 pve Vwi-aotz--  2.00g data        25.50
  vm-102-disk-1 pve Vwi-a-tz--  2.00g data        100.00
root@pve:~# blkdiscard /dev/pve/vm-102-disk-1
root@pve:~# lvs
  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data          pve twi-aotz-- 16.25g             3.14   1.62
  root          pve -wi-ao----  7.75g
  swap          pve -wi-ao----  3.88g
  vm-100-disk-1 pve Vwi-a-tz-- 32.00g data        0.00
  vm-101-disk-1 pve Vwi-aotz--  2.00g data        25.50
  vm-102-disk-1 pve Vwi-a-tz--  2.00g data        0.00
root@pve:~#
 
  • Like
Reactions: mikeboiko
Sorry but I thought this is obviously, that testing of data manipulation allays will be done on test data.
dd has has switch to avoid writing zeros.
Code:
dd conv=sparse if=...