At 1:48 AM +0300 8/7/05, Michael Dexter wrote:
Hello Garance and all,

<snip>
Garance wrote:
I think there's a writeup
somewhere on making/using snapshots.  I'll see if I can
remember where it is.

Any pointers are appreciated. Seriously, I can't find any
useful documentation on how they work or what commands are
involved. :( Odd, I see snapshot(8) on the web page but
not my 5.4 system.

Well, this is something I wrote up for some user's group or
another.  This was meant as a terse handout that I gave to
people, and then I talked about each step in detail at the
presentation.  I probably should clean it up to make more
sense, but hopefully this will give you the basic idea:

*       Example of making and using a UFS snapshot
        (as available in FreeBSD 5.3-release and later)

See also  http://www.mckusick.com/softdep/index.html

* #   Before the snapshot:
df -k
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/ad4s3a    272558   60038   190716    24%    /
devfs               1       1        0   100%    /dev
/dev/ad4s3e   4164558 1315622  2515772    34%    /usr
/dev/ad4s3d    421358   19344   368306     5%    /var
cd /usr
ls
.snap/      cvs/        lib/        obj/        src/
X11R6/      games/      libdata/    ports/
bin/        home/       libexec/    sbin/
compat/     include/    local/      share/

* #   Creating the snapshot (I use a 'time' command to show
  #   how quickly the snapshot is made, in real time, while
  #   the partition is mounted and a few processes are
  #   actively using it...)
/usr/bin/time mount -u -o snapshot /usr/.snap/2004_1006 /usr
        0.60 real         0.00 user         0.04 sys
ls -l /usr/.snap/2004_1006
-r--------  1 root  operator ...
                4404019424 Oct  6 14:13 /usr/.snap/2004_1006

* #   Attach that snapshot file to a memory device
/usr/bin/time mdconfig -a -t vnode -u 0 \
                              -f /usr/.snap/2004_1006
        0.03 real         0.00 user         0.00 sys

* #   Mount that memory device for user access
mkdir -p /WayBack/usr-2004_1006
chmod 755 /WayBack /WayBack/usr-2004_1006
mount -r /dev/md0 /WayBack/usr-2004_1006

* #   After it is mounted:
df -k
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/ad4s3a    272558   60038   190716   24%    /
devfs               1       1        0  100%    /dev
/dev/ad4s3e   4164558 1318198  2513196   34%    /usr
/dev/ad4s3d    421358   19344   368306    5%    /var
/dev/md0      4164558 1315622  2515772   34%    /WayBack/usr-2004_1006
cd /WayBack/usr-2004_1006
ls
.snap/      cvs/        lib/        obj/        src/
X11R6/      games/      libdata/    ports/
bin/        home/       libexec/    sbin/
compat/     include/    local/      share/

* #   Getting rid of the snapshot
umount /WayBack/usr-2004_1006
mdconfig -d -u 0
rm /usr/.snap/2004_1006
override r--------  root/operator snapshot ...
                          for /usr/.snap/2004_1006? y


--
Garance Alistair Drosehn     =      [EMAIL PROTECTED]
Senior Systems Programmer               or   [EMAIL PROTECTED]
Rensselaer Polytechnic Institute;             Troy, NY;  USA
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to