What does the command “chattr +c /some/dir/” do

ext4xattr

I'm trying to keep a bunch of plain text files compressed using the extended attribute option – c on a debian ppc64 system. I ran the following commands:

# mkfs.ext4 /dev/test/compressed
# mount /dev/test/compressed /mnt/compressed/
# mkdir /mnt/compressed/some/txts/
# chattr +c /mnt/compressed/some/txts/
# df -l

# cp /some/txts/* /mnt/compressed/some/txts/
# sync
# df -l

To my surprise, the output of df -l tells me the files I copied weren't compressed at all. I also tried to mount the test file system with the option user_xattr and I tried creating it with mkfs.ext4dev, but neither worked. I also checked the output of the commands lsattr /mnt/compressed/some/txts/; every line has a c in it.

Did I miss something? How come the xattr option c doesn't work as expected?

Best Answer

Makes sense to have a look at the man page of the programs you use:

BUGS AND LIMITATIONS
The c', 's', andu' attributes are not honored by the ext2 and ext3 filesystems as implemented in the current mainline Linux kernels.

This is not supposed to mean "ext4 works" I guess.

Related Question