Backup failure

silver.bullet at silver.bullet at
Sun Sep 27 09:16:10 UTC 2015

On Sun, 27 Sep 2015 08:34:48 +0200, Petter Adsen wrote:
>I would probably format the USB stick with a file system that supports
>all the regular Linux attributes, such as ext4

Usually I backup to tar archives using compression, but indeed tar
seems not to preserve attributes.

  $ touch test.txt

  $ lsattr test.txt 
  ---------------- test.txt

  $ sudo chattr +i test.txt 

  $ lsattr test.txt 
  ----i----------- test.txt

  $ tar cf test.bak test.txt

  $ sudo chattr +i test.bak 

  $ sudo chattr -i test.txt

  $ rm test.*
  rm: remove write-protected regular file ‘test.bak’? y
  rm: cannot remove ‘test.bak’: Operation not permitted

  $ ls -l
  total 12
  -rw-r--r-- 1 rocketmouse rocketmouse 10240 Sep 27 10:53 test.bak

  $ tar xf test.bak

  $ ls -l
  total 12
  -rw-r--r-- 1 rocketmouse rocketmouse 10240 Sep 27 10:53 test.bak
  -rw-r--r-- 1 rocketmouse rocketmouse     0 Sep 27 10:51 test.txt

  $ lsattr *
  ----i----------- test.bak
  ---------------- test.txt

I anyway prefer tar archives, since backups of complete install become
much smaller. The tar.gz backups of my around 40 GiB Arch install become
an archive with a size from around 20 GiB. Something as the immutable
bit is seldom used. An archive preserves permissions, so it doesn't
matter if the archive is written to e.g. FAT... or e.g. EXT4, assumed
attributes shouldn't be important.

After restoring complete installs from a backup, I never noticed
missing functionality of attributes.

What packages install files that need attributes, that aren't preserved
by a tar archive? After restoring data files that should have an
attribute set, I would manually set the attribute. It would be possible
to backup a list of all attributes to a tar archive and to restore them
by a script, after restoring the files.


More information about the ubuntu-users mailing list