Moving a Moab - sul-dlss/preservation_catalog GitHub Wiki

Moving Moabs

Sometimes it's necessary to move Moabs from one storage root to another, either in bulk as part of a storage hardware migration, or manually for a small number, as when an existing Moab might get too much additional content for the storage root it's currently on.

There are rake tasks and documentation to support the bulk migration scenario.

When the need for moving a single Moab arises, the repository manager or a developer should:

  1. [on the file system] Move the Moab to a storage root with enough space
  2. [from pres cat VM rails console] Update prescat with the new location
  3. Accession the additional content to be preserved

Update PresCat

Updating Preservation Catalog to reflect the Moab's new location can be done using Rails console, like so:

target_storage_root = MoabStorageRoot.find_by!(name: '/services-disk-with-lots-of-free-space')
moab_rec = MoabRecord.by_druid('ab123cd4567')
moab_rec.migrate_moab(target_storage_root).save! # save! is important.  migrate_moab doesn't save automatically, to allow building larger transactions.

Under the assumption that the contents of the Moab were written anew in the target location, #migrate_moab will clear all audit timestamps related to the state of the Moab on our disks, along with status_details. status will similarly be re-set to validity_unknown, and a checksum validation job will automatically be queued for the Moab.

Confirm it worked

Run M2C on the Moab to confirm all is well (CV will be queued automatically by the #migrate_moab call)

 pry(main)> MoabToCatalogJob.perform_now(root, 'qd527zm3425', '/services-disk16/sdr2objects/qd/527/zm/3425/qd527zm3425')
Performing MoabToCatalogJob (Job ID: 2f2718d3-be2c-4146-aa4c-bb1a32f1f5e5) from Resque(m2c) with arguments: #<GlobalID:0x0000000007811580 @uri=#<URI::GID gid://preservation-catalog/MoabStorageRoot/17>>, "qd527zm3425", "/services-disk16/sdr2objects/qd/527/zm/3425/qd527zm3425"
check_existence qd527zm3425 called
Enqueued ZipmakerJob (Job ID: 5f95d1eb-e04d-46f7-a6c3-6f67cb344689) to Resque(zipmaker) with arguments: "qd527zm3425", 1
Enqueued ZipmakerJob (Job ID: 0eca3d8c-8362-4e7c-bf73-f7d6663b56a0) to Resque(zipmaker) with arguments: "qd527zm3425", 2
Enqueued ZipmakerJob (Job ID: b0a9f3a9-1c2b-4b1b-a194-cfc5462da90e) to Resque(zipmaker) with arguments: "qd527zm3425", 3
Enqueued ZipmakerJob (Job ID: 8826fd5d-2fb8-4f9a-8ebe-4fb3ee867acf) to Resque(zipmaker) with arguments: "qd527zm3425", 4
Enqueued ZipmakerJob (Job ID: 3cae9320-5c64-4d38-ae11-f1a70435d617) to Resque(zipmaker) with arguments: "qd527zm3425", 5
Enqueued ZipmakerJob (Job ID: cd0a821d-0091-487a-ad7e-19a86e632bcc) to Resque(zipmaker) with arguments: "qd527zm3425", 5
check_existence(qd527zm3425, services-disk16) actual version (5) greater than CompleteMoab db version (4)
Performed MoabToCatalogJob (Job ID: 2f2718d3-be2c-4146-aa4c-bb1a32f1f5e5) from Resque(m2c) in 501.43ms
=> [{:actual_vers_gt_db_obj=>"actual version (5) greater than CompleteMoab db version (4)"}]

Verify the expected number of versions:

[18] pry(main)> cm = CompleteMoab.by_druid('qd527zm3425')
=> [#<CompleteMoab:0x00000000049c8cf0
  id: 464811,
  version: 5,
  preserved_object_id: 464811,
  moab_storage_root_id: 17,
  created_at: Sun, 21 Jan 2018 05:46:11 UTC +00:00,
  updated_at: Tue, 26 Feb 2019 00:43:48 UTC +00:00,
  last_moab_validation: Tue, 26 Feb 2019 00:43:48 UTC +00:00,
  last_checksum_validation: Sun, 17 Feb 2019 16:31:30 UTC +00:00,
  size: 214114846937,
  status: "ok",
  last_version_audit: Tue, 26 Feb 2019 00:43:48 UTC +00:00,
  last_archive_audit: Wed, 16 Jan 2019 10:55:07 UTC +00:00>]

Verify that the expected number of ZMVs have been created for the number of druid-versions:

[7] pry(main)> ZippedMoabVersion.by_druid('qd527zm3425')
=> [#<ZippedMoabVersion:0x0000000006386f98
  id: 8782080,
  version: 5,
  complete_moab_id: 464811,
  zip_endpoint_id: 3,
  created_at: Tue, 26 Feb 2019 00:43:48 UTC +00:00,
  updated_at: Tue, 26 Feb 2019 00:43:48 UTC +00:00>,
 #<ZippedMoabVersion:0x0000000006385cd8
  id: 8782079,
  version: 5,
  complete_moab_id: 464811,
  zip_endpoint_id: 1,
  created_at: Tue, 26 Feb 2019 00:43:48 UTC +00:00,
  updated_at: Tue, 26 Feb 2019 00:43:48 UTC +00:00>,

...etc