code: func (r *Root) Remove(v volume.Volume) error {
  	r.m.Lock()
  	defer r.m.Unlock()
  
  	lv, ok := v.(*localVolume)
  	if !ok {
  		return errdefs.System(errors.Errorf("unknown volume type %T", v))
  	}
  
  	if lv.active.count > 0 {
  		return errdefs.System(errors.Errorf("volume has active mounts"))
  	}
  
  	if err := lv.unmount(); err != nil {
  		return err
  	}
  
  	realPath, err := filepath.EvalSymlinks(lv.path)
  	if err != nil {
  		if !os.IsNotExist(err) {
  			return err
  		}
  		realPath = filepath.Dir(lv.path)
  	}
  
  	if !r.scopedPath(realPath) {
  		return errdefs.System(errors.Errorf("Unable to remove a directory outside of the local volume root %s: %s", r.scope, realPath))
  	}
  
  	if err := removePath(realPath); err != nil {
  		return err
  	}
  
  	delete(r.volumes, lv.name)
  	return removePath(filepath.Dir(lv.path))
  }
docs: // Remove removes the specified volume and all underlying data. If the
  // given volume does not belong to this driver and an error is
  // returned. The volume is reference counted, if all references are
  // not released then the volume is not removed.