Score:0

tar command reports "file changed as we read it" while i think that partition mounted read only

fr flag

I make a backup of my home user snap directory with tar. I have mounted the partition with bind-option according to mount manpage: at first mount --bind / /mnt/bind and then mount -o remount,bind,ro / /mnt/bind. Command mount shows: /dev/sda2 on /mnt/bind type ext4 (ro,relatime,errors=remount-ro). Then I make a backup of snap directory in home-directory of user: tar -cf my_user_snap.tar /mnt/bind/home/my_user/snap (command slightly another). At the same time I have a running chromium-browser on /home/my_user. And although I am guessing that my /mnt/bind mounted read only, I get an error (warning): tar: my_user/snap/chromium/1781/.config/chromium-my_user/Default: file changed as we read it. Why is it so? Why bind mount does not perform read-only directory /mnt/bind? I want a static content which I can backup with tar command, without shutdown the computer.

francois P avatar
it flag
Depending how the partition is setup, it can write metadatas, like access time for example so it is concidered as "changer" by tar warning list, do not worry about that.
Charles Green avatar
cn flag
I'm a bit confused: My understanding is that the `bind` option makes the same directory available in two places, and you are mounting the second place available as `RO`. That's great, but you have not made a static copy of the directory, merely another access point. The original mount location is still in use, and can still be modified, and apparently since you are running chromium while doing your `tar`, you are also writing data to the original directory. `tar` sees this and complains...
klpu39 avatar
fr flag
@Charles Green - can I by running system make `/` resources available (and indeed not changable) in another place for `tar`ing it?
Charles Green avatar
cn flag
By definition, if your computer us running then the root directory `/` is in use. There are several mechanisms that people are using for doing backups - what is your goal? For example, I backup all of my data but I do not backup the programs and configurations - I have little that is so complex that I cannot reconfigure, and I have scripted the entire reinstallation process
klpu39 avatar
fr flag
@Charles Green - I make backups with `tar`. There are static and changable data. I thought, with `bind` option I have all my my data static. Since this obviously does not work, I will make my backups with live-cd.
Charles Green avatar
cn flag
If `tar` is going to be your tool of choice, that may well be the case.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.