DON'T OVERLOOK EXT2'S EXTENDED ATTRIBUTES

Although the hype these days is primarily about journaling file systems, there's something to be said about the old ext2 file systems. For instance, while ext2 isn't as helpful as a journaling file system in terms of recovery time, it contains extended attributes that are useful for the security conscious or those concerned with file system safety.

There are a few extended attributes, such as "A", that tell the system not to update the file-access time. This is a useful feature for laptops. Another is the "S" attribute, which tells the system to always synchronize the file with the physical storage system. The benefit is a higher level of system integrity, but at the expense of system performance.

The "a" attribute makes a file append-only; in a directory, this means you can create or modify files, but you cannot remove them. Finally, the "i" attribute tells the system that the file cannot be modified; in a directory, files can be modified but not created or deleted.

These extended attributes are only a small set of attributes; however, they are very handy. To make use of them, you should use the chattr and lsattr utilities. The chattr utility sets or removes these extended attributes, while the lsattr utility (like the ls command) lists the attributes assigned to a particular file.

To make a file immutable (or unchangeable), even by the root user, set the "i" attribute in the following way:

chattr +i some_special_file

Performing a regular ls on this file won't reveal that it's immutable--only lsattr can tell you that. To remove any extended attributes, simply prefix the attribute with the minus symbol, like this:

chattr -S some_file