[Linux]Managing file attributes on ext2

Last update on November 11, 2009 06:29 AM by jak58
Published by netty5

[Linux]Managing file attributes on ext2





lsattr - chattr

Introduction


The Second Extended Filesystem (ext2) and the Third Extended Filesystem (ext3) contains file attributes that are less known, but still very practical.

To view or set these attributes, we have these two commands (in e2fsprogs),lsattr and chattr.

Isattr


To list the attributes.

How to use:

lsattr [files ...] [Dir...]

Displays the files given attributes, files, folders given files from the current folder.

lsattr-d [dir ...]
Displays attributes records given or current folder rather than their content.

lsattr-a
List attributes of all files.

lsattr-R dir
Recursively list the attributes of files.

chattr


Allows you to fix attributes.

How to use:
chattr +attr file
chattr -attr file
chattr =attr file
On the same operating principle as chmod
+attr adds the attribute
-attr remove attribute
=attr leaves only the attributes given

The -R option allows you to change the attributes recursively.

Attributes List



-A


The date of last access is not updated (only useful for reducing disk access on laptops)

-S


The file is synchronous, the records in the file are made immediately on the disc. (equivalent to the sync option of mount appliquée a subset of files)

-a


The file can be opened in addition to writing (log files, etc.)
Only redirection>> can be used, the file can not be deleted.
Only the root user or a program with the necessary rights can change this attribute.

-c


The file is automatically compressed before writing to disk, and unpacked before playback.

-D


The case is synchronous (see:-S) (equivalent to option dirsync mount on a subset of records)
Usable from the kernel 2.5.19

-d


The file will not be saved by the dump

-I


Can not be fixed by chattr only listed by lsattr
Indicates that the file is indexed.

-i


The file / directory can not be amended, deleted, renamed or linked symbolically, not even by root.
Only root or a binary with the necessary rights can set this attribute.

-j


EXT3 only.
If the file system is mounted with "data = ordered" or "data = writeback", all data files are written to the log before being written to the file itself.
If the file system is mounted with "data = journal", all data files are all already in the newspaper, the attribute has no effect.
Only root or a binary with the necessary rights can set this attribute.

-s


When the file is destroyed, all data blocks are being released to zero.

-T


Usable from version 2.5.46 kernel.

-t


Concern fragmentation.
This is currently not implemented on the ext2 and ext3 to my knowledge.

-u


If the file is deleted, its content is saved, it allows the user to seek its restoration.

-E


Experimental, can detect an error of compression can not be fixed by chattr, but can be listed by lsattr

-X


Experimental shows that the raw data to a compressed file can be accessed directly.
Can not yet be set by chattr

-Z


Experimental, provides information on the status of a compressed file.
can only be listed by lsattr

A c s u attributes can only be used from a 2.3 kernel, but are not implemented in 2.4 kernels, it seems to be the case in the 2.6 kernels.

In any case, better check out the functions of an Attribute before using it.
Best answers for « Managing file attributes on ext2 » in :
Download SearchMyFiles Show SearchMyFiles is an alternative to Windows module “Search files and folders”. By using search criteria such as wildcard, date of creation, latest date of modification, file size, file name, file attributes, content, it allows you to look for files...
Download Explore2fs Show Explore2fs is a tool of exploration and d ' access to files systems ext2 and ext3. He works on all versions Windows and can read the most part of the files systems ext2 and ext3. Explore2fs allows: reading of files ext2 and ext3, function...
Access disk partition EXT2 / 3 ShowAccess disk partition EXT2 / 3 Problem Solution The fstab file The graphical method Conclusion Problem Under gnome, when it mounts a partition formatted as ext2 or ext3, you can not write without being in a session Root (Super...
How to Password Protect your Files and Folders ShowHow to Password Protect your Files and Folders How to password protect a Word document Password protection on Windows 3.x, Windows 95 and Windows 98 Password protection on Windows XP Password protection on Windows XP Home Edition Password...
Burning an ISO file using Nero 8 ShowBurning an ISO file using Nero 8 To burn an ISO file on nero is very simple, Just follow these instructions: File > Open A window will appear and browse the image file you want to burn then press Open Then a window saying ‘ Burn the...
Download Ext2 Installable File System ShowIf you currently have Windows running and you realize that you need some files for your work which you have stored on an Ext2 volume of your Linux installation, you no longer have to shut down Windows and boot Linux! Furthermore, Windows will now...
Download Ext2 Installable File System ShowYou can install two different operating systems on your computer, for example Windows and Linux. But the problem is that you cannot have access to Linux document via Windows. Ext2 Installable File System for Windows provides Windows NT4.0 / 2000 / XP...
The file system ShowWhat is a file system? Even though hard drives can be very small, they still contain millions of bits and therefore need to be organised so that information can be located. This is the purpose of the file system. Remember that a hard drive is made...
File sharing in Windows XP ShowAdvantages File sharing involves making the content of one or more directories available through the network. All Windows systems have standard devices making it easy to share the content of a directory. However, file sharing may lead to security...
Operating Systems - MS-DOS - Tips ShowSetting the CD-ROM drive The CD-ROM drive is configured in the config.sys and autoexec.bat system files. The CD-ROM drive device driver must be configured in the config.sys file (even if the device is automatically detected in Windows). To do...