code: func (m *Manager) persistVolume(tx *bolt.Tx, vol volume.Volume) error {
  	// Save the general volume info
  	volumesBucket := tx.Bucket([]byte("volumes"))
  	id := vol.Info().ID
  	k := []byte(id)
  	_, volExists := m.volumes[id]
  	if !volExists {
  		volumesBucket.Delete(k)
  	} else {
  		b, err := json.Marshal(vol.Info())
  		if err != nil {
  			return fmt.Errorf("failed to serialize volume info: %s", err)
  		}
  		err = volumesBucket.Put(k, b)
  		if err != nil {
  			return fmt.Errorf("could not persist volume info to boltdb: %s", err)
  		}
  	}
  	// Save any provider-specific metadata associated with the volume.
  	// These are saved per-provider since the deserialization is also only defined per-provider implementation.
  	providerBucket, err := m.getProviderBucket(tx, m.providerIDs[vol.Provider()])
  	if err != nil {
  		return fmt.Errorf("could not persist provider volume info to boltdb: %s", err)
  	}
  	providerVolumesBucket := providerBucket.Bucket([]byte("volumes"))
  	if !volExists {
  		providerVolumesBucket.Delete(k)
  	} else {
  		b, err := vol.Provider().MarshalVolumeState(id)
  		if err != nil {
  			return fmt.Errorf("failed to serialize provider volume info: %s", err)
  		}
  		err = providerVolumesBucket.Put(k, b)
  		if err != nil {
  			return fmt.Errorf("could not persist provider volume info to boltdb: %s", err)
  		}
  	}
  	return nil
  }
docs: // Called to sync changes to disk when a volume is updated