Subject: unsynced vnd images
To: None <netbsd-users@netbsd.org>
From: Florian Stoehr <netbsd@wolfnode.de>
List: netbsd-users
Date: 02/18/2005 15:37:01
Hi,

I use cgd on a vnd device for my backups. Then I'd like to copy away the 
vnd-images.

Unfortunately, I cannot unconfigure the vnds or cgds since shutting
down the cgd will require the password for the next run again :-(

I thought the system would track which buffers need syncing and use
the in-cache version if accessing a not-yet-written file? This does
*NOT* work, at least not in the following case:

disk.img -> vnd -> cgd -> /mnt

when doing a 'echo "test" >> /mnt/a.txt' on terminal one, and doing a
'cp disk.img new.img' on the next console seconds *AFTER* the first
command finishes, the content of a.txt in the image will be EMPTY!

Seems like this chaining is a problem.

What about a workaround here? I read sync(2) does not guarantee to
sync all buffers. OK, when unmounting /mnt, it should sync immediately,
but at least the cgd. Will the imagefile "disk.img" will be synced, too?

-Florian