* [Qemu-devel] fstrim and cache=none @ 2013-06-02 20:21 Dusty Mabe 2013-06-03 6:39 ` Paolo Bonzini 0 siblings, 1 reply; 9+ messages in thread From: Dusty Mabe @ 2013-06-02 20:21 UTC (permalink / raw) To: qemu-devel Hi, Is it valid to have cache=none and discard=unmap together? I notice that when I have cache=none the fstrim operations inside of my guests gives me an error and i get this from the sys filesystem: [root@guest ~]# cat /sys/block/sdb/queue/discard* 4096 0 0 This wasn't very obvious to me to begin with and just wanted to see if this is a bug or as designed. libvirt 1.0.6 qemu 1.5.0 Thanks, Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-02 20:21 [Qemu-devel] fstrim and cache=none Dusty Mabe @ 2013-06-03 6:39 ` Paolo Bonzini 2013-06-03 21:39 ` Dusty Mabe 0 siblings, 1 reply; 9+ messages in thread From: Paolo Bonzini @ 2013-06-03 6:39 UTC (permalink / raw) To: Dusty Mabe; +Cc: qemu-devel Il 02/06/2013 22:21, Dusty Mabe ha scritto: > Hi, > > Is it valid to have cache=none and discard=unmap together? I notice > that when I have cache=none the fstrim operations inside of my guests > gives me an error What error? Can you add an extra disk and try dd if=/dev/urandom of=/dev/sdc bs=1M count=32 sg_unmap -l0 -n64 /dev/sdc from within the guest? > and i get this from the sys filesystem: > > [root@guest ~]# cat /sys/block/sdb/queue/discard* > 4096 > 0 > 0 This is expected. It won't change between discard=unmap and discard=ignore, too. (Tip: Use "grep . /sys/block/sdb/queue/discard*" so that it shows the filename). > > > This wasn't very obvious to me to begin with and just wanted to see if > this is a bug or as designed. It should be. It may be a Linux bug, too. Paolo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-03 6:39 ` Paolo Bonzini @ 2013-06-03 21:39 ` Dusty Mabe 2013-06-04 1:02 ` Dusty Mabe 0 siblings, 1 reply; 9+ messages in thread From: Dusty Mabe @ 2013-06-03 21:39 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel Paolo, It is possible that I was mistaken. Now when I switch back to cache=none I am still able to execute trim operations. I'll investigate a little more into my exact steps that I took and see if I can come up with a reproducer for the issue I observed. Thanks, Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-03 21:39 ` Dusty Mabe @ 2013-06-04 1:02 ` Dusty Mabe 2013-06-04 6:53 ` Paolo Bonzini 0 siblings, 1 reply; 9+ messages in thread From: Dusty Mabe @ 2013-06-04 1:02 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel On Mon, Jun 3, 2013 at 5:39 PM, Dusty Mabe <dustymabe@gmail.com> wrote: > > It is possible that I was mistaken. Now when I switch back to > cache=none I am still able to execute trim operations. I'll > investigate a little more into my exact steps that I took and see if I > can come up with a reproducer for the issue I observed. > Paolo, I was mistaken. I had added a disk to the guest and then created an ext4 FS on the disk. I then noticed that I couldn't perform fstrim operations. I then examined the xml and the only difference between this disk and the other disk in the system was the cache=none. So I removed cache=none and then shutdown/booted the guest. After the reboot all worked fine so I assumed it was the cache=none line. This was wrong. Actually it is the formatting of the filesystem. When i create an FS in the guest it disables discard. There are also some errors printed in /var/log/messages. Please see the output in file at the following location: http://dustymabe.com/content/qemu-devel-mail.txt Looks like it could be a bug (linux bug?) but I'm not sure. Thoughts? Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-04 1:02 ` Dusty Mabe @ 2013-06-04 6:53 ` Paolo Bonzini 2013-06-04 12:01 ` Dusty Mabe 0 siblings, 1 reply; 9+ messages in thread From: Paolo Bonzini @ 2013-06-04 6:53 UTC (permalink / raw) To: Dusty Mabe; +Cc: qemu-devel Il 04/06/2013 03:02, Dusty Mabe ha scritto: > On Mon, Jun 3, 2013 at 5:39 PM, Dusty Mabe <dustymabe@gmail.com> wrote: >> >> It is possible that I was mistaken. Now when I switch back to >> cache=none I am still able to execute trim operations. I'll >> investigate a little more into my exact steps that I took and see if I >> can come up with a reproducer for the issue I observed. >> > > Paolo, > > I was mistaken. I had added a disk to the guest and then created an > ext4 FS on the disk. I then noticed that I couldn't perform fstrim > operations. I then examined the xml and the only difference between > this disk and the other disk in the system was the cache=none. So I > removed cache=none and then shutdown/booted the guest. After the > reboot all worked fine so I assumed it was the cache=none line. This > was wrong. > > Actually it is the formatting of the filesystem. When i create an FS > in the guest it disables discard. There are also some errors printed > in /var/log/messages. > > Please see the output in file at the following location: > > http://dustymabe.com/content/qemu-devel-mail.txt Please attach the QEMU command line too. I'll try to reproduce. Paolo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-04 6:53 ` Paolo Bonzini @ 2013-06-04 12:01 ` Dusty Mabe 2013-06-11 23:18 ` Dusty Mabe 0 siblings, 1 reply; 9+ messages in thread From: Dusty Mabe @ 2013-06-04 12:01 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel On Tue, Jun 4, 2013 at 2:53 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: > > Please attach the QEMU command line too. I'll try to reproduce. > The command line is below (sorry it's so large). A little context: sda is a raw disk image backed by a file, while sdb is backed by a thin logical volume in the host. /usr/bin/qemu-system-x86_64 -machine accel=kvm -name Fed19 -S -machine pc-i440fx-1.5,accel=kvm,usb=off -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid f8c227a7-432e-377b-275e-7efbae3c41f9 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/Fed19.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -drive file=/guests/Fed19.img,if=none,id=drive-scsi0-0-0-0,format=raw,discard=unmap -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 -drive file=/dev/vgthin/lv3,if=none,id=drive-scsi0-0-0-1,format=raw,cache=none,discard=unmap -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1 -drive if=none,id=drive-ide0-1-0,readonly=on,format=raw -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=26,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:89:0f:df,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-04 12:01 ` Dusty Mabe @ 2013-06-11 23:18 ` Dusty Mabe 2013-06-12 12:49 ` Paolo Bonzini 0 siblings, 1 reply; 9+ messages in thread From: Dusty Mabe @ 2013-06-11 23:18 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel On Tue, Jun 4, 2013 at 8:01 AM, Dusty Mabe <dustymabe@gmail.com> wrote: > On Tue, Jun 4, 2013 at 2:53 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: >> >> Please attach the QEMU command line too. I'll try to reproduce. >> > > The command line is below (sorry it's so large). A little context: sda > is a raw disk image backed by a file, while sdb is backed by a thin > logical volume in the host. Did you manage to find anything? Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-11 23:18 ` Dusty Mabe @ 2013-06-12 12:49 ` Paolo Bonzini 2013-06-27 2:56 ` Dusty Mabe 0 siblings, 1 reply; 9+ messages in thread From: Paolo Bonzini @ 2013-06-12 12:49 UTC (permalink / raw) To: Dusty Mabe; +Cc: qemu-devel Il 11/06/2013 19:18, Dusty Mabe ha scritto: > On Tue, Jun 4, 2013 at 8:01 AM, Dusty Mabe <dustymabe@gmail.com> wrote: >> On Tue, Jun 4, 2013 at 2:53 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: >>> >>> Please attach the QEMU command line too. I'll try to reproduce. >>> >> >> The command line is below (sorry it's so large). A little context: sda >> is a raw disk image backed by a file, while sdb is backed by a thin >> logical volume in the host. > > Did you manage to find anything? No, I was (and am :)) on vacation. Paolo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] fstrim and cache=none 2013-06-12 12:49 ` Paolo Bonzini @ 2013-06-27 2:56 ` Dusty Mabe 0 siblings, 0 replies; 9+ messages in thread From: Dusty Mabe @ 2013-06-27 2:56 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel On Wed, Jun 12, 2013 at 8:49 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 11/06/2013 19:18, Dusty Mabe ha scritto: >> On Tue, Jun 4, 2013 at 8:01 AM, Dusty Mabe <dustymabe@gmail.com> wrote: >> Did you manage to find anything? > > No, I was (and am :)) on vacation. > Paolo, Hope you are enjoying your vacation. I have since deleted the VM I was doing this on but it won't be too hard to rebuild if you need me to as I have documented my steps and guest xml as part of a series of blog posts I did on fstrim within VMs. If you are interested you can find them all at the URLs below. I decided to write the posts because I could not find much step-by-step documentation on how to do this on the web. Please feel free to distribute to any who may find them useful. http://dustymabe.com/2013/06/11/recover-space-from-vm-disk-images-by-using-discardfstrim/ http://dustymabe.com/2013/06/21/guest-discardfstrim-on-thin-lvs/ http://dustymabe.com/2013/06/26/enabling-qemu-guest-agent-anddddd-fstrim-again/ Thanks, Dusty ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-06-27 2:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-02 20:21 [Qemu-devel] fstrim and cache=none Dusty Mabe 2013-06-03 6:39 ` Paolo Bonzini 2013-06-03 21:39 ` Dusty Mabe 2013-06-04 1:02 ` Dusty Mabe 2013-06-04 6:53 ` Paolo Bonzini 2013-06-04 12:01 ` Dusty Mabe 2013-06-11 23:18 ` Dusty Mabe 2013-06-12 12:49 ` Paolo Bonzini 2013-06-27 2:56 ` Dusty Mabe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).