[SOLVED] FSTrim and Discard needed on ZFS?

Discussion in 'Proxmox VE: Installation and configuration' started by jmcorrea, Apr 22, 2019.

  1. jmcorrea

    jmcorrea New Member
    Proxmox Subscriber

    Joined:
    Jul 16, 2018
    Messages:
    15
    Likes Received:
    0
    Hello!

    We have a couple of servers configured to use local ZFS pools for storage. These pools have Thin Provisioning enabled.
    I used to think that Thin Provisioning + ZFS was enough to have the VMs use on physical storage the same space that they are using into themselves, but it seems I was wrong.
    Just to check if I am right, Thin Provisioning only enables the virtual disks to grow according to the needs of the VM, but it does not shrink it, correct? Pretty much link Dynamic VHDs on Hyper-V.
    If I want to have the VMs use the least physical disk space needed I have to set them with the Discard option enabled on they disks and also run fstrim periodically on them. Am I right?
    And I have one more doubt, the disk space that is grown on the virtual disk but is not actually used on the VM, does it get replicated too? Or replication skips that space? If the "empty" space on the virtual disks is replicated then I guess shrinking the virtual disk should help to improve replication performance, correct?

    Thank you very much, any advice is welcome!

    Best regards,

    Juan
     
  2. lhorace

    lhorace Member

    Joined:
    Oct 17, 2015
    Messages:
    81
    Likes Received:
    8
    Hello,

    I just learned, ZFS discard/trim won't happen till 0.8?

    cheers
     
  3. wolfgang

    wolfgang Proxmox Staff Member
    Staff Member

    Joined:
    Oct 1, 2014
    Messages:
    4,598
    Likes Received:
    306
    Hi jmcorrea,

    All thin allocated storages have to run fstrim inside the VM.
    And if you run FStrim you must enable discard on the vdisk.
    With this flag, FStrim is able to send the erased blocks to the storage layer.

    What you mean is trim for the ZFS itself.
    This has nothing to to with thin allocated disks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. LnxBil

    LnxBil Well-Known Member

    Joined:
    Feb 21, 2015
    Messages:
    3,639
    Likes Received:
    326
    As long as this has not changed, you also need to use SCSI virtio in order to get TRIM to work.

    No, that is exactly why you have to run TRIM inside of your guest (with all the settings @wolfgang and I said).
     
  5. jmcorrea

    jmcorrea New Member
    Proxmox Subscriber

    Joined:
    Jul 16, 2018
    Messages:
    15
    Likes Received:
    0
    Hello,
    thank you very much! All of the virtual disks are SCSI so i will enable discard on them and set up a cron to run FStrim periodically.
    As always, you have been really kind!
    Best regards,
    Juan
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice