Hi, I''m trying to get a status from zfs on where the free space in my zfs filesystem is. Its a RAIDZ2 pool on 4 x 320GB HDD. I have several snapshots and I''ve just deleted rougly 150GB worth of data I didn''t need from the current filesystem. The non-snapshot data now only takes up 156GB but I can''t see where the rest is in the snapshots. The USED for the main filesystem (storage/freddofrog) shows 357G and I would expect the deleted 150G or so of data to show up in the snapshots below, but it doesn''t. A du -c -h on /storage/freddofrog shows 152G used, about the same as the REFER for storage/freddofrog below So how can I tell where the space is being used (which snapshots)? freddofrog at storage:~$ zfs list NAME USED AVAIL REFER storage 357G 227G 28.4K storage at 10-Aug-2008 0 - 28.4K storage at 2008-08-10-10-54-28 0 - 28.4K storage/freddofrog 357G 227G 151G storage/freddofrog at cleanup-28-03-2008 4.26G - 187G storage/freddofrog at 7May2008 61.1M - 206G storage/freddofrog at 15062008 773M - 201G storage/freddofrog at 01072008 33.2M - 192G storage/freddofrog at 04July2008 62.6M - 212G storage/freddofrog at 17072008 5.29G - 217G -- This message posted from opensolaris.org
Hello none, Thursday, November 6, 2008, 2:52:53 AM, you wrote: n> Hi, I''m trying to get a status from zfs on where the free space in n> my zfs filesystem is. Its a RAIDZ2 pool on 4 x 320GB HDD. I have n> several snapshots and I''ve just deleted rougly 150GB worth of data n> I didn''t need from the current filesystem. The non-snapshot data n> now only takes up 156GB but I can''t see where the rest is in the snapshots. n> The USED for the main filesystem (storage/freddofrog) shows 357G n> and I would expect the deleted 150G or so of data to show up in the n> snapshots below, but it doesn''t. A du -c -h on /storage/freddofrog n> shows 152G used, about the same as the REFER for storage/freddofrog below n> So how can I tell where the space is being used (which snapshots)? n> freddofrog at storage:~$ zfs list n> NAME USED AVAIL REFER n> storage 357G 227G 28.4K n> storage at 10-Aug-2008 0 - 28.4K n> storage at 2008-08-10-10-54-28 0 - 28.4K n> storage/freddofrog 357G 227G 151G n> storage/freddofrog at cleanup-28-03-2008 4.26G - 187G n> storage/freddofrog at 7May2008 61.1M - 206G n> storage/freddofrog at 15062008 773M - 201G n> storage/freddofrog at 01072008 33.2M - 192G n> storage/freddofrog at 04July2008 62.6M - 212G n> storage/freddofrog at 17072008 5.29G - 217G When multple snapshots are pointing to the same data than instead of ccounting that used space to a random snapshot it will be acocunted against a filesystem. The used space you see by each snapshot is a uniq usage by that snapshot. If you would remove all anapshots you should re-gain 357G-151G of disk space. It''s not an issue with ZFS snapshot it''s just that no-one has a better idea how to account for used space by snapshots if multiple of them are pointing to the same data. -- Best regards, Robert Milkowski mailto:milek at task.gda.pl http://milek.blogspot.com
Hi Milek, Thanks for your reply. What I really need is a way to tell how much space will be freed for any particular set of snapshots that I delete. So I would like to query zfs, "if I delete these snapshots storage/mbaily at 17072008 storage/mbaily at 04July2008 how much space will be freed?" Thanks -- This message posted from opensolaris.org
Hello none, Thursday, November 6, 2008, 7:55:42 PM, you wrote: n> Hi Milek, n> Thanks for your reply. n> What I really need is a way to tell how much space will be freed n> for any particular set of snapshots that I delete. n> So I would like to query zfs, n> "if I delete these snapshots n> storage/mbaily at 17072008 n> storage/mbaily at 04July2008 n> how much space will be freed?" I''m afraid you can do only one at a time. -- Best regards, Robert mailto:milek at task.gda.pl http://milek.blogspot.com
Hi, A good rough estimate would be the total of the space that is displayed under the "USED" column of "zfs list" for those snapshots. Here is an example : -- snip -- [root at indus]# zfs list -r tank NAME USED AVAIL REFER MOUNTPOINT tank 24.6M 38.9M 19K /tank tank/fs1 24.4M 38.9M 18K /tank/fs1 tank/fs1 at 1 24.4M - 24.4M - -- snip -- In the above case tank/fs1 at 1 is using 24.4M. So, if we delete that snapshot it would freeup about 24.4M. Let''s delete it an see what we get : -- snip -- [root at indus]# zfs destroy tank/fs1 at 1 [root at indus]# zfs list -r tank NAME USED AVAIL REFER MOUNTPOINT tank 220K 63.3M 19K /tank tank/fs1 18K 63.3M 18K /tank/fs1 -- snip -- So, we did get back 24.4M freed (39.9M + 24.4M = 63.3M). Note that this could get a little complicated if there are multiple snapshots which refer to the same set of blocks. So, even after deleting one snapshot you might not see the space freed up. And this could be because, of the second snapshot which is refering to some of the blocks still. Hope that helps. Thanks and regards, Sanjeev On Wed, Dec 03, 2008 at 12:26:48AM +0000, Robert Milkowski wrote:> Hello none, > > Thursday, November 6, 2008, 7:55:42 PM, you wrote: > > n> Hi Milek, > n> Thanks for your reply. > n> What I really need is a way to tell how much space will be freed > n> for any particular set of snapshots that I delete. > > n> So I would like to query zfs, > n> "if I delete these snapshots > n> storage/mbaily at 17072008 > n> storage/mbaily at 04July2008 > n> how much space will be freed?" > > I''m afraid you can do only one at a time. > > -- > Best regards, > Robert mailto:milek at task.gda.pl > http://milek.blogspot.com > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Hello Sanjeev, Wednesday, December 3, 2008, 5:20:47 AM, you wrote: S> Hi, S> A good rough estimate would be the total of the space S> that is displayed under the "USED" column of "zfs list" for those snapshots. S> Here is an example : S> -- snip -- S> [root at indus]# zfs list -r tank S> NAME USED AVAIL REFER MOUNTPOINT S> tank 24.6M 38.9M 19K /tank S> tank/fs1 24.4M 38.9M 18K /tank/fs1 S> tank/fs1 at 1 24.4M - 24.4M - S> -- snip -- S> In the above case tank/fs1 at 1 is using 24.4M. So, if we delete S> that snapshot it would freeup about 24.4M. Let''s delete it an S> see what we get : S> -- snip -- S> [root at indus]# zfs destroy tank/fs1 at 1 S> [root at indus]# zfs list -r tank S> NAME USED AVAIL REFER MOUNTPOINT S> tank 220K 63.3M 19K /tank S> tank/fs1 18K 63.3M 18K /tank/fs1 S> -- snip -- S> So, we did get back 24.4M freed (39.9M + 24.4M = 63.3M). S> Note that this could get a little complicated if there are multiple S> snapshots which refer to the same set of blocks. So, even after deleting S> one snapshot you might not see the space freed up. And this could be because, S> of the second snapshot which is refering to some of the blocks still. That''s what I meant by:>> I''m afraid you can do only one at a time.The problem is that once you got several snapshots and you want to calculate how much space you will re-gain if you delete two (or more) of them - you just can''t calculate it by looking at zfs list output. All you can say is how much space at least you will re-gain which is summary of used column for snapshots to be deleted - but if they share some blocks then you might or might not (depends if yet other snapshots share some of these shared blocks) re-gain much more. -- Best regards, Robert Milkowski mailto:milek at task.gda.pl http://milek.blogspot.com
Hi Sanjeev and Milek, thanks for your replies but I''m afraid they are somewhat missing the point. I have a situation (and I believe it would be fairly common) where early snapshots would be sharing most data with the current filesystem and more recent snapshots are holding onto data that has been deleted from the current filesystem (after a recent big deletion of unused data). It is impossible to see what snapshots would need to be deleted to free up the space that was deleted from the current fs, without deleting the snapshots one by one. I think in any filesystem it is reasonable to expect to be able to determine what entities use up disk space. But ZFS is currently lacking this for snapshots. See the below "USED" column. The total "USED" adds up to about 11G. However the total data consumed by the snapshots is more in the range of 100G. But from the listing below it is simply impossible to see which snapshots are using it. NAME USED AVAIL REFER MOUNTPOINT storage 457G 127G 28.4K /storage storage/myfilesystem 457G 127G 251G /storage/myfilesystem NAME USED AVAIL REFER MOUNTPOINT storage at 10-Aug-2008 0 - 28.4K - storage at 2008-08-10-10-54-28 0 - 28.4K - storage/myfilesystem at cleanup-28-03-2008 4.26G - 187G - storage/myfilesystem at 7May2008 61.1M - 206G - storage/myfilesystem at 15062008 773M - 201G - storage/myfilesystem at 01072008 33.2M - 192G - storage/myfilesystem at 04July2008 62.6M - 212G - storage/myfilesystem at 17072008 5.29G - 217G - -- This message posted from opensolaris.org
To provide a complete (meaning it is currently incomplete) disk usage report, I think zfs would need provide the following: Each block in a zfs fs in general is shared by one or more of either the current fs or snapshots. Call this the block''s "share set". Eg, (storage/fs, storage/fs at 7May2008, storage/fs at 04July2008) Group the blocks (from the entire fs) that have identical "share sets" together and call this a "shared collection". For each "shared collection", report the disk usage based on the total number of blocks in that "shared collection". It is to be expected that a snapshot or fs could appear in more than one "shared collection". eg, zfs list-shared SHARED COLLECTION USED (storage/fs, storage/fs at 7May2008, storage/fs at 04July2008) 100G (storage/fs at 15062008, storage/fs at cleanup-28-03-2008, storage/fs at 17072008) 40G -- This message posted from opensolaris.org
Hello none, Wednesday, December 3, 2008, 8:38:03 PM, you wrote: n> Hi Sanjeev and Milek, thanks for your replies but I''m afraid they are somewhat missing the point. n> I have a situation (and I believe it would be fairly common) where n> early snapshots would be sharing most data with the current n> filesystem and more recent snapshots are holding onto data that has n> been deleted from the current filesystem (after a recent big deletion of unused data). n> It is impossible to see what snapshots would need to be deleted to n> free up the space that was deleted from the current fs, without n> deleting the snapshots one by one. I think in any filesystem it is n> reasonable to expect to be able to determine what entities use up n> disk space. But ZFS is currently lacking this for snapshots. n> See the below "USED" column. The total "USED" adds up to about n> 11G. However the total data consumed by the snapshots is more in n> the range of 100G. But from the listing below it is simply n> impossible to see which snapshots are using it. In most cases you probably want to destroy an oldest snapshot. Then check if you happy with your free space, if not delete a next one and so on. The problem is how to present the information you are asking for, like - how much space will I regain if I delete snapshot #2 #4 #7.... -- Best regards, Robert Milkowski mailto:milek at task.gda.pl http://milek.blogspot.com
Hi Milek, I specifically don''t want to destroy the oldest snapshot because I already know it won''t free up much disk space, since it is sharing most data with the current fs. If I delete it I will have lost any old data which might be needed for recovery (eg. if I accidentally corrupt some files). I don''t know which snapshots which actually free up the space.> In most cases you probably want to destroy an oldest > snapshot. Then > check if you happy with your free space, if not > delete a next one and > so on. > > The problem is how to present the information you are > asking for, like > - how much space will I regain if I delete snapshot > #2 #4 #7....-- This message posted from opensolaris.org
>>>>> "n" == none <mark16829 at gmail.com> writes: >>>>> "rm" == Robert Milkowski <milek at task.gda.pl> writes:n> eg, n> zfs list-shared n> SHARED COLLECTION USED n> (storage/fs, storage/fs at 7May2008, storage/fs at 04July2008) 100G rm> how much space will I regain if I delete snapshot #2 #4 #7.... without dedup, I think any SHARED COLLECTION will be contiguous. It''ll always be ``if I delete #2, #3, #4''''. so if you have n snapshots, you''ll have up to n * n+1 ------- 2 SHARED COLLECTION''s. kind of a lot, but not totally ridiculous. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 304 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20081203/cc5c7da5/attachment.bin>
Even if that maximum number of shared collections is that much, I think the information should be available if requested, even if it becomes similar to a ''scrub'' operation in terms of the time taken. For a filesystem like mine that only has 10 or so snapshots, I''d really only expect 3 or 4 of the shared collections to stand out in terms of disk usage. For filesystems with 100''s of snapshots, they can filter the data as desired. It would probably take a long time but at least the can get the information if they really need it. It''s better than not having access to the information at all. I''m not sure if time could be saved by requesting disk usage for only a single shared collection, but if it does that could also be an option as you suggest. -- This message posted from opensolaris.org