ufs_copy fails with aio + compression2009年02月18日 06時03分52秒

Sysutils/ufs_copy in ports is a very useful tool to duplicate a disk-image. It swipes the disk and copy only the blocks being used. It is like dd except that ufs_copy does not copy garbage. It is faster than level-0 dump because ufs_copy uses sequential read and write; however, no incremental.

Ufs_copy also supports asynchronous I/O which makes coping faster. kldload aio needs to be done, prior. I verified that it works fine.

Ufs_copy, in addision, takes -c option to create a compressed filesystem image. It uses a copy of cloopfs source code. That is GEOM uzip equivalent. Indeed, it is ufs_copy -c is equivalent to mkuzip(1) excpet that mkuzip copies every block. ufs_copy is faster and results higher compression rate because how ufs_copy handles unused blocks. This works very well, too.

However, be CAUTIONED. When -a, asynchronous, and -c, compression, are used together, ufs_copy generates unreadable disk image.


$ ufs_copy -a -c -B /dev/da0.journal /usr/local/tmp/da0.uzip
$ mdconfig -a -t vnode -f /usr/local/tmp/da0.uzip 
 md4
$ mount -r /dev/md4.uzip /mnt/backup/
mount: /dev/md4.uzip : Invalid argument
$ tunefs -p /dev/md4
tunefs: /dev/md4: could not read superblock to fill out disk
$ tunefs -p /dev/md4.uzip 
tunefs: /dev/md4.uzip: could not read superblock to fill out disk
$ dumpfs /dev/md4.uzip 
dumpfs: /dev/md4.uzip: could not read superblock to fill out disk