On 10 Sep 2007, at 16:41, Brian H. Nelson wrote:

Stephen Usher wrote:

Brian H. Nelson:

I'm sure it would be interesting for those on the list if you could
outline the gotchas so that the rest of us don't have to re-invent the
wheel... or at least not fall down the pitfalls.

Also, here's a link to the ufs on zvol blog where I originally found the
idea:

http://blogs.sun.com/scottdickson/entry/fun_with_zvols_-_ufs

Not everything I've seen blogged about UFS and zvols fills me with warm fuzzies. For instance, the above takes no account of the fact that the UFS filesystem needs to be in a consistent state before a snapshot is taken - e.g. using lockfs(1M).

Example:


Preparation ...

basket# zfs create -V 10m pool0/v1
basket# newfs /dev/zvol/rdsk/pool0/v1
newfs: /dev/zvol/rdsk/pool0/v1 last mounted as /tmp/v1
newfs: construct a new file system /dev/zvol/rdsk/pool0/v1: (y/n)? y
Warning: 4130 sector(s) in last cylinder unallocated
/dev/zvol/rdsk/pool0/v1: 20446 sectors in 4 cylinders of 48 tracks, 128 sectors
        10.0MB in 1 cyl groups (14 c/g, 42.00MB/g, 20160 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32,

basket# mount -r /dev/zvol/dsk/pool0/v1 /tmp/v1


Scenario 1 ...

basket# date >/tmp/v1/f1; zfs snapshot pool0/[EMAIL PROTECTED]
basket# cat /tmp/v1/f1
Mon Sep 10 23:07:42 BST 2007
basket# mount -r /dev/zvol/dsk/pool0/[EMAIL PROTECTED] /tmp/v1s1
basket# ls /tmp/v1s1
f1           lost+found/
basket# cat /tmp/v1s1/f1

basket# date >/tmp/v1/f1; zfs snapshot pool0/[EMAIL PROTECTED]
basket# mount -r /dev/zvol/dsk/pool0/[EMAIL PROTECTED] /tmp/v1s2
basket# cat /tmp/v1s2/f1
Mon Sep 10 23:07:42 BST 2007
basket# cat /tmp/v1/f1
Mon Sep 10 23:09:19 BST 2007

Note: the first snapshot sees the file but not the contents, while the second snapshot sees stale data.


Scenario 2 ...

basket# date >/tmp/v1/f2; lockfs -wf /tmp/v1; zfs snapshot pool0/ [EMAIL PROTECTED]; lockfs -u /tmp/v1
basket# mount -r /dev/zvol/dsk/pool0/[EMAIL PROTECTED] /tmp/v1s3
mount: Mount point /tmp/v1s3 does not exist.
basket# mkdir /tmp/v1s3
basket# mount -r /dev/zvol/dsk/pool0/[EMAIL PROTECTED] /tmp/v1s3
basket# cat /tmp/v1s3/f2
Mon Sep 10 23:18:17 BST 2007
basket# cat /tmp/v1/f2
Mon Sep 10 23:18:17 BST 2007
basket#

Note: the snapshot is consistent because of the lockfs(1M) calls.


Phil

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to