private void writeCanonicalId(int id, Object object) {
    try (HeapDataOutputStream hdos = new HeapDataOutputStream(32, KnownVersion.CURRENT)) {
      hdos.write(IFREC_ADD_CANONICAL_MEMBER_ID);
      hdos.writeInt(id);
      DataSerializer.writeObject(object, hdos);
      hdos.write(END_OF_RECORD_ID);
      writeIFRecord(hdos, true);
    } catch (IOException ex) {
      DiskAccessException dae = new DiskAccessException(
          String.format("Failed writing data to initialization file because: %s", ex),
          parent);
      if (!compactInProgress) {
        parent.handleDiskAccessException(dae);
      }
      throw dae;
    }
  }
Write all live data to the init file
geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java