Backing Up Your PinePhone, Plus Some File Management.
The PinePhone doesn't show up in your file manager to back up your data or to move folders and files to your phone, however you can mount the file system by turning off the PinePhone and then turning it back on while holding the volume up button, you'll then see.
- Removable Media (How this displays depends on a multitude of variables)
Backing up with Linux Bash
The mount point may be different depending on your system, or if you manually mount it elsewhere, so please note that my commands are based on where Manjaro automatically mounts the device.
Here's where all your files and folders are, for me these folders said they belonged to a number, so I just ran chown, this is a bad idea, but it works, if you chown your . files you'll need to chown them back to the old owner, I am not so sure if thats the case with basic files and folders.
sudo chown -R $USER:$USER *
ScreenShots and Photos Using Exiftool and Rsync
To move my ScreenShots I cd into the ScreenShot directory
exiftool -r -d /home/$USER/Images/ScreenShot/%Y/%m/ "-filename<filemodifydate" *
This uses exiftool to recursively (-r) look through your directory's which you shouldn't need unless you've already moved your screenshots around adding them to different folders, /home/$USER/Images/ScreenShot/ tells exiftool to move the screenshots to that directory, by default images and ScreenShots aren't default folders, many users put ScreenShots in the Pictures directory, so you may want to change that.
%Y/%m/ tells exiftool to make the directorys based on the Year and Month, you can also add day, but for me there would only be a screnshot or at max maybe 5 a day and would make it hard to look for those images, so Months are just fine.
"-filename<filemodifydate" this tells exiftool to base the %Y and %m on the date it was last modified, if you chose to do it by Created or Accessed it would give you the date and time that you mounted the directory.
For Photos I use a similar set of commands, however I want to move my photos to the SD card to free up storage as well as have a copy on my desktop, my SD card mounts as 79C1-218E please alter that to your SD card mount.
cd /run/media/$USER/userdata/user-data/phablet/Pictures/com.ubuntu.camera/ exiftool -r -d /run/media/$USER/79C1-218E/Pictures/%Y/%m/ "-filename<filemodifydate" * rsync -av /run/media/$USER/79C1-218E/Pictures/ $HOME/Pictures/
Backup Your Dots.
your dot files also belong to phablet, and so you'll have to either use chmod or chown to be able to back them up.
please make sure you make note of the number that you're given for the user before you change it.
sudo chown -R $USER:$USER .*
This is uncomfortable but I'm not advanced enough to chmod without breakages or without worrying about making my device less secure, so please make sure you take note of the number it belongs to, as if you want your device to work afterwards you'll have to chown it back to that owner.
Backup ALL The Files (on user-data), With Tar.
If you only want to do a quick and easy archive backup, this isn't the most recommended organization wise and can waist storage, and just isn't the best for a system thats always changing, but it works using tar (you can also use rsync if you want them to be viewable and editable to you on your desktop)
I'm just gonna place it on my desktop for now.
tar -czvf $HOME/Desktop/PinePhoneBak.tar.gz /run/media/$USER/userdata/user-data/phablet/.* /run/media/$USER/userdata/user-data/phablet/*
Restoring With Tar
(please note, I have not restored a device using this command so something may go wrong, you may have to restore using a mounted archive OR use some other work around to make the restoration work if the command doesn't work as expected.)
tar -xzvf $HOME/Desktop/PinePhoneBak.tar.gz -C /run/media/$USER/userdata/user-data/phablet/*
Backup ALL The Files (on user-data) With Restic
Backup using restic, this is a fantastic way of backing up data, it allows for encrypted backups, that's easy to automate, and means you don't have to worry about data being lost, the problem with tar is that you either overwrite old back ups or add extra weight you don't need, rsync doesn't have that problem, but it just copy's the folders, rsync also doesn't let you revert to older versions of the backup, unlike restic.
restic is also a fast backup since it only backs up the new and updated files.
Create a folder for your restic backup, you'll want a folder because restic by default creates 5 directory's and a config
restic init --repo /home/$USER/Desktop/PineBackUp/
it'll ask you for a password, you'll need to enter one!
Then you'll want to make the backup
restic -r /home/$USER/Desktop/PineBackUp/ --verbose backup /run/media/$USER/userdata/user-data/phablet/
Restoring/Viewing Using Restic.
(please note, I have not restored a device using this command so something may go wrong, you may have to restore using a mounted restic snapshot OR use some other work around to make the restoration work if the command doesn't work as expected.)
To restore from the latest snapshot you would use.
restic -r /home/$USER/Desktop/PineBackUp/ restore latest --target /run/media/$USER/userdata/user-data/phablet/
to see whats in your snapshot without restoring you can mount your restic backup using a few commands. you'll have to make a directory for the snapshot and then mount it, however you cannot edit anything.
mkdir $USER/restic restic -r /home/$USER/Desktop/PineBackUp/ mount $USER/restic
Chmod your Dots (!IMPORTANT!)
This is very important, if you boot your phone now, you wont have any apps, your system will be broken in a few ways, this is because the wrong person owns the files, fix that using. (please note your number may be different)
cd /run/media/$USER/userdata/user-data/phablet/ sudo chown -R $32011:$32011 .*
I am planning to update this with some powershell commands, so that our windows users can also back up there files, if they wish, however I don't have a windows computer, so I'll be using powershell for linux some of the commands might not translate to windows properly so if a windows user would like to help with that, that would be a pleasure, if anyone would like to.
I would also like to make a backup tutorial for anything that is important in the configs, such as text message history, installed apps, and just basic lomiri config files, I'm aware of where text message history is, but other configs I'll need to find.
Thank you for your time, I hope this has been helpful!