Donate to support Ukraine's independence.

21 Apr'14

Moving Google Drive folder

UPD: My approach was partly successful, because Google Drive still decided to resync all my files after I successfully moved the root folder. If you have any idea what I could’ve missed, you’re welcome to leave a comment below.

Let’s describe what we aim to do: we have Google Drive on our computer in a synced state, but we want to move the whole Google Drive folder to another path (or in case of Windows, most probably - another disk).

All actions described below were performed on Google Drive for Windows (App version: 1.15.6464.0228). Windows version is 6.3 (build 9600) - in other words, it’s Windows 8.1.

You can check the version of your Google Drive client by right-clicking the Google Drive icon in the toolbar and selecting “About”, as shown in the image below.

Drive client about window

Drive client version information

Google Drive client doesn’t allow you to do such thing by default: it’s not available in settings and if you follow a common advice to close Drive, move the folder and upon a GDrive client start locate a new folder as suggested in a dialog, you’ll end up seeing an alert “This is not your original Google Drive folder”. You can see a screenshot of such a dialog below:

Drive client missing folder warning

At some point I came across the article written by Rainabba claiming to describe how to REALLY [sic] move the GDrive folder. After following his instructions of hex file editing (I used free HxD hex editor), I was still unable to open the Drive. After trying to open it as a SQLite database, I understood it was damaged because the strings were of different length.

So I decided to edit both files in a correct manner - by using SQLite editor. For this task I decided to use the SQLite Manager which is a Firefox add-on.

Main steps

  1. Stop Google Drive client. You must close is completely, ensuring the tray icon is not visible. You can verify that the process is not running by pressing Ctrl+Shift+Esc and looking for a process named “googledrivesync.exe” under Details tab.
  2. Update configuration files under C:\Users\*****\AppData\Local\Google\Drive. Here you should replace ****** by your account name. We’ll dedicate the rest of our discussion to these files.
  3. Start Google Drive. While this time it’ll fail, you’ll get an important value from the log file after this run.
  4. Make final updates to config files.
  5. Run Google Drive successfully.

Updating snapshot.db and sync_config.db

We can start by opening sync_config.db in the SQLite Manager:

If you can’t see any files, select “All files” in the file extension of the file opening dialog.

After opening the table data you shall see the following:

Edit the local_sync_root_path so it now points to a new folder. Just out of a common sense I left the characters \\\\? as in original path.

Now rename the file sync_log.log to some other name, e.g. sync_log.old. We’ll need some data from it later, so a clean log file will be easier for us to search inside.

Next, open the snapshot.db. Open the local_entry table and search for string “Google Drive” as shown below:

Search results must look like this:

Edit the path in a same fashion as before. Start Google Drive and it should probably crash. Don’t worry and simply close it. Now open the log file named sync_log.log. We’ll be looking for the following lines inside of it:

2014-04-21 19:31:16,598 +0200 ERROR pid=4932 1220:LaunchThreads   
logging:1586 Root inode has changed. Old inode = 1407374883737647, 
new inode = 1125899906853835
2014-04-21 19:31:16,598 +0200 ERROR pid=4932 1220:LaunchThreads   
common.sync_app:1195 root folder missing or invalid. 

If you were attentive, the entry you’ve just edited also had the same id as an “Old inode”. Now we need to update the following items in the database:

  • local_entry row with id=1407374883737647 (use the value you’ve just obtained).
  • all rows from local_relation where parent_inode_number=1407374883737647
  • and the final step - row #1 from the mapping table with resource_id folder:root.

After you replace all values of the old inode with a new one, start Google Drive client and it should run without giving you any errors.

Category: 

Comments