Code Monkey home page Code Monkey logo

zsnap's Issues

Only delete from certain datasets

Hi,

It would be quite useful to be able to specify dataset names with -d to (with -r, recursively, or without, non-recursively) expire snapshots under just those areas. This would make things easier when sending snapshots to a central system for backups, and having different retention policies for different datasets (which may also differ from the retention policies on the systems that made them).

Thanks,

John

Different snapshot rule for overlapped zfs

Sometimes I like to make snapshot for overlapped zfs with different rules.
For example,

tank/home:
recursive: true
creation_rule:
at_multiple: 10
preservation_rules:
- { for_minutes: 30, at_multiple: 0, offset: 0 }
tank/home/important_user:
creation_rule:
at_multiple: 10
preservation_rules:
- { for_minutes: 90, at_multiple: 0, offset: 0 }
- { for_minutes: 1440, at_multiple: 60, offset: 0 }
- { for_minutes: 10080, at_multiple: 720, offset: 0 }

That is, use general rules recursively and specific rules for individual subtree.

However, zfs-snapshot-mgmt may expire old snapshots using rules from upper level.

Script fails when / is on zfs

If one has 'root' mounted on a pool directly, as follows:

# df -h
Filesystem           Size    Used   Avail Capacity  Mounted on
tank                 1.9T    116M    1.9T     0%    /

then the zfs-snapshot-mgmt script fails on line 157:

 name[/\A.*?\//].chop

There is nothing to chop. I fixed this the hard way, since I don't now ruby at all:

# diff zfs-snapshot-mgmt zfs-snapshot-mgmt.orig
|57,162c157
<     if name[/\A.*?\//]
<       name[/\A.*?\//].chop
<     else
<       #special case when FS is directly mounted on the pool itself (usually mounted on "/" (legacy))
<       name
<     end

---
>     name[/\A.*?\//].chop

Fails when configured FS not mounted

/usr/local/bin/zfs-snapshot-mgmt:132:in join': can't convert nil into String (TypeError) from /usr/local/bin/zfs-snapshot-mgmt:132:insnapshots'
from /usr/local/bin/zfs-snapshot-mgmt:139:in snapshots_to_remove' from /usr/local/bin/zfs-snapshot-mgmt:147:inremove_snapshots'
from /usr/local/bin/zfs-snapshot-mgmt:215 from
/usr/local/bin/zfs-snapshot-mgmt:212:in `each' from
/usr/local/bin/zfs-snapshot-mgmt:212

Every line -= 2.

@mount_point is nil when FS not mounted. Maybe change function to use zfs list -t snapshot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.