diff -Naur dvhtool-1.0.1-original/dvhlib.c dvhtool-1.0.1.orig/dvhlib.c
--- dvhtool-1.0.1-original/dvhlib.c	2004-09-27 10:57:45.000000000 -0400
+++ dvhtool-1.0.1.orig/dvhlib.c	2004-09-29 09:51:54.000000000 -0400
@@ -9,13 +9,12 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
+#include <linux/fs.h>
 #include <netinet/in.h>
 
 #include "dvhlib.h"
 #include "dvh.h"
 
-#define blksize 512
-
 #ifdef DEBUG
 # define dprintf(x...) fprintf(stderr, x)
 #else
@@ -219,6 +218,20 @@
 	swap_int(vh->vh_csum);
 }
 
+int
+dvh_get_block_size( struct dvh_handle * handle )
+{
+	const int DefaultBlockSize = 512;
+	int blocksize = 0;
+	if ( ioctl( handle->dvh_fd, BLKSSZGET, &blocksize ) ) {
+		fprintf(stderr, "Warning: Could not detect block size: %s\n",
+			strerror( errno ) );
+		return DefaultBlockSize;
+	}
+	dprintf("Device block size is %d\n", blocksize);
+	return blocksize;
+}
+
 struct dvh_handle *
 dvh_open(const char *vh, int mode)
 {
@@ -272,7 +285,7 @@
 
 void
 dvh_vh_to_file(const struct dvh_handle *dvh, const char *vh_name,
-               const char *u_name)
+               const char *u_name, int blksize)
 {
 	const struct volume_header *vh = &dvh->dvh_vh;
 	const struct volume_directory *vd = vh->vh_vd;
@@ -310,7 +323,8 @@
 }
 
 void
-dvh_file_to_vh(struct dvh_handle *dvh, const char *u_name, const char *vh_name)
+dvh_file_to_vh(struct dvh_handle *dvh, const char *u_name, const char *vh_name,
+               int blksize)
 {
 	struct volume_header *vh = &dvh->dvh_vh;
 	struct volume_directory *vd = vh->vh_vd;
@@ -428,7 +442,7 @@
 }
 
 void
-dvh_vh_remove(struct dvh_handle *dvh, const char *vh_name)
+dvh_vh_remove(struct dvh_handle *dvh, const char *vh_name, int blksize)
 {
 	struct volume_header *vh = &dvh->dvh_vh;
 	struct volume_directory *vd = vh->vh_vd;
diff -Naur dvhtool-1.0.1-original/dvhlib.h dvhtool-1.0.1.orig/dvhlib.h
--- dvhtool-1.0.1-original/dvhlib.h	2001-02-24 05:37:37.000000000 -0500
+++ dvhtool-1.0.1.orig/dvhlib.h	2004-09-29 09:53:49.000000000 -0400
@@ -1,3 +1,6 @@
+#ifndef _DVHLIB_H
+#define _DVHLIB_H
+
 #include "config.h"
 
 #ifdef HAVE_INTTYPES_H
@@ -37,13 +40,17 @@
 #define DVH_READWRITE 2
 
 extern struct dvh_handle * dvh_open(const char *vh, int mode);
-void extern dvh_close(struct dvh_handle *dvh);
-extern void dvh_vh_remove(struct dvh_handle *dvh, const char *vh_name);
+extern void dvh_close(struct dvh_handle *dvh);
+extern int dvh_get_block_size(struct dvh_handle *handle);
+extern void dvh_vh_remove(struct dvh_handle *dvh, const char *vh_name,
+                          int blocksize);
 extern void dvh_vh_to_file(const struct dvh_handle *dvh, const char *vh_name,
-                           const char *u_name);
+                           const char *u_name, int blocksize);
 extern void dvh_file_to_vh(struct dvh_handle *dvh, const char *u_name,
-                           const char *dvh_name);
+                           const char *dvh_name, int blocksize);
 extern void dvh_print_vh(const struct dvh_handle *vh);
 extern void dvh_print_vd(const struct dvh_handle *vh);
 extern void dvh_print_pt(const struct dvh_handle *vh);
 extern void __attribute__((noreturn)) die(const char *message);
+
+#endif
diff -Naur dvhtool-1.0.1-original/dvhtool.8 dvhtool-1.0.1.orig/dvhtool.8
--- dvhtool-1.0.1-original/dvhtool.8	2004-09-27 10:57:45.000000000 -0400
+++ dvhtool-1.0.1.orig/dvhtool.8	2004-09-29 10:11:54.000000000 -0400
@@ -48,6 +48,11 @@
 .BI "\-d,  \-\-device " "devicename"
 Specify the volume header device name (or file image)
 .TP
