SCIENTIFIC-LINUX-USERS Archives

May 2015

SCIENTIFIC-LINUX-USERS@LISTSERV.FNAL.GOV

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Vladimir Mosgalin <[log in to unmask]>
Reply To:
Vladimir Mosgalin <[log in to unmask]>
Date:
Sun, 3 May 2015 15:24:34 +0300
Content-Type:
text/plain
Parts/Attachments:
text/plain (69 lines)
Hi Pritam Khedekar!

 On 2015.05.03 at 12:52:43 +0530, Pritam Khedekar wrote next:

>
> Is it like we re providing thin provisioning in VMware?
>

I don't understand "like" part, but I guess the answer is - yes, it is
possible to provide thin provisioned device into guest with it being
fully aware of it. I checked it myself recently with zfs-on-linux in
SL6.6 and SL7.1 systems and it works on both. Should also work on 7.0,
not sure about earlier SL6 versions.

It's not hard but requires an extra step because current virt-manager
doesn't allow you to do that. For that, say you have thinly-provisioned
device /dev/virt/myguest (doesn't matter which type - thinly-provisioned
from SAN, LVM thin device or zfs volume. I used zfs volumes).

First you add it to virtual system as disk of type "SCSI" (not virtio)
and make sure that SCSI controller of type "virtio" is added as well.
This should be done automatically for new guests in EL6.6 and EL7.1
guests ("default" SCSI controller there *is* virtio controller) but you
need to do it yourself if modifying older guest.

In Windows guests, you need to install "scsi pass-through driver" from
virtio-win drivers package as well. Modern Linux guests shouldn't need
anything extra (http://www.ovirt.org/Features/Virtio-SCSI#Guest_Support)

After that, make sure that this drive is on virtio-scsi controller and
power off guest. Use "virsh edit myguest" to add unmap functionality.
Change the section
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/dev/virt/myguest'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

to
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
      <source file='/dev/virt/myguest'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

(difference is in "discard='unmap'" in the second line, leave everything
else like it was).

Start up guest and enable unmap support ("discard" flag in Linux). In Windows,
run defrag (not command line, but "defragment and optimize drives" gui
tool). If you did everything correctly, guest (win 8 and newer, at
least) will show disk type there as "thinly-provisioned device". Enable
regular (weekly, daily) optimization. This will trim free space on
schedule, kind of like running "fstrim" in Linux from cron. You can
schedule, kind of like running "fstrim" in Linux from cron. You can
verify its working by creating tons of files (make a copy of something
big), check that storage size is increased, remove files, run "optimize
drive" and storage should shrink back to original size in a few seconds.

--

Vladimir

ATOM RSS1 RSS2