Subject: Re: Snapshot Weirdness
To: Rhialto <rhialto@falu.nl>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: current-users
Date: 05/07/2006 12:16:19
On Sat, May 06, 2006 at 07:30:36PM +0200, Rhialto wrote:
> I am experimenting with snapshots, since I think some of what is written
> in fssconfig(8) is either strange or misleading. In particular, I want
> to know if a snapshot survives a reboot (if it doesn't it seems fairly
> pointless, or at least a lot less useful than the snapshots as described
> in [McKusick99]).

[ long trace removed]

First, you should mount the snapshots read-only -- but that is not the problem
here.  I tried it here and got these (not so strange) results:

===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     1.1G      7.4G    13%    /home
===> uname -a
NetBSD (host) 3.99.18 NetBSD 3.99.18 (K_STD.i386)
===> which fssconfig mount df
/usr/sbin/fssconfig
/sbin/mount
/bin/df

===> fssconfig fss0 /home /home/hannken/snap/snap0
===> mount /dev/fss0 /mnt
===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     1.1G      7.4G    13%    /home
/dev/fss0                  9.0G     1.1G      7.4G    13%    /mnt

! Same size as expected

===> dd if=/dev/zero of=junk1 bs=1m count=4096
4096+0 records in
4096+0 records out
4294967296 bytes transferred in 185.872 secs (23107123 bytes/sec)
===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     5.1G      3.4G    60%    /home
/dev/fss0                  9.0G     1.1G      7.4G    13%    /mnt

! File system uses 4G more than snapshot as expected

===> fssconfig fss1 /home /home/hannken/snap/snap1
===> mount /dev/fss1 /mnt2
===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     5.1G      3.4G    60%    /home
/dev/fss0                  9.0G     1.1G      7.4G    13%    /mnt
/dev/fss1                  9.0G     5.1G      3.4G    60%    /mnt2

! Snapshots report different sizes as expected

===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     5.1G      3.4G    60%    /home
===> fssconfig fss0 /home /home/hannken/snap/snap0
===> mount /dev/fss0 /mnt
===> rm junk1
===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     1.1G      7.4G    13%    /home
/dev/fss0                  9.0G     5.1G      3.4G    60%    /mnt

===> shutdown -r now

! syncing disks... 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 giving up
! Should mount the snapshot ro :-)

===> ls -lo snap0
-rw-------  1 root  staff  snap 9764766144 May  7 11:52 snap0

! Snapshot is still there as expected

===> fssconfig fss0 /home /home/hannken/snap/snap0
===> mount /dev/fss0 /mnt
===> df -h
Filesystem                 Size      Used     Avail Capacity  Mounted on
/dev/sd0h                  9.0G     1.2G      7.3G    14%    /home
/dev/fss0                  9.0G     5.1G      3.4G    60%    /mnt

! Sizes look good

===> ls -l junk1 /mnt/hannken/snap/junk1
ls: junk1: No such file or directory
-rw-r--r--  1 root  staff  4294967296 May  7 11:48 /mnt/hannken/snap/junk1

! File removed from file system but still present on snapshot

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)