From owner-freebsd-questions@FreeBSD.ORG Mon Aug 8 02:49:34 2005 Return-Path: X-Original-To: freebsd-questions@FreeBSD.org Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA64A16A420 for ; Mon, 8 Aug 2005 02:49:33 +0000 (GMT) (envelope-from gad@FreeBSD.org) Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 531E443D46 for ; Mon, 8 Aug 2005 02:49:33 +0000 (GMT) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp3.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j782nS2x006053; Sun, 7 Aug 2005 22:49:30 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Sun, 7 Aug 2005 22:49:26 -0400 To: Michael Dexter From: Garance A Drosehn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.3 Cc: freebsd-questions@FreeBSD.org Subject: Making UFS snapshots X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2005 02:49:34 -0000 At 1:48 AM +0300 8/7/05, Michael Dexter wrote: >Hello Garance and all, > > >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