Install rclone in WSL2

Loading

Step 1: Install rclone in WSL2

Open your WSL2 Linux terminal and run:

Bash

sudo apt update
sudo apt install rclone

This will install rclone using the package manager.


Step 2: Configure rclone for Google Drive (One-Time Setup)

This step will open a browser window on your Windows host to authenticate with Google.

Bash

rclone config

Follow the prompts:

  1. n for New remote
  2. Name: Give it a name, e.g., gdrive (you'll use this name in your upload command).
  3. Storage: Type drive for Google Drive (it will list many options, find the number for Google Drive or type drive).
  4. Client ID/Secret: Just press Enter for both (leave blank). rclone will use its default public client ID, which is fine.
  5. Scope: Choose 1 for Full access to all files, excluding Application Data folder. This is generally recommended for backup purposes.
  6. Root folder ID: Press Enter (leave blank).
  7. Service Account File: Press Enter (leave blank).
  8. Configure this as a team drive? n (unless you specifically want to use a Google Shared Drive/Team Drive).
  9. Advanced config? n
  10. Use auto config? y (This is the most convenient option for WSL2)
    • Crucial: Your default web browser on your Windows host will automatically open, asking you to log in to your Google account and grant rclone access.
    • Complete the login and grant permissions.
    • Once authenticated, return to your WSL2 terminal.
  11. Confirmation: It will show you a summary of the remote. Type y to confirm.
  12. Another remote? n

You have now successfully configured rclone to connect to your Google Drive!


Step 3: Upload the file DAHPLaptop.zip to Google Drive

Now, assuming DAHPLaptop.zip is in your current working directory in WSL2 (e.g., /var/www/DebianAdmin/), or you provide its full path:

Bash

# To upload to the root of your Google Drive:
rclone copy DAHPLaptop.zip gdrive:

# OR, to upload to a specific folder in your Google Drive (recommended for organization):
# Replace 'YourBackupFolder' with the actual folder name on your Google Drive
rclone copy DAHPLaptop.zip gdrive:YourBackupFolder/

Explanation:

  • rclone copy: The command to copy files.
  • DAHPLaptop.zip: The source file you want to upload.
  • gdrive:: This refers to the Google Drive remote you configured (if you named it gdrive in Step 2).
  • : (colon after gdrive): Indicates the root of that remote.
  • YourBackupFolder/: Specifies a subfolder within your Google Drive. If the folder doesn't exist, rclone will create it.

rclone is very robust with large files, handles retries, and can even resume transfers, which should solve your previous upload failures.

nIce. No verbose output while it is uploading unfortunately. Is there a "-v" option for future use?

You noticed! rclone can be quite quiet by default, especially for successful operations.

Yes, there absolutely is a verbose (-v) option, and several other logging options, that are incredibly useful for seeing what's happening during transfers!

For future use, you can add -v (for verbose) or even -P (for progress) to your commands:

Showing Progress and Verbose Output with rclone:

  1. -v (Verbose): This will show you more detailed information about what rclone is doing, including file transfers, directories created, and minor debugging information.

    Bash

    rclone -v copy DAHPLaptop.zip gdrive:YourBackupFolder/
    
  2. -P (Progress): This is often the most desired option for large files, as it shows a real-time progress bar, transfer speed, and estimated time remaining.

    Bash

    rclone -P copy DAHPLaptop.zip gdrive:YourBackupFolder/
    
  3. -vv (Very Verbose / Debug): If you're troubleshooting and want even more granular detail (including HTTP requests and responses), you can use -vv.

    Bash

    rclone -vv copy DAHPLaptop.zip gdrive:YourBackupFolder/
    

Example of how you might use -P:

Bash

# This will show a live progress bar as DAHPLaptop.zip uploads
rclone -P copy DAHPLaptop.zip gdrive:WordPress_Backups/

You'll see output like:

Transferred:   1.490 GiB / 1.490 GiB, 100%, 8.520 MiB/s, ETA 0s
Transferred:           1 / 1, 100%
Elapsed time:      2m58.2s

Using -P is highly recommended for larger files so you can monitor the upload in real-time.