I made an rsync backup of my Ubuntu 22.04 OS as it was running in a Raspberry Pi. The backup is made to an image file partitioned and formatted the same as the SD Card. Later I mount the backup image file and also take out the SD Card and mount it as well.
Root partition on backup image mounted at /media/writable
Root partition on SD Card mounted at /media/writable1
When I do a directory listing of files I can see that some are in there but NOT in the source SD Card.
[flex@flex-inspiron7520 ~]$ ls -l /media/writable/snap/core20/1437/etc/default
total 28
-rw-r--r-- 1 root root 460 Feb 4 2020 cryptdisks
-rw-r--r-- 1 root root 297 Sep 30 2019 dbus
-rw-r--r-- 1 root root 15 Mar 29 20:47 locale
-rw-r--r-- 1 root root 1756 Apr 14 2020 nss
-rw-r--r-- 1 root root 133 Dec 2 22:38 ssh
-rw-r--r-- 1 root root 35 Mar 29 20:47 swapfile
-rw-r--r-- 1 root root 1118 Feb 7 2020 useradd
[flex@flex-inspiron7520 ~]$ ls -l /media/writable1/snap/core20/1437/etc/default
ls: cannot access '/media/writable1/snap/core20/1437/etc/default': No such file or directory
I do a dry run of the rsync command and it tells me that it will copy files from the source (backup image) that are missing in the destination (sd card).
[flex@flex-inspiron7520 ~]$ sudo rsync -nrlpgoDv /media/writable/snap/core20/1437/etc/default /media/writable1/
sending incremental file list
default/
default/cryptdisks
default/dbus
default/locale
default/nss
default/ssh
default/swapfile
default/useradd
sent 205 bytes received 41 bytes 492.00 bytes/sec
total size is 3,814 speedup is 15.50 (DRY RUN)
By the way the reason the files are missing in the destination SD Card compared with the backup OF THAT card is because the files were there when the sd card was attached to the Pi and the OS was running... they are the snap applications that are mounted in /snap only when the OS is running.
But that's not my question!
My Question
When I run this rsync command it gives me output about what files it plans on copying from the source (backup image) to the destination (sd card)
sudo rsync -nrlpgoDv /media/writable /media/writable1/
There are alot of files to transfer, this is just the first few lines...
writable/var/lib/dpkg/info/python3.10-minimal.list
writable/var/lib/dpkg/info/python3.10-minimal.md5sums
writable/var/lib/dpkg/info/python3.10-minimal.postinst
writable/var/lib/dpkg/info/python3.10-minimal.postrm
writable/var/lib/dpkg/info/python3.10-minimal.preinst
writable/var/lib/dpkg/info/python3.10-minimal.prerm
writable/var/lib/dpkg/info/python3.10.list
writable/var/lib/dpkg/info/python3.10.md5sums
.
..
....
.....
However... there are no writable/snap/... lines in the output? Why does this rsync command not list out the same files as above that ARE in /media/writable/snap/core20/1437/etc/default but NOT in /media/writable1/snap/core20/1437/etc/default.
Apparently the '/snap' directory is a set of mount points for loop devices referencing the snap applications located in '/var/lib/snapd/'. I'm not sure if that is related?
Update
Is it because of how the two file systems are mounted maybe? The backup image is mounted readonly but the SD Card is mounted as readwrite? But my rsync command tries to copy from the backup image so probably not related?
[flex@flex 1437]$ mount | grep writable
/dev/loop0p2 on /media/writable type ext4 (ro,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
/dev/sdb2 on /media/writable1 type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
Any help much appreciated,
Flex
-a. So-navfor a verbose dry run etc