I recently had a challenge to tackle: Migrating account data from one Google Workspace tenant to another. I thought this would be an easy task, but unfortunately Google provides no easy method to transfer accounts between tenants. The only first-party options that exist right now are:
- Google Workspace Domain Transfer, which is a Google consultancy (!) service and definitely very expensive.
- Google Workspace Migrate, which is self-serve but has some wild system requirements, including multiple beefy servers inside a cluster. While this might be realistic for some larger-scale migrations, it was not realistic in my case. Plus, it only supports tenants licensed with Google Workspace Business Standard or higher, and one of my tenants was using Business Starter.
Because these first-party options are pretty unappealing to say the least, I figured I would just migrate the data by hand. This made sense for me because I only needed to migrate a few accounts, and most of the accounts’ data was in Google Drive. I knew that creating a Shared Drive in the destination tenant is the only way to properly transfer ownership of files between Workspace tenants – trying to switch ownership through the “share” dialog on a file or folder will throw an error if the destination account is in a different tenant. Google says this is by design as a means of data loss prevention 🤷♀️
So based on this, I figured the migration would be as easy as dragging-and-dropping files from accounts in my origin tenant, to my intermediary Shared Drive, to accounts in my destination tenant… right?
Wrong. I first tried to move files from my origin accounts to the Shared Drive using the Google Drive desktop application. However, that showed an error like this:
Apparently, it’s not possible to move Google Docs/Sheets/Slides files using the desktop application. But that error message provides a pretty helpful resolution, and I was indeed able to move my (root level – this matters later) Google Docs files to the intermediary Shared Drive through the Drive web interface.
Where I ran into problems was trying to move folders from my origin accounts to the intermediary Shared Drive. Apparently, the web interface doesn’t support moving folders to Shared Drives, even if the permission to do so is expressly given to a user in the Workspace Admin Console, although the opposite direction – out of Shared Drives – works fine. This is a bit of a strange limitation to me, and it took a long time for me to figure out how to handle this issue.
One of the biggest challenges I faced was ensuring that file IDs and permissions would be preserved after the files were moved to the Shared Drive, so that links and files I previously shared would still work for my recipients. Obviously, moving files to the Shared Drive through the web interface preserves both IDs and permissions, but some solutions preserve only one or neither. For example, rclone, a tool I frequently used to bulk-manipulate data in cloud storage, can only perform a client-side move in a situation like mine. That means it downloads all the files from the origin Google Drive and re-uploads them to the Shared Drive. This not only destroys file IDs and permissions, but it also means all Google Docs/Sheets/Slides have to be exported to OpenDocument format or Microsoft Office format, which can break their formatting.
I know there are a handful of third-party all-in-a-box migration solutions out there, like CloudM and Movebot, which promise to perform the move operation without destroying permissions/file IDs. These probably work well too, but I wasn’t interested in paying hundreds of dollars just to move a small amount of data between my Workspace tenants.
What I settled on is a tool called GAMADV-XTD3, which is an open-source CLI for Google Workspace administrators – check out the GitHub repo here. It has some pretty sophisticated tools to move Google Drive files, and they’re all server-sided – that is, they rely on Google Drive APIs to handle the move operations in their entirety. Also, even though it relies on a variety of Google Cloud/OAuth/Admin Console permissions, it has an intuitive setup script that essentially handles all of the permissions grants, which is great (as long as you’re willing to trust the script). You can take a look at the documentation, but the command I used to handle my migration was:
gam user <origin user email> move drivefile root teamdriveparentid <destination Shared Drive ID> mergewithparent true
(note that it’s very important to use a move operation rather than a copy operation, because a copy obviously won’t preserve file IDs!)
This will move all of the files from the origin user’s “My Drive” into the root of the destination Shared Drive. It doesn’t preserve folder IDs (since folders can’t be moved in Google Drive for whatever reason), but it will preserve the directory structure, along with file IDs and the permissions applied to files. Additionally, Google Docs will stay Google Docs, and GAM automatically handles the ownership transfer from the old Workspace tenant to the new Workspace tenant. Aside from being slow – it seems like the Google Drive move/delete APIs are restricted to about 2 operations per second – it’s the slickest free solution I’ve found.