master-hax / pixel-backup-gang

backup tools for OG pixel & pixel XL
44 stars 6 forks source link

The way to directly mount smb share to internal storage #7

Closed FovenX3 closed 2 months ago

FovenX3 commented 2 months ago

Download rclone mount from https://github.com/AvinashReddy3108/rclone-mount-magisk replace rclone to newer version for SMB support Install through magisk

adb shell su -c rclone --config="/mnt/sdcard/rclone.conf" config (create config file. smb, sftp etc. are support) adb shell su -c rclone --config="/mnt/sdcard/rclone.conf" mount remotename:d/ /mnt/runtime/default/emulated/0/mount --allow-other (“remotename“ is the name of the remote created in config, "d/" is my windows smb share drive, in Windows File Explorer looks like \\192.168.x.x\d, mount point folder need to manually create) Tested on pixel and pixel xl, QP1A.191005.007.A3

master-hax commented 2 months ago

I wouldn't consider this a direct mount since all the data goes through rclone & FUSE.

It's not possible to directly mount an SMB or NFS share without a custom kernel.

master-hax commented 2 months ago

someone should add fuse-nfs to termux packages

FovenX3 commented 2 months ago

My goal is to make Google Photos recognize my hole 16TB drive This allows me to upload photos from the entire drive at once, without the 4G size limit of fat32. Cause I have a windows nas turnon 7x24 I did not modified kernel, only requires magisk and that rclone mount mentioned above.

FovenX3 commented 2 months ago

1 (2)

vegedb commented 2 months ago

Download rclone mount from https://github.com/AvinashReddy3108/rclone-mount-magisk replace rclone to newer version for SMB support , or download my file that already replaced. https://drive.google.com/file/d/1wEDOPkDlf7ITx5EL5fheoiO8mlcogSKm/view?usp=sharing Install through magisk

adb shell su -c rclone --config="/mnt/sdcard/rclone.conf" config (create config file. smb, sftp etc. are support) adb shell su -c rclone --config="/mnt/sdcard/rclone.conf" mount remotename:d/ /mnt/runtime/default/emulated/0/mount --allow-other (“remotename“ is the name of the remote created in config, "d/" is my windows smb share drive, in Windows File Explorer looks like \\192.168.x.x\d, mount point folder need to manually create) Tested on pixel and pixel xl, QP1A.191005.007.A3

Interesting, How do you verify if its uploads are successful? For us, we use this "FREE UP" Feature.

image

FovenX3 commented 2 months ago

I write a script to monitor this page com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity, and auto compare with file count in my drive. 1’

vegedb commented 2 months ago

I write a script to monitor this page com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity, and auto compare with file count in my drive.

How does your script work for comparing, filesize/MD5?

FovenX3 commented 2 months ago

I write a script to monitor this page com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity, and auto compare with file count in my drive.

How does your script work for comparing, filesize/MD5?

I just compare the total amount,in the screenshot above is 436117 item, if I put another 100 photo in my drive, when next time my script detect upload finish, script will check this number, example 436217,436217-436117=100

n19htmare commented 2 months ago

Would you consider adding the smb share as part of the mount script? That would be amazing

master-hax commented 2 months ago

i will accept PRs that implements a FUSE based mounting solution but i'll be honest - the main reason i started this project is because FUSE was too slow 😅

master-hax commented 2 months ago

I write a script to monitor this page com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity, and auto compare with file count in my drive. 1’

@FovenX3 feel like sharing? 😁

FovenX3 commented 2 months ago

I write a script to monitor this page com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity, and auto compare with file count in my drive. 1’

@FovenX3 feel like sharing? 😁

My setup is running a python script on my nas, pixel has been modified to batteryless and auto enable wireless adb.

This is how I get the total count number

def gettotalcount():
    execute_command(
        f"./adb -s {DEVICE_IP} shell su -c am start -n com.google.android.apps.photos/com.google.android.apps.photos.picker.external.ExternalPickerActivity"
    )
    time.sleep(5)
    dump_result, error = execute_command(
        f"./adb -s {DEVICE_IP} shell su -c uiautomator dump /storage/mount/window_dump.xml"
    )
    time.sleep(5)
    dump_content, _ = execute_command(
        f"./adb -s {DEVICE_IP} shell cat /storage/mount/window_dump.xml"
    )

    root = ET.fromstring(dump_content)

    target_node = None
    for node in root.iter("node"):
        if "items" in node.attrib.get("text", ""):
            target_node = node
            break

    if target_node is not None:
        text_content = target_node.attrib["text"]
        number_str = (
            re.search(r"\d{1,3}(,\d{3})*", text_content).group().replace(",", "")
        )
        number = int(number_str)
        print(number)
    else:
        print("cant find number")

    execute_command(
        f"./adb -s {DEVICE_IP} shell am start -n com.google.android.apps.photos/com.google.android.apps.photos.home.HomeActivity"
    )
    time.sleep(5)
    execute_command(f"./adb -s {DEVICE_IP} shell input tap 1226 86")

    return number

Monitoring this number was for the early stages to make sure no files were missed. It has now been abandoned. I only monitor the backup status (clicking on upper right corner on the Google Photos homepage), cause monitoring the total amount has many side effects, such as duplicate photo in my nas, or uploading files that Google Photos does not support (videotapes mp2 videos), will lead to inconsistent total files.