+.B \-b,  \-\-blocksize "blocksize"
+Specify the block size of the device.  If this is not specified, it will attempt to request the block size from the device (similar to 
+.I blockdev --getss device
+), and if unavailable, it will default to 512 bytes.
+.TP
 .B \-\-print-volume-header
 Show volume header data only
 .TP
diff -Naur dvhtool-1.0.1-original/dvhtool.c dvhtool-1.0.1.orig/dvhtool.c
--- dvhtool-1.0.1-original/dvhtool.c	2004-09-27 10:57:45.000000000 -0400
+++ dvhtool-1.0.1.orig/dvhtool.c	2004-09-29 10:26:56.000000000 -0400
@@ -31,6 +31,7 @@
 #define DVH_READWRITE	2
 
 #define OPT_DEVICE 'd'
+#define OPT_BLOCK_SIZE 'b'
 #define OPT_PRINT_VH 256
 #define OPT_PRINT_VD 257
 #define OPT_PRINT_PT 258
@@ -42,6 +43,7 @@
 
 static struct option long_options[] = {
 	{"device", required_argument, NULL, OPT_DEVICE},
+	{"blocksize", required_argument, 0, OPT_BLOCK_SIZE},
 	{"print-volume-header", no_argument, NULL, OPT_PRINT_VH},
 	{"print-volume-directory", no_argument, NULL, OPT_PRINT_VD},
 	{"print-partitions", no_argument, NULL, OPT_PRINT_PT},
@@ -73,10 +75,13 @@
 	int c;
 	enum actions action = show_usage;
 
+	// Default the block size to the configuration-based block size.
+	int block_size = 0;
+
 	while(1) {
 		int option_index = 0;
 
-		c = getopt_long(argc, argv, "d:", long_options, &option_index);
+		c = getopt_long(argc, argv, "d:b:", long_options, &option_index);
 
 
 		if (c == -1)
@@ -87,6 +92,14 @@
 			device = optarg;
 			break;
 
+                case OPT_BLOCK_SIZE:
+                        block_size = atoi( optarg );
+			if ( block_size % 512 ) {
+				printf( "Warning: Block size %d is not " \
+                                        "a multiple of 512.\n", block_size );
+			}
+                        break;
+
 		case OPT_PRINT_VH:
 			action = print_vh;
 			break;
@@ -124,9 +137,10 @@
 
 	if (action == show_usage) {
 		printf (
-"Usage: %s --device DEVNAME [OPTIONS]\n"
+"Usage: %s {-d|--device} DEVNAME [OPTIONS]\n"
 "Manipulate the volume header of DEVNAME\n\n"
 "Options:\n\n"
+"--blocksize SIZE		Configures the block size\n"
 "--print-volume-header		Show header data only\n"
 "--print-volume-directory	Show volume table of contents\n"
 "--print-partitions		Show partition data\n"
@@ -143,6 +157,11 @@
 	if (dvh == NULL)
 		die("Can't open Disk Volume Header");
 
+	// If the block size parameter was not specified, attempt to discover.
+	if ( block_size == 0 ) {
+		block_size = dvh_get_block_size( dvh );
+	}
+
 	if (action == print_vh)
 		dvh_print_vh(dvh);
 	if (action == print_vd)
@@ -167,7 +186,7 @@
 		if (dvh == NULL)
 			die("Can't reopen Disk Volume Header rw");
 		
-		dvh_vh_remove(dvh, vh_file);
+		dvh_vh_remove(dvh, vh_file, block_size);
 	}
 	if (action == vh_to_unix) {
 		char *vh_file, *u_file;
@@ -177,7 +196,7 @@
 
 		vh_file = argv[optind++];
 		u_file = argv[optind];
-		dvh_vh_to_file(dvh, vh_file, u_file);
+		dvh_vh_to_file(dvh, vh_file, u_file, block_size);
 	}
 	if (action == unix_to_vh) {
 		char *vh_file, *u_file;
@@ -194,7 +213,7 @@
 		if (dvh == NULL)
 			die("Can't reopen Disk Volume Header rw");
 		
-		dvh_file_to_vh(dvh, u_file, vh_file);
+		dvh_file_to_vh(dvh, u_file, vh_file, block_size);
 	}
 
 

