VFS_SHADOW_COPY2(8)
π VFS_SHADOW_COPY2 π
okay bestie, welcome to the vfs_shadow_copy2 page from the samba System Administration tools, and no cap this one is a whole moment. let's get into it β¨
π NAME π
vfs_shadow_copy2 β expose snapshots to Windows clients as shadow copies. it's giving time travel but for file shares π¦
β¨ SYNOPSIS β¨
vfs objects = shadow_copy2
π DESCRIPTION π
so this VFS module is part of the samba(7) suite, right? and what it does is basically Microsoft Shadow Copy services energy. when you set it up properly, it lets Microsoft Shadow Copy clients browse through your file system snapshots as "shadow copies" on Samba shares. iconic behavior, honestly π
this is the second implementation of a shadow copy module, and compared to the original shadow_copy(8) module it comes with these extra features, and bestie they ate:
- no need anymore to populate your share's root directory with symlinks to the snapshots if the file system stores the snapshots elsewhere. instead, you can flexibly configure the module where to look for the file system snapshots. this is highkey important when you've got thousands of shares, or you use
[homes]. π - snapshot directories don't need to be in one fixed central place β they can live anywhere in the directory tree. this mode helps support file systems that offer snapshotting of particular subtrees, like the GPFS independent file sets. very demure, very mindful πΈ
- vanity naming for snapshots: snapshots can be named in any format compatible with
str[fp]timeconversions. name them whatever, the module gets it π - timestamps can be represented in localtime rather than UTC. your timezone, your rules π
- the inode number of the files can optionally be altered to be different from the original. this fixes the 'restore' button in the Windows GUI so it works without a sharing violation when serving from file systems β like GPFS β that return the same device and inode number for the snapshot file and the original. literally the fix we needed π οΈ
- shadow copy results are by default sorted before being sent to the client. this is beneficial for filesystems that don't read directories alphabetically (the default unix). sort ordering can be configured, and sorting can be turned off completely if the file system sorts its own directory listing. customize your vibe π
this module is stackable. stack it, bestie, go off π«Ά
π CONFIGURATION π
vfs_shadow_copy2 relies on a filesystem snapshot implementation, so you need one of those first. many common filesystems have native support for this β check yours before you start anything, fr fr π
filesystem snapshots must be available under specially named directories in order to be recognized by vfs_shadow_copy2. this snapshot directory is typically a direct subdirectory of the share root's mountpoint, but there are other modes you can configure with the parameters described in detail below. so many options, we love options π
the snapshot at a given point in time is expected in a subdirectory of the snapshot directory, where the snapshot's directory is expected to be a formatted version of the snapshot time. the default format β which you can change with the shadow:format option β is @GMT-YYYY.MM.DD-hh.mm.ss, where:
YYYYis the 4 digit yearMMis the 2 digit monthDDis the 2 digit dayhhis the 2 digit hourmmis the 2 digit minutessis the 2 digit second.
the vfs_shadow_copy2 snapshot naming convention can be produced with the following date(1) command:
TZ=GMT date +@GMT-%Y.%m.%d-%H.%M.%S
run it, screenshot it, live your truth π°οΈβ¨
β¨ OPTIONS β¨
okay bestie this is the part where we meet all the knobs and dials π
every single one is a shadow:something parameter, and yes we're going through ALL of them, no skipping, no "eh you get the vibe" β because each one does a real thing and you deserve to know all of it π«Ά
shadow:mountpoint = MOUNTPOINTβ this one lets you state the mount point of the filesystem that holds the share path, so like, point at it yourself instead of vibing. Usually this mount point gets detected automatically β¨ but for some constellations β especially tests β it's lowkey convenient to be able to just say it out loud.
Example: shadow:mountpoint = /path/to/filesystem
Default: shadow:mountpoint = NOT SPECIFIED
shadow:snapdir = SNAPDIRβ the path to the directory where the filesystem of the share keeps its snapshots π if you hand it an absolute path, it uses it as-is, fr fr. If you hand it a relative path, then it's taken relative to the mount point of the filesystem of the share root (peepshadow:mountpointfor that one).
Heads up: shadow:snapdirseverywhere depends on this parameter and needs a relative path. Setting an absolute path disables shadow:snapdirseverywhere. π
Also heads up: the shadow:crossmountpoints option also requires a relative snapdir. Setting an absolute path disables shadow:crossmountpoints.
Example: shadow:snapdir = /some/absolute/path
Default: shadow:snapdir = .snapshots
shadow:basedir = BASEDIRβ the basedir option lets you specify a directory between the share's mount point and the share root, relative to which the filesystem's snapshots are taken π
So for example, if
basedir = mountpoint/rel_basedirshare_root = basedir/rel_share_rootsnapshot_path = mountpoint/snapdirorsnapshot_path = snapdirif snapdir is absolute
then the snapshot of a file = mountpoint/rel_basedir/rel_share_root/rel_file at a time TIME will be found under snapshot_path/FS_GMT_TOKEN(TIME)/rel_share_root/rel_file, where FS_GMT_TOKEN(TIME) is the timestamp string belonging to TIME in the format required by the filesystem (see shadow:format).
The default for the basedir is the mount point of the filesystem of the share root (see shadow:mountpoint).
Note that the shadow:snapdirseverywhere and shadow:crossmountpoints options are incompatible with shadow:basedir and they disable the basedir setting π
shadow:snapsharepath = SNAPSHAREPATHβ with this parameter you can specify the path of the share's root directory in snapshots, relative to the snapshot's root directory. It's an alternative method toshadow:basedir, and ngl it gives you greater control π
For example, if within each snapshot the files of the share have a path/to/share/ prefix, then shadow:snapsharepath can be set to path/to/share.
With this parameter, it is no longer assumed that a snapshot represents an image of the original filesystem or a portion of it. For example, a system could perform backups of only files contained in shares, and then expose the backup files in a logical structure:
share1/share2/.../
Note that the shadow:snapdirseverywhere and the shadow:basedir options are incompatible with shadow:snapsharepath and disable the shadow:snapsharepath setting π
Example: shadow:snapsharepath = path/to/share
Default: shadow:snapsharepath = NOT SPECIFIED
shadow:sort = asc/descβ by default this module sorts the shadow copy data alphabetically before sending it to the client. With this parameter you can specify the sort order π« the possible known values aredesc(descending β that's the default) andasc(ascending). And if the filesystem already lists directories alphabetically sorted, you can turn off sorting in this module by specifying any other value β¨
Example: shadow:sort = asc
Example: shadow:sort = none
Default: shadow:sort = desc
shadow:localtime = yes/noβ optional parameter, tells us whether the snapshot names are in UTC/GMT or in local time β° if it's disabled then UTC/GMT is what's expected.
shadow:localtime = no
shadow:format = format specification for snapshot namesβ optional parameter, specifies the format specification for the naming of snapshots in the filesystem. The format must be compatible with the conversion specifications recognized bystr[fp]timeπ
Default: shadow:format = "@GMT-%Y.%m.%d-%H.%M.%S"
shadow:sscanf = yes/noβ you can use this parameter to specify that the time in the format string is given as an unsigned long integer (%lu) rather than a timestrptime()can parse. The result must be a unixtime_ttime π’
Default: shadow:sscanf = no
shadow:fixinodes = yes/noβ if you enableshadow:fixinodes, this module modifies the apparent inode number of files in the snapshot directories using a hash of the file's path π§ this is needed for snapshot systems where the snapshots have the samedevice:inodenumber as the original files (such as what happens with GPFS snapshots). If you don't set this option then the 'restore' button in the shadow copy UI will fail with a sharing violation π
Default: shadow:fixinodes = no
shadow:snapdirseverywhere = yes/noβ if you enableshadow:snapdirseverywhere, this module looks out for snapshot directories in the current working directory and all parent directories, stopping at the mount point by default π but seeshadow:crossmountpointsfor how to change that behaviour.
An example where this is needed: independent filesets in IBM's GPFS, but other filesystems might support snapshotting only particular subtrees of the filesystem as well.
Note that shadow:snapdirseverywhere depends on shadow:snapdir and needs it to be a relative path. Setting an absolute snapdir path disables shadow:snapdirseverywhere π
Note that this option is incompatible with the shadow:basedir option and removes the shadow:basedir setting by itself.
Example: shadow:snapdirseverywhere = yes
Default: shadow:snapdirseverywhere = no
shadow:crossmountpoints = yes/noβ this option is effective in the case ofshadow:snapdirseverywhere = yesβ¨ setting it makes the module not stop at the first mount point encountered when looking for snapdirs, but instead lets it search potentially all through the path instead π΅οΈ
An example where this is needed: independent filesets in IBM's GPFS, but other filesystems might support snapshotting only particular subtrees of the filesystem as well.
Note that shadow:crossmountpoints depends on shadow:snapdir and needs it to be a relative path. Setting an absolute snapdir path disables shadow:crossmountpoints.
Note that this option is incompatible with the shadow:basedir option and removes the shadow:basedir setting by itself.
Example: shadow:crossmountpoints = yes
Default: shadow:crossmountpoints = no
shadow:snapprefixβ with a growing number of snapshots, filesystems need some mechanism to differentiate one set of snapshots from another, e.g. monthly, weekly, manual, special events, etc. πΈ so these filesystems provide different ways to tag snapshots, e.g. a configurable way to name snapshots that isn't just based on time. With onlyshadow:formatit's very difficult to filter these snapshots π© with this optional parameter you can specify a variable prefix component for names of the snapshot directories in the filesystem. If this parameter is set, together with theshadow:formatandshadow:delimiterparameters it determines the possible names of snapshot directories in the filesystem. The option only supports Basic Regular Expression (BRE) π§shadow:delimiterβ this optional parameter is used as a delimiter betweenshadow:snapprefixandshadow:formatβοΈ it's used only whenshadow:snapprefixis set.
Default: shadow:delimiter = "_GMT"
π EXAMPLES π
add shadow copy support to user home directories, it's giving cozy π :
[homes]
vfs objects = shadow_copy2
shadow:snapdir = /data/snapshots
shadow:basedir = /data/home
shadow:sort = desc
β οΈ CAVEATS β οΈ
okay bestie, listen, this part matters, don't scroll past it π
This is not a backup, archival, or version control solution. Periodt. π«
With Samba or Windows servers, vfs_shadow_copy2 is designed as an end-user tool only. It does not replace or enhance your backup and archival solutions, and it should in no way be considered as such π additionally, if you need version control, go implement a version control system. fr fr.
π VERSION π
This man page is part of version 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1 of the Samba suite π
π AUTHOR π
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project, similar to the way the Linux kernel is developed β¨
okay that's the whole page, we did it, ate and left no crumbs π
this absolute classic dropped as part of Samba version 4.24.7-Ubuntu-4.24.7+dfsg-1ubuntu1, dated 09/13/2026, and it lives at VFS_SHADOW_COPY2(8) β go forth and snapshot responsibly, bestie π¦ππ
π¦ where this page comes from
- ubuntu stonking: samba 2:4.24.7+dfsg-1ubuntu1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms