zfs-auto-snapshot ls "File name too long"

David Christensen dpchrist at holgerdanske.com
Sat Aug 24 19:42:12 UTC 2019


freebsd-questions:

I have:

     2019-08-24 12:15:53 toor at soho ~
     # freebsd-version ; uname -a
     11.2-RELEASE-p13
     FreeBSD soho.tracy.holgerdanske.com 11.2-RELEASE-p13 FreeBSD 
11.2-RELEASE-p13 #0: Tue Aug  6 06:41:33 UTC 2019 
root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64


I am using zfs-auto-snapshot (no man page?):

     2019-08-24 12:29:28 toor at soho ~
     # zfs-auto-snapshot
     Usage: /usr/local/sbin/zfs-auto-snapshot [-dknpuv] <INTERVAL> <KEEP>
         -d              Show debug output.
         -k              Keep zero-sized snapshots.
         -n              Do a dry-run. Nothing is committed. Only show 
what would be done.
         -p              Create snapshots in parallel.
         -P pool         Act only on the specified pool.
         -u              Use UTC for snapshots.
         -v              Show what is being done.
         INTERVAL        The interval to snapshot.
         KEEP            How many snapshots to keep.


I have set ZFS user properties on my file systems.  For example:

     2019-08-24 12:26:09 toor at soho ~
     # zfs get -t filesystem all /jail | egrep 'auto-snap.+true'
     tracy_p1/tracy_ds0/jail  com.sun:auto-snapshot  true 
    inherited from tracy_p1


I had the following crontab entry:

     2 *  *  * * /usr/local/sbin/zfs-auto-snapshot hourly 25


Snapshots were being taken at two minutes after each hour.


ls(1) is able to see the snapshots with shorter path names:

     2019-08-24 12:20:13 toor at soho ~
     # ls /jail/.zfs/snapshot | grep hourly
     zfs-auto-snap_hourly-2019-02-21-17h00
     zfs-auto-snap_hourly-2019-02-21-18h00
     zfs-auto-snap_hourly-2019-02-22-20h00
     <snip>


But ls(1) is unable to access snapshots with longer path names:

     2019-08-24 12:21:01 toor at soho ~
     # ls /jail/samba/var/local/samba/dpchrist/.zfs/snapshot/*hour* 

     ls: 
/jail/samba/var/local/samba/dpchrist/.zfs/snapshot/zfs-auto-snap_hourly-2019-08-21-01h02: 
File name too long
     ls: 
/jail/samba/var/local/samba/dpchrist/.zfs/snapshot/zfs-auto-snap_hourly-2019-08-21-05h02: 
File name too long
     ls: 
/jail/samba/var/local/samba/dpchrist/.zfs/snapshot/zfs-auto-snap_hourly-2019-08-21-15h02: 
File name too long
     <snip>


STFW I see:

     https://lists.freebsd.org/pipermail/freebsd-fs/2010-March/007974.html


So, the problem is ZFS (?).


Searching for a FreeBSD bug report came up empty:

 
https://bugs.freebsd.org/bugzilla/buglist.cgi?quicksearch=zfs+snapshot+File+name+too+long


My current work-around is to shorten the INTERVAL:

     2019-08-24 12:30:55 toor at soho ~
     # crontab -l | grep 'h 25'
        2 *  *  * * /usr/local/sbin/zfs-auto-snapshot h 25


     2019-08-24 12:32:10 toor at soho ~
     # ls /jail/samba/var/local/samba/dpchrist/.zfs/snapshot/ | grep h-
     zfs-auto-snap_h-2019-08-23-13h02
     zfs-auto-snap_h-2019-08-23-14h02
     zfs-auto-snap_h-2019-08-23-22h02
     zfs-auto-snap_h-2019-08-23-23h02
     zfs-auto-snap_h-2019-08-24-00h02
     zfs-auto-snap_h-2019-08-24-04h02
     zfs-auto-snap_h-2019-08-24-12h02


Is there a solution that allows ZFS snapshots of longer paths?


David



More information about the freebsd-questions mailing list