Resizing Fedora Store

The Fedora (fcrepo) data store can be moved and resized with fairly minimal consequences (tested 1/4/16 by moving staging's fedora datastore to a new disk). See the steps below:

  1. Create a new AWS volume(s) to hold the data (current (2018) practice is to use the cold storage HD type due to lower costs).
    1. MAKE SURE THE VOLUME IS IN THE SAME REGION AS THE INSTANCE
  2. Transfer the data to the new volume(s). There are 3 ways to do this.
    1. This can be done with a snapshot (see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html) of the old volume.
      1. This requires making a snapshot, then a volume.
      2. Snapshot created volumes have the data already, but initial access times may be slow since the data is not entirely on disk as per AWS documentation until it is accessed.
      3. This is not the recommended method in most cases.
    2. If not using snapshots,  we'll need to attach and mount the volume.
    3. Attach the volume in the web console by going to tasks->attach or use the command (ec2-attach-volume volume_id --instance instance_id --device device)
    4. Copy the files over (rsync -aA oldlocation(s) new location) the options should preserve all attributes and links.
      1. This must be done when nobody is changing or adding data to avoid missing content.
    5. If you do not want to use the existing disk to avoid stress on app-fedora, you can restore from the past day using S3. This will lose work unless done at the end of the day after backups have been taken.
      1. Use the chf-hydra-backups bucket and copy the fedora data
      2. Use the sync tool (aws s3 sync s3://location disk)
      3. Change the owner of all files to tomcat7
    6. Stop tomcat so Fedora is turned off
    7. Unmount the old storage volume
    8. Mount the new storage volume in the old volume's location (currently /opt/fedora-data)
    9. Edit the owner of the folder to be tomcat7 with chown (newly made and mounted disks are owned by root)
    10. Edit the /etc/fstab to use the new disk
    11. Restart tomcat (this will restart Fedora)
    12. Check to make sure the repository is still working by looking at a few items and doing a test search or two.
    13. Delete the old volume.