1

On AWS, I have an EC2 instance for my database server with an attached 250GB EBS volume (200GB of actual data) for data storage. This volume has not been previously snapshotted.

I need to move this volume to another availability zone. I'm debating on the best approach. The server is fairly active, with a high number of writes and updates.

  1. I take the website offline, and stop the database server. I start the snapshot, and once complete, launch a volume based on the snapshot in the new availability zone. I would estimate about 4 hours of downtime as I wait for the snapshot to finish.

  2. I'm unsure if this would be more efficient. I take a snapshot of the volume while the site stays online. This will likely take 5 or 6 hours, but there is no downtime yet. The snapshot is obviously outdated by the time it finishes (and potentially corrupt?). I then take the website offline, stop the database server, and similar to above, create a new snapshot and volume. Since the second snapshot should only need to copy data that was modified in those 5 or 6 hours, I'm assuming I won't have 4 hours of downtime, but the snapshot will be much faster. Is this correct?

Thanks for the help.

3

Your assumption that the subsequent snapshots should be faster seems correct (though I haven't tried). Also I don't think snapshotting 250GB volume will take 4 hours, I guess it will be faster.

On the other hand - what database are you using? MySQL? PostgreSQL? SQL Server? Oracle?

You may be better off setting up a DB replica on the Database level (also called master-slave setup), get the two instances in sync and then promote the slave to the new master. That way you should be able to do it with very little downtime.

  • 1
    Subsequent snapshots are phenomenally faster, since only the changed blocks are actually read from the disk. It isn't documented just how they do it, but EBS seems to keep some kind of internal bitmap of blocks dirtied since the last snapshot. – Michael - sqlbot Dec 11 '18 at 0:15
  • Reporting back after the move, and you were right, it was faster than 4 hours. I went with option 2. I did a snapshot of the 250GB data volume on the database server (this site serves about 100 page views a second, so quite busy). The snapshot took 2 hours to complete. I then shutdown the server, and took a second snapshot. This snapshot finished in 9 minutes. The volume was instantly created in the new availability zone, and the server went back online. It was painfully slow for 30 minutes as the volume loaded in the data for the first time as it was being viewed, but then it was normal. – Guest8123982 Dec 11 '18 at 7:17

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.