WhyOn a UFS or ZFS filesystem, create a snapshot, dump it to a file, and restore it as a new filesystem.
timestamp=`date +%Y-%m-%d`
dumpfile=/data/archive/dump-${timestamp}
# Create filesystem snapshot
cd ${src} && mksnap_ffs .snap/${timestamp}
# Dump snapshot to file
dump -0 -a -f ${dumpfile} ${src}/.snap/${timestamp}
# Create
newfs -n /dev/da0s1a
mount /dev/da0s1a ${src}
# Restore filesystem from file
cd ${src} && restore rf ${dumpfile}
# Create filesystem snapshot
zfs snapshot -r ${src}@${timestamp}
# Dump snapshot to file
zfs send -R ${src}@${timestamp} > ${dumpfile}
# Create
zpool create ${src} /dev/da0 ...
# Restore filesystem from file
zfs recv -F -d ${src} < ${dumpfile}
During the creation and restoration stage, it may be necessary to
temporary choose another name for the partition where the pool is to
be restored so that there is no conflict with the running system. This
is, for example, typically the case of the root partition /.