UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Backup and restore (TWRP-style)

    Scheduled Pinned Locked Moved Unsolved Support
    27 Posts 5 Posters 1.1k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • C Offline
        Charly @Vlad Nirky
        last edited by Charly

        @Vlad-Nirky

        The first one is for fat32 fs because it has no rights.

        If you want copy the rights you need a linux file system like ext4 as target.

        If you copy to an ext4 usb stick and use rsync with sudo, all different rights should be applied correctly.

        Thanks for the info of the return of rsync.

        Will it be possible to have ext4 on the internal micro SD card in the future?

        Greetings
        Charly

        Greetings
        Charly

        UT 24.04 on Volla X23

        G 2 Replies Last reply Reply Quote 1
        • G Offline
          GooglyBear @Charly
          last edited by

          @Charly Hmm that sounds like a good question for Ubports Core, SD cards still remain immensely helpful for storage - let us know if you happen to find out more about it!

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            Charly @GooglyBear
            last edited by

            @GooglyBear

            Hello,
            I'm not really well informed. When I put the micro SD card into my cell phone, only fat32 was possible as a file system. Unfortunately, that's not so good because of the lack of a rights system and the limitation to file sizes of a maximum of 4GB.

            I hope ext4 will be possible at some point.

            Best regards
            Charly

            Greetings
            Charly

            UT 24.04 on Volla X23

            G 1 Reply Last reply Reply Quote 1
            • G Offline
              GooglyBear @Charly
              last edited by GooglyBear

              @Charly I see, could this be a device-specific issue? It seems to have been done before here for example: https://xdaforums.com/t/tutorial-howto-convert-your-external-sd-card-from-fat-exfat-to-ext4-3-ways.2480963/

              Or did you mean Ubuntu Touch specifically is unable to deal with ext4-formatted SDs?

              Vlad NirkyV 1 Reply Last reply Reply Quote 0
              • Vlad NirkyV Offline
                Vlad Nirky @GooglyBear
                last edited by Vlad Nirky

                @GooglyBear
                Hello.
                On my Xiaomi Redmi Note 9 Pro (24.04-2.x), I inserted a 64GB SD card formatted in ext4 by my Fedora 43 desktop.
                The card is visible in FileManager+, I was able to add a file to it, and I imagine it would be usable for your rsync...
                I run this one as root and it's look good
                rsync -avh --size-only --checksum --ignore-times /home/phablet/ /media/phablet/f6466442-e8e6-46bb-b918-89996720569e/phablet-backup/

                C G 2 Replies Last reply Reply Quote 1
                • C Offline
                  Charly @Vlad Nirky
                  last edited by

                  Hello forum,

                  I have had the micro SD card in my x23 cell phone for 3 years. I think back then only fat32 was possible. I don't know if anything has changed.

                  I will try out whether an ext4 formatted memory card is possible.

                  Best regards
                  Charly

                  Greetings
                  Charly

                  UT 24.04 on Volla X23

                  Vlad NirkyV 1 Reply Last reply Reply Quote 0
                  • Vlad NirkyV Offline
                    Vlad Nirky @Charly
                    last edited by

                    @Charly
                    Hello.
                    If I understood correctly, UT formats the SD card in FAT, but on my phone, it was able to use ext4 without any issues. Let me know if it works for you too.

                    G 1 Reply Last reply Reply Quote 1
                    • G Offline
                      gpatel-fr @Vlad Nirky
                      last edited by

                      @Vlad-Nirky said in Backup and restore (TWRP-style):

                      UT formats the SD card in FAT

                      I'd think that using a command line tool it could be possible to use other formats.

                      Vlad NirkyV 1 Reply Last reply Reply Quote 1
                      • Vlad NirkyV Offline
                        Vlad Nirky @gpatel-fr
                        last edited by

                        @gpatel-fr
                        Yes, I was thinking to the SD app present in Lomiri panel.

                        G 1 Reply Last reply Reply Quote 0
                        • G Offline
                          gpatel-fr @Vlad Nirky
                          last edited by

                          @Vlad-Nirky

                          looking at the 'ciborium' code, it is hardcoding only exfat at one point, when checking on dynamic insertion of a sdcard. I will not be able to do any tests on that since my phone can't accept a new sdcard without removing the battery.

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            GooglyBear @Moem
                            last edited by GooglyBear

                            @Moem Thanks for your input, backing up your home directory is definitely a great idea and is what people normally opt for.

                            Below I'll try and summarise what I've learnt for solving my problem, which might help people facing a similar problem.

                            Please remember I have not tried restoring yet to see if every single thing on the list was backed up, the one thing that's certain is if you have files in the home directory and you back up that, those are safe (you can always check they successfully made it to your computer by browsing inside the folder).

                            Backing up your home directory
                            1. Connect phone to computer.
                            2. Make sure the adb command is working (run adb devices to see if there's any output etc.).
                            3. Run adb pull /home.

                            You should receive some output about whether all your files made it to your computer, and obviously you can check for yourself by browsing them on your PC.

                            Why should I backup userdata instead of just home?

                            If you want to take it a step further, I'd recomment backing up the entire userdata folder, which also contains the home folder mentioned previously: as far as I've been able to gather just by asking other users on UBPorts' Telegram servers, this includes the items on the list below.

                            Things inside userdata which are useful to back up
                            • the settings you changed in the settings app
                            • your fingerprints for unlocking your phone
                            • the apps currently installed on your device
                            • the apps' data: for example, all the apps and everything else needed to run your Waydroid container exactly in the state it is in now
                            • packages installed via nix and snap
                            Backing up userdata

                            Do the same but run adb pull /userdata.
                            Basically if you ever lose your userdata you just need to replace your current /userdata folder on your phone with the previous backup of /userdata on your computer.

                            While I would probably simply run something like adb shell 'rm -rf /userdata && mkdir -p /userdata' && adb push /path/to/userdata /userdata for restore, do not run it unless you know what you're doing, I have not verified this to be working and need to check with people more knowledgeable than me on UT to confirm/fix.

                            This is the best I have for now, I'll update / add to this if I come across anything better 🙂

                            Vlad NirkyV 1 Reply Last reply Reply Quote 0
                            • Vlad NirkyV Offline
                              Vlad Nirky @GooglyBear
                              last edited by

                              @GooglyBear
                              With this procedure, are Waydroid's specific directory rights preserved?

                              G 1 Reply Last reply Reply Quote 1
                              • G Offline
                                GooglyBear @Vlad Nirky
                                last edited by

                                @Vlad-Nirky The truth is I have no idea, only way is to test it I guess. I also assume I'll have to run adb root first to download all files.

                                The adb user documentation (https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/user/adb.1.md) doesn't seem to be of much use in answering this question.

                                Vlad NirkyV 1 Reply Last reply Reply Quote 0
                                • G Offline
                                  GooglyBear @Charly
                                  last edited by

                                  @Charly said in Backup and restore (TWRP-style):

                                  If you copy to an ext4 usb stick and use rsync with sudo, all different rights should be applied correctly.

                                  This might help I suppose, and there's probably a way to configure rsync to work via cable. We'll see...

                                  1 Reply Last reply Reply Quote 0
                                  • Vlad NirkyV Offline
                                    Vlad Nirky @GooglyBear
                                    last edited by Vlad Nirky

                                    @GooglyBear
                                    I'll try...
                                    Hum. No, the pull don't have access to waydroid data folder.

                                    adb pull /home/phablet/.local/share/waydroid
                                    /home/phablet/.local/share/waydroid/: 0 files pulled, 0 skipped.

                                    G 1 Reply Last reply Reply Quote 0
                                    • G Offline
                                      GooglyBear @Vlad Nirky
                                      last edited by

                                      @Vlad-Nirky Did you run adb root beforehand?

                                      Vlad NirkyV 1 Reply Last reply Reply Quote 0
                                      • Vlad NirkyV Offline
                                        Vlad Nirky @GooglyBear
                                        last edited by Vlad Nirky

                                        @GooglyBear
                                        No, only the commands mentioned above.
                                        Let's try again.
                                        It seems that adb root is disabled by default.
                                        You need to add a module to be able to use it.
                                        Is that correct?

                                        G 1 Reply Last reply Reply Quote 1
                                        • G Offline
                                          GooglyBear @Vlad Nirky
                                          last edited by GooglyBear

                                          @Vlad-Nirky Hmm, not sure. Running adb root for me gives error message adb: unable to connect for root: closed, but I can use sudo inside adb shell: using that would probably let me get a step closer, by allowing me to copy data to an SD card for instance. The problem is my computer isn't an adb client so I can't just use my phone as a host and run adb root on it.

                                          Going back to the module installation, I should definitely look into that (or whatever procedure I need to enable adb root), as it sounds better than the whole hassle of the SD card (which funnily enough is one of TWRP's limitations).

                                          [UPDATE]

                                          I've been told by an admin of UT's Telegram group that adb root simply hasn't been added to UT. This shouldn't be a problem, as utilities like rsync and scp, which are meant to work over a network, can be set up to work over for example USB (or maybe even Ethernet, don't know which would be faster or in what scenario).

                                          I may test backing up and restoring a Waydroid container with SD card, SSD and PC (using sudo on UT so that I have the priviledges to save all kinds of rights).

                                          I've been told by the same admin this works: therefore, all that's left is finding the right command for the job, so that it restores a Waydroid container to a working state (although this procdeure should be applicable to any app or user data or configuration).

                                          1 Reply Last reply Reply Quote 0
                                          • G Offline
                                            GooglyBear @Vlad Nirky
                                            last edited by GooglyBear

                                            @Vlad-Nirky What phone and version did you try it on? On Fairphone 5 24.04-1.1 I can't get the SD to appear.

                                            Interestingly enough, when I have an SD card insertd on my phone and I run dmesg | grep ciborium I repeatedly get udisks2.go:322: Issues while processing /org/freedesktop/UDisks2/block_devices/loop6: interface org.freedesktop.UDisks2.Block not found, while when I don't have it inserted the output is empty.

                                            I can read/write to a USB I had though: I hopped onto my Pi 5 running Ubuntu 24.04 and ran these commands:

                                            sudo umount /dev/sda
                                            sudo mkfs.ext4 /dev/sda
                                            

                                            This formatted the drive to ext4, and with an adapter the drive was recognised.

                                            This is what it looks like on the GUI (the very bottom icon is the USB drive, which wouldn't show up if it weren't correctly connected (ie. in such a way to make read/write operations possible):

                                            photo_2025-12-17 10.29.42.jpeg

                                            After performing the same formatting process on an SD card and using an external adapter, it also allowed read/write operations.

                                            I also formatted another SD to FAT format, so UT can handle a variety of formats (probably ExFAT as well for example): it wasn't reading it before, but my other devices weren't either, so it ended up being a problem with the SD (fixable with reformatting in this case) rather than the phone.

                                            It also works with my Samsung T7 SSD, without any need for sudo there for whatever reason.

                                            Vlad NirkyV 1 Reply Last reply Reply Quote 0
                                            • Vlad NirkyV Offline
                                              Vlad Nirky @GooglyBear
                                              last edited by Vlad Nirky

                                              @GooglyBear
                                              I have two Xiaomi Redmi Note 9 Pro phones and I transfer files from one to the other.
                                              For the SD card, I used the external storage app in the panel.
                                              ext4 is usable but cannot be formatted via this app.
                                              Without sudo,,you won't access to the waydroid folder (if you use it).

                                              1 Reply Last reply Reply Quote 1
                                              • First post
                                                Last post