Git Product home page Git Product logo

zsd's Introduction

zsd

cli tool to find older versions of a given file in your zfs snapshots.

For a browser based version see zfs-snap-diff.

Documentation

See the website for more details.

Get it

You can download a prebuild version from here.

Run it

./zsd <FILE> <ACTION>

zsd's People

Contributors

j-keck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jackwasey 9glenda

zsd's Issues

snapshot-timemachine file timestamp notes (from zfs-snap-diff#13)

from j-keck/zfs-snap-diff#13:

Hi,

It seems I failed to notice two things with the original code with #12.
Appologies.

the timestamp given for the record is the snapshot timestamp; is it possible to use the file timestamp instead?
Also; parse-time-string would be happier with a RFC 822 datetime:

"Parse the time in STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
STRING should be something resembling an RFC 822 (or later) date-time, e.g.,
"Fri, 25 Mar 2016 16:24:56 +0100", but this function is
somewhat liberal in what format it accepts, and will attempt to
return a "likely" value even for somewhat malformed strings.
The values returned are identical to those of `decode-time', but
any unknown values other than DST are returned as nil, and an
unknown DST value is returned as -1."

Wrong dataset for path found

I am having an issue on FreeBSD, where zsd is using the wrong dataset, and is not finding the changed files. This is a default, out of the box FreeBSD 13.0 ZFS installation.

/root: zsd -d 6 -v /var/db/mysql/ibdata1 list
DEBUG | full path: /var/db/mysql/ibdata1
DEBUG | exceute: zfs list -Ho name
DEBUG | search datasets under zfs: zroot
DEBUG | exceute: zfs list -Hp -o name,used,avail,refer,mountpoint -r -t filesystem zroot
DEBUG | 13 datasets found:
DEBUG |     Name                                     Mountpoint
DEBUG |     zroot                                    /zroot
DEBUG |     zroot/ROOT/default                       /
DEBUG |     zroot/tmp                                /tmp
DEBUG |     zroot/usr                                /usr
DEBUG |     zroot/usr/home                           /usr/home
DEBUG |     zroot/usr/ports                          /usr/ports
DEBUG |     zroot/usr/src                            /usr/src
DEBUG |     zroot/var                                /var
DEBUG |     zroot/var/audit                          /var/audit
DEBUG |     zroot/var/crash                          /var/crash
DEBUG |     zroot/var/log                            /var/log
DEBUG |     zroot/var/mail                           /var/mail
DEBUG |     zroot/var/tmp                            /var/tmp
DEBUG | 1 not mounted datasets ignored:
DEBUG |     zroot/ROOT
DEBUG | Dataset for path found - path: /var/db/mysql/ibdata1, ds: zroot/var, mount-point: /var
DEBUG | work on dataset: zroot/var
scan the last 6 days for other file versions
DEBUG | exceute: zfs list -t snapshot -s creation -r -d 1 -o name,creation -Hp zroot/var
DEBUG | search for file versions for file: /var/db/mysql/ibdata1, in the date range: between Fri Dec 24 2021 and Thu Dec 30 2021
DEBUG | 0 versions for file /var/db/mysql/ibdata1 found - scan duration: 7.337788ms
  # | File changed | Snapshot | Snapshot age
--------------------------------------------

Actually, the dataset should be zroot/ROOT/default and not zroot/var.
/var is no mount point for zroot/var.

/root: mount
devfs on /dev (devfs)
zroot/tmp on /tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/usr/src on /usr/src (zfs, local, noatime, nfsv4acls)
zroot/var/mail on /var/mail (zfs, local, nfsv4acls)
zroot/var/crash on /var/crash (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/var/tmp on /var/tmp (zfs, local, noatime, nosuid, nfsv4acls)
zroot/usr/home on /usr/home (zfs, local, noatime, nfsv4acls)
zroot on /zroot (zfs, local, noatime, nfsv4acls)
zroot/usr/ports on /usr/ports (zfs, local, noatime, nosuid, nfsv4acls)
zroot/var/audit on /var/audit (zfs, local, noatime, noexec, nosuid, nfsv4acls)

However, there must be some misunderstanding about the meaning of the mount point in zfs list because zfs list is showing /var as being a mount point (but there are only about 3 MB of data, while I have GB's of data on /var/db ...)

It is my understanding that zroot/var and /var are only placeholders for /var/audit, /var/log, and so on.

/root: zfs list
NAME                 USED  AVAIL     REFER  MOUNTPOINT
zroot               20.6G  29.3G       96K  /zroot
zroot/ROOT          19.8G  29.3G       96K  none
zroot/ROOT/default  19.8G  29.3G     19.8G  /
zroot/tmp            128K  29.3G      128K  /tmp
zroot/usr            722M  29.3G       96K  /usr
zroot/usr/home       128K  29.3G      128K  /usr/home
zroot/usr/ports      722M  29.3G      722M  /usr/ports
zroot/usr/src         96K  29.3G       96K  /usr/src
zroot/var           2.89M  29.3G       96K  /var
zroot/var/audit       96K  29.3G       96K  /var/audit
zroot/var/crash       96K  29.3G       96K  /var/crash
zroot/var/log       2.07M  29.3G     1.69M  /var/log
zroot/var/mail       456K  29.3G      456K  /var/mail
zroot/var/tmp         96K  29.3G       96K  /var/tmp

Maybe a solution could be to check if the file system can be mounted?

/root: zfs list -o name,mountpoint,canmount
NAME                MOUNTPOINT  CANMOUNT
zroot               /zroot      on
zroot/ROOT          none        on
zroot/ROOT/default  /           noauto
zroot/tmp           /tmp        on
zroot/usr           /usr        off
zroot/usr/home      /usr/home   on
zroot/usr/ports     /usr/ports  on
zroot/usr/src       /usr/src    on
zroot/var           /var        off
zroot/var/audit     /var/audit  on
zroot/var/crash     /var/crash  on
zroot/var/log       /var/log    on
zroot/var/mail      /var/mail   on
zroot/var/tmp       /var/tmp    on

Could this be looked at? Thank you and have a happy new year!

Jan

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.