Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Are immutable files archived by tar?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Are immutable files archived by tar?

Hello, im using vzdump for archiving files, the result is .tgz archive. I wanted to ask if the immutable files (chattr +i filename) are also archived and then restored when im restoring archive?

Comments

  • why on earth can't you check the tgz yourself?

    Thanked by 1dedicados
  • I prefer to ask there because the resulting tgz is too huge.

  • by definition there is no TAR file too huge to list its contents with 'tar -t'.

    Thanked by 1farsighter
  • its not tar file but tgz and it is around 200gb big, want to save disk io

  • It depends. Is your version of tar linked with libattr? Check if tar --xattrs is supported.

    Why not just test it out on a small tar/vzdump?

  • @rincewind said:
    It depends. Is your version of tar linked with libattr? Check if tar --xattrs is supported.

    I see i have tar (GNU tar) 1.23
    and in its man page i see:

    --xattrs
    Save the user/root xattrs to the archive

    --no-xattrs
    Don’t extract the user/root xattrs from the archive

    does it mean that immutable bit files are archived and also extracted by default?

  • create some random file and test it your self

  • raindog308raindog308 Administrator, Veteran

    postcd said: I prefer to ask there because the resulting tgz is too huge.

    tommy said: create some random file and test it your self

    This. How much time does it create to cd to /tmp, create a file, chattr it, tar it, blow it away, untar, and look at the file?

    Thanked by 1netomx
  • postcdpostcd Member
    edited January 2016

    it indeed looks simple i tried to use tar czf and tar xzf
    and the result if i did everything properly is that the immutable file is no longer immutable after extraction

    before:

    lsattr

    -------------e- ./test2

    ----i--------e- ./test

    after:

    lsattr

    -------------e- ./test2

    -------------e- ./test

    it is unpleasant surprise for me as i quite need to keep the immutable settings and not sure if vzdump command can be set to keep it.

    Dont know if file is immutable in the tar archive, tried tar -t a.tar

  • postcdpostcd Member
    edited August 2016

    Anyone know how to keep immutable files immutable after extraction?

    I tried

    tar --xattrs -p -czf archive.tgz foldertoarchive/*

    tar --xattrs -p -xzf archive.tgz -C folderdestination/

    -p to preserve permissions

    but extracted folders/files do not have immutable bit even original had it

  • Awmusic12635Awmusic12635 Member, Host Rep

    I am pretty sure vzdump does keep them

  • raindog308 said: This. How much time does it create to cd to /tmp, create a file, chattr it, tar it, blow it away, untar, and look at the file?

    Except you can't usually chattr +i in /tmp since it's on tmpfs ;-)
    But @postcd just choose any other directory and do the experiment yourself. Faster to try than to ask.

  • @Awmusic12635

    Thx, and if vzdump is not used? just tar..

    @rds100

    yes, i tried, and cant find how to do it

  • jarjar Patron Provider, Top Host, Veteran
    edited August 2016

    @postcd said:
    @Awmusic12635

    Thx, and if vzdump is not used? just tar..

    @rds100

    yes, i tried, and cant find how to do it

    I'm on my phone, but what you're looking for are instructions on how to do four things:

    1. Create file.
    2. Make file immutable.
    3. Tar directory.
    4. Extract tar.

    Should be easy to find instructions if you break up the task into those points and google them. Someone else might be more prepared to list the directions, but that's a starting path at least :)

  • Thx, i know all 4 steps except how to tar directory preserving immutable files and after extraction files having immutable bit

  • jarjar Patron Provider, Top Host, Veteran

    @postcd said:
    Thx, i know all 4 steps except how to tar directory preserving immutable files and after extraction files having immutable bit

    Have you confirmed that you need extra steps for that? I've honestly never tried.

    Thanked by 1netomx
  • @jarland

    not sure what you mean, around 5 posts above i already mentioned tar have not "preserved"/remembered immutable after untarring.

  • jarland said: Have you confirmed that you need extra steps for that? I've honestly never tried.

    Immutability is part of the extended attributes specific to ext2/3/4 filesystem and not BSD/POSIX standard. For instance, you can tar from ext4 and untar into ZFS/XFS/BTRFS and extended attributes wouldn't translate over.

    Thanked by 2Falzo howardsl2
Sign In or Register to comment.