DOCS InstallGet StartedUser GuideRelease Notes

Transparently Moving Filesystem Data from One Bucket to Another Bucket

This article provides an example of how to transparently move your filesystem data from one bucket to another bucket using an overlay filesystem. It assumes that your current filesystem is actively mounted on one or more servers and you want the filesystem to be active during the move. These steps can be used when you want to change your bucket to a different region or to a different object store backend without downtime.

In this example, we set up new servers to copy the filesystem data from the old bucket to the new bucket, while your existing servers continue to run. Traffic is redirected from the old servers to the new servers. We use an overlay filesystem to make sure reads and writes are visible on all machines during the switchover.

This example assumes that your applications are reading and writing to objectivefs at /ofs-target.

Important: Make sure that the new servers have enough memory to mount both filesystems.

Part I. Prepare the target filesystem on a new server

On a new server, run the following steps:

Install AUFS.
# apt-get update
# apt-get install linux-image-extra-virtual
# apt-get install linux-image-extra-4.4.0-53-generic
Create the mount directories for the existing, new and overlay filesystems.
# mkdir -p /ofs/{old,new}
# mkdir -p /ofs/overlay_{old,new}
Create new target filesystem, e.g. bucket_new.
# mount.objectivefs create -l <region> bucket_new
Mount both old and new buckets.
# mount.objectivefs bucket_old /ofs/old
# mount.objectivefs bucket_new /ofs/new
Create an overlay filesystem with writes going into the old bucket.

This is needed to make sure all servers can see all writes during the switchover.

# mount -t aufs -o br=/ofs/old:/ofs/new none /ofs/overlay_old
# ln -s /ofs/overlay_old /ofs-target

All data written to /ofs-target/* will be stored in the bucket_old mounted on /ofs/old.

Copy data from the old bucket to the new bucket.
# rsync -a /ofs/old/ /ofs/new
If you need to set up multiple new servers, repeat steps 1, 2, 4 and 5 above.

Part II. Switch traffic to the new servers

Switch traffic from the old servers to the new servers.
Once all old servers have been switched to new servers: Change the write target of the overlay filesystem to /ofs/new.
# mount -t aufs -o br=/ofs/new:/ofs/old none /ofs/overlay_new
# ln -s /ofs/overlay_new /ofs.tmp && mv -Tf /ofs.tmp /ofs-target
Verify that step 2 has completed on all new servers.
On one of the new server, copy any intermediate writes from the old bucket to the new bucket.
# rsync -a /ofs/old/ /ofs/new

Part III. Switch to using only the new bucket

Switch to using only the new bucket.
# ln -s /ofs/new /ofs.tmp && mv -Tf /ofs.tmp /ofs-target
Unmount the old and overlay filesystems.
# umount /ofs/overlay_new
# umount /ofs/overlay_old
# umount /ofs/old

Now, your filesystem data is moved to the new bucket and you are running only using the new bucket.


Last updated ObjectiveFS staff

ObjectiveFS is a shared file system for Linux and macOS that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com