我一直在使用LVM快照来备份
MySQL数据库.发出带有READ LOCK的FLUSH表,然后lvcreate –snapshot –size 4G等.因为数据库在快照处于活动状态时是活动的,所以snap_percent(用于跟踪文件系统原始状态的增量的快照存储量)拍摄快照的时间)开始增加.每天监视此snap_percent,并且在达到80%时增加–size.
我的问题是ZFS中是否存在等效的统计信息或属性,用于确定快照占用的空间占池中剩余空间的百分比?显然,我不需要将–size参数传递给zfs快照,但是如何确定基于该快照的克隆是否接近池的限制.
希望这是有道理的,现在我读起来确实听起来像一个复杂的问题.
解决方法
ZFS快照空间反映在文件系统的消耗中.您可以通过监控下面最合适的字段来推导出您所要求的内容.
最后,你会看到你的文件系统的“可用”空间…看看“used”“avail”如何小于“size”?:
root@deore:~# df -h /volumes/vol1/LA_Specialty Filesystem size used avail capacity Mounted on vol1/LA_Specialty 800G 391G 254G 61% /volumes/vol1/LA_Specialty
我已经过滤了zfs的输出get get pool / filesystem以显示相关属性.下面,我有一个800GB的文件系统(配额),使用545GB.引用了391GB,这意味着它是实际数据的大小.快照使用154GB.
root@deore:/volumes# zfs get all vol1/LA_Specialty NAME PROPERTY VALUE SOURCE vol1/LA_Specialty type filesystem - vol1/LA_Specialty creation Sat Sep 24 18:44 2011 - vol1/LA_Specialty used 545G - vol1/LA_Specialty available 255G - vol1/LA_Specialty referenced 391G - vol1/LA_Specialty compressratio 2.96x - vol1/LA_Specialty quota 800G local vol1/LA_Specialty reservation none default vol1/LA_Specialty recordsize 16K local vol1/LA_Specialty mountpoint /volumes/vol1/LA_Specialty inherited from vol1 vol1/LA_Specialty usedbysnapshots 154G - vol1/LA_Specialty usedbydataset 391G - vol1/LA_Specialty usedbychildren 0 - vol1/LA_Specialty usedbyrefreservation 0 -
然后查看快照…可以看到快照的个别大小以及它们引用的总数据大小.
root@deore:/volumes# zfs list -t snapshot NAME USED AVAIL REFER MOUNTPOINT vol1/LA_Specialty@snap-daily-1-2013-09-07-020003 57.6G - 389G - vol1/LA_Specialty@snap-daily-1-2013-09-08-020003 1.95G - 391G - vol1/LA_Specialty@snap-daily-1-2013-09-09-020008 3.42G - 392G - vol1/LA_Specialty@snap-daily-1-2013-09-10-020003 3.05G - 391G - vol1/LA_Specialty@snap-daily-1-2013-09-11-020003 2.81G - 391G - vol1/LA_Specialty@snap-daily-1-2013-09-12-020004 2.65G - 391G - vol1/LA_Specialty@snap-daily-1-2013-09-13-020003 2.70G - 391G - vol1/LA_Specialty@snap-daily-1-2013-09-14-020003 25K - 391G - vol1/LA_Specialty@snap-daily-1-latest 25K - 391G -
并列出了快照目录的列表……
root@deore:/volumes/vol1/LA_Specialty/.zfs/snapshot# du -skh * 389G snap-daily-1-2013-09-07-020003 391G snap-daily-1-2013-09-08-020003 392G snap-daily-1-2013-09-09-020008 391G snap-daily-1-2013-09-10-020003 391G snap-daily-1-2013-09-11-020003 391G snap-daily-1-2013-09-12-020004 391G snap-daily-1-2013-09-13-020003 391G snap-daily-1-2013-09-14-020003 391G snap-daily-1-latest