Backup failure

silver.bullet at zoho.com silver.bullet at zoho.com
Sun Sep 27 09:37:23 UTC 2015


On Sun, 27 Sep 2015 11:33:51 +0200, silver.bullet at zoho.com wrote:
>On Sun, 27 Sep 2015 10:22:42 +0100, Colin Law wrote:
>>On 27 September 2015 at 10:16,  <silver.bullet at zoho.com> wrote:
>>> 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.
>>
>>To preserver permissions use tar -p
>
>I checked if the attribute is preserved when using sudo, but it isn't,
>however, as you can see the permissions are preserved without the -p
>option [1].
>
>From the man page:
>
>"-p, --preserve-permissions, --same-permissions
>  extract information about file permissions (default for superuser)"
>
>Anyway, permissions are not the same as attributes ;) and [1] also
>shows that attributes are not preserved.
>
>[1]
>[rocketmouse at archlinux Desktop]$ touch test.txt
>[rocketmouse at archlinux Desktop]$ sudo chattr +i test.txt 
>[sudo] password for rocketmouse: 
>[rocketmouse at archlinux Desktop]$ sudo tar cf test.bak test.txt 
>[rocketmouse at archlinux Desktop]$ ls -hAl
>total 12K
>-rw-r--r-- 1 root        root        10K Sep 27 11:27 test.bak
>-rw-r--r-- 1 rocketmouse rocketmouse   0 Sep 27 11:26 test.txt
>[rocketmouse at archlinux Desktop]$ lsattr *
>---------------- test.bak
>----i----------- test.txt
>[rocketmouse at archlinux Desktop]$ sudo chattr -i test.txt 
>[rocketmouse at archlinux Desktop]$ rm test.txt 
>[rocketmouse at archlinux Desktop]$ ls -hAl
>total 12K
>-rw-r--r-- 1 root root 10K Sep 27 11:27 test.bak
>[rocketmouse at archlinux Desktop]$ sudo tar xf test.bak
>[rocketmouse at archlinux Desktop]$ ls -hAl
>total 12K
>-rw-r--r-- 1 root        root        10K Sep 27 11:27 test.bak
>-rw-r--r-- 1 rocketmouse rocketmouse   0 Sep 27 11:26 test.txt
>[rocketmouse at archlinux Desktop]$ lsattr *
>---------------- test.bak
>---------------- test.txt

I need to mention that assumed tar would preserve attributes, there
would be the need to use sudo, since setting attribute bits requires
sudo too, so my first example was wrong, anyway, as shown by my
second example, attributes are not preserved even when using sudo.





More information about the ubuntu-users mailing list