code: func (db *DB) grow(sz int) error {
  	// Ignore if the new size is less than available file size.
  	if sz <= db.filesz {
  		return nil
  	}
  
  	// If the data is smaller than the alloc size then only allocate what's needed.
  	// Once it goes over the allocation size then allocate in chunks.
  	if db.datasz < db.AllocSize {
  		sz = db.datasz
  	} else {
  		sz += db.AllocSize
  	}
  
  	// Truncate and fsync to ensure file size metadata is flushed.
  	// https://github.com/boltdb/bolt/issues/284
  	if !db.NoGrowSync && !db.readOnly {
  		if runtime.GOOS != "windows" {
  			if err := db.file.Truncate(int64(sz)); err != nil {
  				return fmt.Errorf("file resize error: %s", err)
  			}
  		}
  		if err := db.file.Sync(); err != nil {
  			return fmt.Errorf("file sync error: %s", err)
  		}
  	}
  
  	db.filesz = sz
  	return nil
  }
docs: // grow grows the size of the database to the given sz.