Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Narcis Garcia
Okay, more clear report: $ lsblk -do NAME,ROTA,DISC-GRAN El 10/4/19 a les 14:12, Pascal ha escrit: > I would tend to say that "discard" is not related to "ssd" while "rotational" > is... > > Le mer. 10 avr. 2019 à 14:06, Pascal a écrit : > >> lsblk -ndo ROTA /dev/sda >> >> sorry for the bad

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Pascal
I would tend to say that "discard" is not related to "ssd" while "rotational" is... Le mer. 10 avr. 2019 à 14:06, Pascal a écrit : > lsblk -ndo ROTA /dev/sda > > sorry for the bad copy. > > Le mer. 10 avr. 2019 à 12:52, Narcis Garcia a > écrit : > >> Can be this rotational detection be

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Pascal
lsblk -ndo ROTA /dev/sda sorry for the bad copy. Le mer. 10 avr. 2019 à 12:52, Narcis Garcia a écrit : > Can be this rotational detection be affecting in this case? > > https://lists.openvz.org/pipermail/users/2019-April/007564.html > (Devuan 1.0 VM with distro kernel succeeds with lsblk and

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Narcis Garcia
Can be this rotational detection be affecting in this case? https://lists.openvz.org/pipermail/users/2019-April/007564.html (Devuan 1.0 VM with distro kernel succeeds with lsblk and fstrim) How can I make guest OS to detect device as no rotational or true SSD? El 10/4/19 a les 12:47, Narcis

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Narcis Garcia
Pascal, I don't understand syntax you use for lsblk. I see this with: $ cat /sys/block/sda/queue/rotational El 10/4/19 a les 12:38, Pascal ha escrit: > it's ok with discard=unmap option (even if the disc is thick-provisioned) > : the block used by the test file appears (VM side) or is reset

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-10 Thread Pascal
it's ok with discard=unmap option (even if the disc is thick-provisioned) : the block used by the test file appears (VM side) or is reset (host side) at zero. notice that lsblk "thinks" that the disc is a rotational disk (eg. not really SSD) : lsblk -ndo /dev/sda 1 thanks for explanations

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-09 Thread Narcis Garcia
I see now the simple: -device virtio-scsi-pci makes all -disk (media=disk) to be detected by guest as SSD Additionally, adding "discard=unmap,detect-zeroes=unmap" to disk image specification makes host Qemu to discard sparse image holes and recover host disk space when guest sends discard signal!

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-09 Thread Narcis Garcia
A test to check if guest Linux kernel treats vdisk as SSD: Instead of: mount /dev/sda1 /ssd mount Do this: mount -o discard /dev/sda1 /ssd mount Anyway I don't think 'strings' test must be reflecting real blocks discard behavior if not: 1. qemu taking image file actions for guest discard signals

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-09 Thread Friedrich Oslage
1. You need to set the discard option for the -drive parameter, eg -drive if=none,...,format=raw,discard=unmap since the default is still to simply ignore discards. You may also want to set the detect-zeroes option to unmap, to discard all-zero blocks instead of actually writing them. 2.

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-09 Thread Narcis Garcia
Thank you. * I use RAW images because of it's easier to offline mount/chroot when some issue happens. * I call directly qemu instead of libvirt I'll try to parse these parameters to a qemu-system call. El 8/4/19 a les 22:03, Friedrich Oslage ha escrit: > Yes. > > You'll have to use the

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-08 Thread Friedrich Oslage
Yes. You'll have to use the virtio-scsi driver, to my knowledge it's the only driver that supports block discards. Quick example: # create a new empty disk $ qemu-img create -f qcow2 disk.qcow2 10G # check size, should only be a few kilobytes $ du -sh disk.qcow2 # add it to your vm $

Re: [Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-05 Thread Narcis Garcia
No; I want to study the possibility of recovering allocated blocs of host filesystem when guest filesystem removes its files (unallocates its blocks). Host -> HD or SSD (independent) with sparse-mode image Guest -> Virtual SSD (to signal discards) El 5/4/19 a les 16:01, Pascal ha escrit: >

[Qemu-discuss] Discard disk image holes for sparse shrink

2019-04-04 Thread Narcis Garcia
Is there a way to specify a disk to be detected as an SSD drive? Once reached this, I want to look for the possibility to recover host space when a guest discards disk image blocks, and this image is RAW format and sparse allocated file. Thank you.