code: private static void renameCheckpointInDir(StorageDirectory sd, long txid)
        throws IOException {
      File ckpt = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE_NEW, txid);
      File curFile = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE, txid);
      // renameTo fails on Windows if the destination file 
      // already exists.
      LOG.info("Renaming  " + ckpt.getAbsolutePath() + " to "
          + curFile.getAbsolutePath());
      if (!ckpt.renameTo(curFile)) {
        if (!curFile.delete() || !ckpt.renameTo(curFile)) {
          throw new IOException("renaming  " + ckpt.getAbsolutePath() + " to "  + 
              curFile.getAbsolutePath() + " FAILED");
        }
      }    
    }
docs: Rolls checkpointed image.