I think this has probably been discussed here.. but I''m getting confused about how to determine actual disk usage of zfs filesystems. Here is an example: $ du -sb callisto 46744 callisto $ du -sb callisto/.zfs/snapshot 86076 callisto/.zfs/snapshot Two questions then. I do need to add those two to get the actual disk usage right? Is something wrong here... there are only 2 snapshots there. And I''ve seen it mentioned repeatedly about how little space snapshots take. It is rsync''d data from a remote.. but I did use the --inplace flag. The whole command used: rsync -avvz -L --delete --exclude-from=/www/rexcl/callisto_exclude.txt --inplace --delete-excluded reader at callisto.jtan.com:/home/reader/public_html/ /www/callisto/
Robert Thurlow
2009-Jul-06 22:38 UTC
[zfs-discuss] getting actual size in bytes of a zfs fs
Harry Putnam wrote:> I think this has probably been discussed here.. but I''m getting > confused about how to determine actual disk usage of zfs filesystems. > > Here is an example: > > $ du -sb callisto > 46744 callisto > > $ du -sb callisto/.zfs/snapshot > 86076 callisto/.zfs/snapshot > > Two questions then. > > I do need to add those two to get the actual disk usage right? > > Is something wrong here... there are only 2 snapshots there. > And I''ve seen it mentioned repeatedly about how little space snapshots > take.''du'' does a stat() of each file it finds; it sees and reports identical files in snapshots as full size. ''rsync'' will also work on all copies of a file. To see space usage, you need to ask zfs itself: NAME USED AVAIL REFER MOUNTPOINT rpool/ROOT 10.4G 7.93G 18K /rpool/ROOT rpool/ROOT at Rob 0 - 18K - The snapshot I just took and named after myself doesn''t yet take any space for itself. If I delete a file, e.g. my /var/crash/* files that I''m done with, I *may* see space start to be accounted to the snapshot. Rob T
Robert Thurlow wrote:> Harry Putnam wrote: >> I think this has probably been discussed here.. but I''m getting >> confused about how to determine actual disk usage of zfs filesystems. >> >> Here is an example: >> >> $ du -sb callisto >> 46744 callisto >> >> $ du -sb callisto/.zfs/snapshot >> 86076 callisto/.zfs/snapshot >> >> Two questions then. >> >> I do need to add those two to get the actual disk usage right? >> >> Is something wrong here... there are only 2 snapshots there. >> And I''ve seen it mentioned repeatedly about how little space snapshots >> take. > > ''du'' does a stat() of each file it finds; it sees and reports > identical files in snapshots as full size. ''rsync'' will also > work on all copies of a file. > > To see space usage, you need to ask zfs itself: > > NAME USED AVAIL REFER MOUNTPOINT > rpool/ROOT 10.4G 7.93G 18K /rpool/ROOT > rpool/ROOT at Rob 0 - 18K - > > The snapshot I just took and named after myself doesn''t yet > take any space for itself. If I delete a file, e.g. my > /var/crash/* files that I''m done with, I *may* see space > start to be accounted to the snapshot. > > Rob T > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discussAs Robert pointed out, you DON''T want to use ''du'', as it doesn''t take in account that ZFS use Copy On Write to reduce the amount of space that snapshots take up. Think of it as similar to the situation you face with hard links (i.e. multiple identical files actually all referring to the same bits on the disk). Remember, there are generally TWO concepts you don''t want to confuse: a FILESYSTEM, and a POOL. The Pool is the "larger" object, inside which multiple filesystems, snapshots, and volumes can exit. A pool has a hard limit as to the amount of space it can handle, as determined by the underlying storage objects that make it up (disks, arrays, LUNs, etc). The other objects are flexible size, up to the amount of the pool that contains them. By your question, you seem to be interested in the available/used space of a Pool. You want the ''zpool'' command for this, specifically: zpool list Look at the zpool(1M) man page. To look at the size of FILESYSTEMS, you can use ''df'' for a mounted filesystem, as normal. Alternately, use ''zfs list <filesystem>'' to list a specific filesystem by name (i.e. data/foo/bar/baz ), or ''zpool list -t <type>'' where <type> is one of ''filesystem'', ''snapshot'', or ''volume'' to list all occurrances of that type of object. Look at the zfs(1M) man page. Note that most the output uses Human readable info, so it''s going to report GB and TB, not Bytes. -- Erik Trimble Java System Support Mailstop: usca22-123 Phone: x17195 Santa Clara, CA