[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

ext3 nodump attribute inheritance



Hi,

in the past I was considering the ways to back up files in my Linux
home box. The important part of such thinking is how to set exclusion
paths wisely. I finally found out that setting ext2/ext3 nodump
attribute using chattr for files, but mainly directories, suits me
best. Setting the match (regexp) lists for the backup script
exetrnally seems sub-optimal to me, since my dump/nodump data
arrangement is not stable in time.

I started using Schily's star because of its multiple advantages over
the GNU tar, true incremental dumps and honoring the nodump ext2/ext3
flag among others.

But then I noticed what I call an unfortunate feature of ext2/ext3.
The nodump flag of the directory is inherited by every new
file/directory created inside that directory (the same goes for the
most of the ext2/ext3 flags). This feature would quickly wipe off my
settings made by hand! Consider for example:

~/tmp/ is nodump. When I create a file inside, it gets nodump too.
When later this file develops into something useful and deserves to
stay under ~/myprogs/ for example, I'll move it, but it still carries
the nodump flag and therefore wont be dumped.

I googled for a while for other users experience with this feature,
but it seems to me the nodump flag is not used much or the people feel
ok or are unaware.

For myself and for now, I solved this problem with the following
oneline patch against kernel 2.6.8, ialloc.c/ext3_new_inode():

--- kernel-source-2.6.8-orig/fs/ext3/ialloc.c   2004-08-14
07:36:58.000000000 +0200
+++ kernel-source-2.6.8/fs/ext3/ialloc.c        2005-07-19
11:20:36.000000000 +0200
@@ -566,9 +566,9 @@
        ei->i_next_alloc_goal = 0;
        ei->i_dir_start_lookup = 0;
        ei->i_disksize = 0;
 
-       ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
+       ei->i_flags = EXT3_I(dir)->i_flags & ~(EXT3_INDEX_FL |
EXT3_NODUMP_FL);
        if (S_ISLNK(mode))
                ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
        /* dirsync only applies to directories */
        if (!S_ISDIR(mode))

Now my new files and dirs do not inherit nodump flag from their parent
dir anymore. Of course, however tiny this change is, I rate is so
useful for others, that I'm going out with it.

Changing the filesystem behaviour for everyone is of course
problematic. I do not know whether there are (or will be in the
future) another flags deserving selective non-inheritance. So this is
my generalized idea: To leave the present behaviour as default and let
user configure the mask of flags that should not be inherited from
parent dirs via for example tune2fs in the way of chattr. Maybe like
this syntax:

    tune2fs -I+-=[ASacDdIijsTtu]

where -I is the new option meaning Inheritance.

What you all think? Would you be satisfield with the nodump flag
inheritance in case you would use the flag for your backups. Am I alone?

Thanks in advance,

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]