Getting the ZFS file size including all its snapshots

Discussion in 'Solaris, Nexenta, OpenIndiana, and napp-it' started by hatchi, Jul 24, 2019.

  1. hatchi

    hatchi Member

    Joined:
    Nov 8, 2014
    Messages:
    32
    Likes Received:
    6
    Hi All,
    in ZFS is there any way to calculate snapshot sizes per file, the "per file" is the important part here

    lets say i have ZFS pool that have 10 vm images (vm image is just a big file from ZFS perspective) and i am snapshoting the whole pool once per day

    now lets say we have 10 snapshots and I wish to know the total size the vm image used including all its snapshot

    one important factor that I think can make getting this info possible is that the vm image never shirnk in size . they always increase never decrease.


    I have searched but couldnt find any information about that


    Thanks
     
    #1
  2. gea

    gea Well-Known Member

    Joined:
    Dec 31, 2010
    Messages:
    2,288
    Likes Received:
    758
    Not possible as a snapshot creation is not a result of a filecopy but a freeze of ZFS blocks when they are created newly on a modification. You can only get the used space for all snaps or the space that a snap uses uniquely (not shared with other snaps) - not per file.

    If you would want to know space per VM you would need a ZFS filesystem per VM.
    see this video about "How ZFS snapshots really work" from Matt Ahrens,
     
    #2
    hatchi likes this.
  3. hatchi

    hatchi Member

    Joined:
    Nov 8, 2014
    Messages:
    32
    Likes Received:
    6
    yeah thats what i was afraid of
    I was hoping zfs keep table of all blocks(inodes) belonging to a file somewhere
    and on each snapshot they they have a new table with the updated blocks or new blocks

    so if someone manage to access those tables that can check all the changed blocks and add their size plus check if any new blocks added to the file

    I still think it may be possible programmatically but the feature not implemented in ZFS

    anyway for my issue the solution you suggested is the only solution which is a new filesystem per vm which is overkill on both omniOS and the hypervisor but it seems if I really need that feature that would be the only way
     
    #3
Similar Threads: Getting file
Forum Title Date
Solaris, Nexenta, OpenIndiana, and napp-it napp-it ESXI OVA template crashes when Getting Smartvalues Aug 9, 2018
Solaris, Nexenta, OpenIndiana, and napp-it New build and getting "Maintenance Mode" on install Jan 4, 2017
Solaris, Nexenta, OpenIndiana, and napp-it rpool is getting full - why? Jul 2, 2014
Solaris, Nexenta, OpenIndiana, and napp-it My first OI - napp-it build and getting smb to work Jan 11, 2012
Solaris, Nexenta, OpenIndiana, and napp-it Can I safely delete the napp-it-18.12.zip, nappit2.sh, & setup-napp-it.log files after installing? Dec 9, 2019

Share This Page