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:
- 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).
- MAKE SURE THE VOLUME IS IN THE SAME REGION AS THE INSTANCE
- Transfer the data to the new volume(s). There are 3 ways to do this.
- This can be done with a snapshot (see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html) of the old volume.
- This requires making a snapshot, then a volume.
- 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.
- This is not the recommended method in most cases.
- If not using snapshots, we'll need to attach and mount the volume.
- 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)
- Copy the files over (rsync -aA oldlocation(s) new location) the options should preserve all attributes and links.
- This must be done when nobody is changing or adding data to avoid missing content.
- 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.
- Use the chf-hydra-backups bucket and copy the fedora data
- Use the sync tool (aws s3 sync s3://location disk)
- Change the owner of all files to tomcat7
- Stop tomcat so Fedora is turned off
- Unmount the old storage volume
- Mount the new storage volume in the old volume's location (currently /opt/fedora-data)
- Edit the owner of the folder to be tomcat7 with chown (newly made and mounted disks are owned by root)
- Edit the /etc/fstab to use the new disk
- Restart tomcat (this will restart Fedora)
- Check to make sure the repository is still working by looking at a few items and doing a test search or two.
- Delete the old volume.
- This can be done with a snapshot (see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html) of the old volume.