Date: Sun, 7 Aug 2005 22:49:26 -0400 From: Garance A Drosehn <gad@FreeBSD.org> To: Michael Dexter <dexter@ambidexter.com> Cc: freebsd-questions@FreeBSD.org Subject: Making UFS snapshots Message-ID: <p06230924bf1c752ccf7f@[128.113.24.47]> In-Reply-To: <a06230962bf1adf3297b9@[192.168.1.102]> References: <a06230950bf183ca09eba@[192.168.1.102]> <p0623091cbf185266a616@[128.113.24.47]> <a06230953bf18fa535937@[192.168.1.102]> <p0623091ebf19444556f8@[128.113.24.47]> <a06230962bf1adf3297b9@[192.168.1.102]>
next in thread | previous in thread | raw e-mail | index | archive | help
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 = gad@gilead.netel.rpi.edu
Senior Systems Programmer or gad@FreeBSD.org
Rensselaer Polytechnic Institute; Troy, NY; USA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06230924bf1c752ccf7f>
