Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can get backup with keep all flag files; for example Immutable, Append_Only,... #85

Open
NabiKAZ opened this issue May 7, 2020 · 2 comments

Comments

@NabiKAZ
Copy link

NabiKAZ commented May 7, 2020

How can get backup with keep all flag files; for example Immutable, Append_Only,...

I tested, but fsarchiver doesn't backup from flags files.

See my testing:

I create an immutable file: (chattr +ia /a/immutable_file) and can see ia flag.

root@sysresccd /root % 
root@sysresccd /root % ls -lah /a
total 32K
drwxr-xr-x  4 root root 4.0K May  7 03:08 .
drwxrwxrwt 32 root root  280 May  7 02:44 ..
drwxr-xr-x  2 root root 4.0K May  6 03:48 aaa
-rw-r--r--  1 root root    6 May  7 03:02 immutable_file
drwx------  2 root root  16K May  6 03:45 lost+found
-r-----r--  1  999 root   15 May  7 02:29 ubuntu
root@sysresccd /root % chattr +ia /a/immutable_file 
root@sysresccd /root % lsattr /a
--------------e---- /a/lost+found
----ia--------e---- /a/immutable_file
--------------e---- /a/ubuntu
--------------e---- /a/aaa
root@sysresccd /root % 

Now I backup partition:

root@sysresccd /root % umount /a
root@sysresccd /root % 
root@sysresccd /root % fsarchiver savefs -v -j8 -z0 -o backup.fsa /dev/sdb1
Legacy compression methods (-z) are deprecated.
It is recommended to switch to zstd using the -Z option.
Please read "http://www.fsarchiver.org/Compression" for more details.
Analysing filesystem on /dev/sdb1...
============= archiving filesystem /dev/sdb1 =============
-[00][ 19%][DIR     ] /
-[00][ 39%][DIR     ] /lost+found
-[00][ 59%][REGFILEM] /immutable_file
-[00][ 80%][REGFILEM] /ubuntu
-[00][100%][DIR     ] /aaa
Statistics for filesystem 0
* files successfully processed:....regfiles=2, directories=3, symlinks=0, hardlinks=0, specials=0
* files with errors:...............regfiles=0, directories=0, symlinks=0, hardlinks=0, specials=0
root@sysresccd /root % 
root@sysresccd /root % 

Now restore it:

root@sysresccd /root % fsarchiver restfs -v -j8 backup.fsa id=0,dest=/dev/sdb1,mkfsopt="-i 1024"
============= extracting filesystem 0 =============
executing [mke2fs -V]...
command [mke2fs -V] returned 0
executing [mke2fs -V]...
command [mke2fs -V] returned 0
executing [mke2fs /dev/sdb1  -q  -F  -r 1  -i 1024  -b 4096  -L 'aaaaa'  -I 256  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,64bit,^inline_data,large_file,huge_file,sparse_super,^uninit_bg,dir_nlink,extra_isize,^bigalloc,metadata_csum,^project ]...
command [mke2fs /dev/sdb1  -q  -F  -r 1  -i 1024  -b 4096  -L 'aaaaa'  -I 256  -O has_journal,ext_attr,resize_inode,dir_index,^sparse_super2,filetype,extent,^journal_dev,flex_bg,^meta_bg,^mmp,64bit,^inline_data,large_file,huge_file,sparse_super,^uninit_bg,dir_nlink,extra_isize,^bigalloc,metadata_csum,^project ] returned 0
executing [tune2fs /dev/sdb1  -U 47849ac4-0cba-4fde-b7f0-0c22b159ad13  -o user_xattr,acl  -c 0  -i 0d ]...
command [tune2fs /dev/sdb1  -U 47849ac4-0cba-4fde-b7f0-0c22b159ad13  -o user_xattr,acl  -c 0  -i 0d ] returned 0
Mount information: []
-[00][ 19%][DIR     ] /
-[00][ 39%][DIR     ] /lost+found
-[00][ 59%][DIR     ] /aaa
-[00][ 79%][REGFILEM] /immutable_file
-[00][100%][REGFILEM] /ubuntu
Statistics for filesystem 0
* files successfully processed:....regfiles=2, directories=3, symlinks=0, hardlinks=0, specials=0
* files with errors:...............regfiles=0, directories=0, symlinks=0, hardlinks=0, specials=0
root@sysresccd /root % 
root@sysresccd /root % 

Now you can see remove flags(-ia-) file after lsattr command:

root@sysresccd /root % mount /dev/sdb1 /a                                                       
root@sysresccd /root % 
root@sysresccd /root % ls -lah /a
total 32K
drwxr-xr-x  4 root root 4.0K May  7 03:11 .
drwxrwxrwt 32 root root  280 May  7 02:44 ..
drwxr-xr-x  2 root root 4.0K May  6 03:48 aaa
-rw-r--r--  1 root root    6 May  7 03:02 immutable_file
drwx------  2 root root  16K May  6 03:45 lost+found
-r-----r--  1  999 root   15 May  7 02:29 ubuntu
root@sysresccd /root % lsattr /a
--------------e---- /a/aaa
--------------e---- /a/immutable_file
--------------e---- /a/lost+found
--------------e---- /a/ubuntu
root@sysresccd /root % 
@marcosfrm
Copy link
Contributor

Yes, file attributes are not preserved.

@fdupoux What do you think about adding a TODO file with reasonable RFEs?

Feature API New
archive format?
Bug
File attributes
(chattr(1))
ioctl(fd, FS_IOC_GETFLAGS, &attr)
ioctl(fd, FS_IOC_SETFLAGS, &attr)
yes #85
Sparse files lseek(fd, offset, SEEK_DATA)
lseek(fd, offset, SEEK_HOLE)
yes #70

@fdupoux
Copy link
Owner

fdupoux commented May 8, 2020

We already have GitHub isses to track both bugs and enhancements. I see no real value in having these tracked in files.

The other issue about sparse files will require some work and it may not be easy to fix.

This enhancement should be easy to implement. The archive format would not be imcompatible, it would just introduce new attributes in the dictionaries that old versions would ignore. So basically it takes one piece of code to capture the attributes at save time and once piece of code to restore these are restore time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants