diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
new file mode 100644
index 5d7888a..4aa7115
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
*************** checkDataDir(void)
*** 1235,1241 ****
  	 * reasonable check to apply on Windows.
  	 */
  #if !defined(WIN32) && !defined(__CYGWIN__)
! 	if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
  		ereport(FATAL,
  				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
  				 errmsg("data directory \"%s\" has group or world access",
--- 1235,1241 ----
  	 * reasonable check to apply on Windows.
  	 */
  #if !defined(WIN32) && !defined(__CYGWIN__)
! 	if (0 && stat_buf.st_mode & (S_IRWXG | S_IRWXO))
  		ereport(FATAL,
  				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
  				 errmsg("data directory \"%s\" has group or world access",
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
new file mode 100644
index bfc9f06..bf5cfe7
*** a/src/backend/storage/smgr/md.c
--- b/src/backend/storage/smgr/md.c
***************
*** 59,64 ****
--- 59,66 ----
  #define FILE_POSSIBLY_DELETED(err)	((err) == ENOENT || (err) == EACCES)
  #endif
  
+ int JJ_torn_page=0;
+ 
  /*
   *	The magnetic disk storage manager keeps track of open file
   *	descriptors in its own descriptor pool.  This is done to make it
*************** mdwrite(SMgrRelation reln, ForkNumber fo
*** 689,694 ****
--- 691,697 ----
  	off_t		seekpos;
  	int			nbytes;
  	MdfdVec    *v;
+         static int counter=0;
  
  	/* This assert is too expensive to have on normally ... */
  #ifdef CHECK_WRITE_VS_EXTEND
*************** mdwrite(SMgrRelation reln, ForkNumber fo
*** 713,719 ****
  				 errmsg("could not seek to block %u in file \"%s\": %m",
  						blocknum, FilePathName(v->mdfd_vfd))));
  
! 	nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ);
  
  	TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(forknum, blocknum,
  										reln->smgr_rnode.node.spcNode,
--- 716,733 ----
  				 errmsg("could not seek to block %u in file \"%s\": %m",
  						blocknum, FilePathName(v->mdfd_vfd))));
  
!         if (JJ_torn_page > 0 && counter++ > JJ_torn_page) {
! 	  nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ/3);
! 		ereport(FATAL,
! 				(errcode(ERRCODE_DISK_FULL),
! 				 errmsg("could not write block %u of relation %s: wrote only %d of %d bytes",
! 						blocknum,
! 						relpath(reln->smgr_rnode, forknum),
! 						nbytes, BLCKSZ),
! 				 errhint("JJ is screwing with the database.")));
!         } else {
! 	  nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ);
! 	}
  
  	TRACE_POSTGRESQL_SMGR_MD_WRITE_DONE(forknum, blocknum,
  										reln->smgr_rnode.node.spcNode,
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
new file mode 100644
index a5becbe..b6d8ebf
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 127,132 ****
--- 127,133 ----
  /* XXX these should appear in other modules' header files */
  extern bool Log_disconnections;
  extern int	CommitDelay;
+ int	JJ_torn_page;
  extern int	CommitSiblings;
  extern char *default_tablespace;
  extern char *temp_tablespaces;
*************** static struct config_int ConfigureNamesI
*** 2031,2036 ****
--- 2032,2046 ----
  	},
  
  	{
+ 		{"JJ_torn_page", PGC_USERSET, WAL_SETTINGS,
+ 			gettext_noop("Simulate a torn-page crash after this number of page writes (0 to turn off)"),
+ 			NULL
+ 		},
+ 		&JJ_torn_page,
+ 		0, 0, 100000, NULL, NULL
+ 	},
+ 
+ 	{
  		{"commit_siblings", PGC_USERSET, WAL_SETTINGS,
  			gettext_noop("Sets the minimum concurrent open transactions before performing "
  						 "commit_delay."),
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
new file mode 100644
index 96da086..1cdebbb
*** a/src/backend/utils/misc/postgresql.conf.sample
--- b/src/backend/utils/misc/postgresql.conf.sample
***************
*** 159,165 ****
  
  # - Settings -
  
! #wal_level = minimal			# minimal, archive, or hot_standby
  					# (change requires restart)
  #fsync = on				# turns forced synchronization on or off
  #synchronous_commit = on		# synchronization level; on, off, or local
--- 159,165 ----
  
  # - Settings -
  
! wal_level = archive			# minimal, archive, or hot_standby
  					# (change requires restart)
  #fsync = on				# turns forced synchronization on or off
  #synchronous_commit = on		# synchronization level; on, off, or local
***************
*** 180,199 ****
  
  # - Checkpoints -
  
! #checkpoint_segments = 3		# in logfile segments, min 1, 16MB each
! #checkpoint_timeout = 5min		# range 30s-1h
  #checkpoint_completion_target = 0.5	# checkpoint target duration, 0.0 - 1.0
  #checkpoint_warning = 30s		# 0 disables
  
  # - Archiving -
  
! #archive_mode = off		# allows archiving to be done
  				# (change requires restart)
! #archive_command = ''		# command to use to archive a logfile segment
  				# placeholders: %p = path of file to archive
  				#               %f = file name only
  				# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
! #archive_timeout = 0		# force a logfile segment switch after this
  				# number of seconds; 0 disables
  
  
--- 180,199 ----
  
  # - Checkpoints -
  
! checkpoint_segments = 1		# in logfile segments, min 1, 16MB each
! checkpoint_timeout = 30s		# range 30s-1h
  #checkpoint_completion_target = 0.5	# checkpoint target duration, 0.0 - 1.0
  #checkpoint_warning = 30s		# 0 disables
  
  # - Archiving -
  
! archive_mode = on		# allows archiving to be done
  				# (change requires restart)
! archive_command = 'echo archive_command %p %f `date`'		# command to use to archive a logfile segment
  				# placeholders: %p = path of file to archive
  				#               %f = file name only
  				# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
! archive_timeout = 30		# force a logfile segment switch after this
  				# number of seconds; 0 disables
  
  
***************
*** 382,394 ****
  #debug_print_rewritten = off
  #debug_print_plan = off
  #debug_pretty_print = on
! #log_checkpoints = off
  #log_connections = off
  #log_disconnections = off
  #log_duration = off
  #log_error_verbosity = default		# terse, default, or verbose messages
  #log_hostname = off
! #log_line_prefix = ''			# special values:
  					#   %a = application name
  					#   %u = user name
  					#   %d = database name
--- 382,394 ----
  #debug_print_rewritten = off
  #debug_print_plan = off
  #debug_pretty_print = on
! log_checkpoints = on
  #log_connections = off
  #log_disconnections = off
  #log_duration = off
  #log_error_verbosity = default		# terse, default, or verbose messages
  #log_hostname = off
! log_line_prefix = '%p %i %m:'			# special values:
  					#   %a = application name
  					#   %u = user name
  					#   %d = database name
