UFS Managing UFS Snapshots

Hello,
I just installed FreeBSD 14.1 on UFS and used the following command to take a snapshot of the /var folder. This snapshot gets created as a file named "mysnapshot":

sh:
# mksnap_ffs /var /home/zoltan/mysnaphot

Then I used the following two commands to mount the snapshot into /mnt:

sh:
# mdconfig -a -t vnode -o readonly -f /home/zoltan/mysnaphot
# mount -o ro /dev/md0 /mnt

Now I can use rsync to restore the entire /var in case it changed. /var will be restored to how it was when the snapshot was created.

sh:
# rsync -av --delete --progress --dry-run /mnt/var/ /var/

What I noticed is that even though I specified only /var when creating the snapshot with mksnap_ffs, when I mount the snapshot in /mnt, I can see all the other folders on the system. How is this possible?

Also, is there a way to take a snapshot of the entire / root partition in one single command? Or should I just create separate snapshots for important folders like /usr, /home, and /var?
 
There is only one parameter to this command: mksnap_ffs(8)

If I understand correctly, you create the snapshot of the whole file system in the dir you specify (but this dir is in this file system).

That works by partition. If you had /var in a specific partition, you could.
 
Oh, I overlooked it, even though I was reading the manual. Thank you very much for the clarification!
 
Back
Top