0

On a NTFS file system, you can set the Archive bit for a file.

I can set the Archive bit for a file on a NTFS partition if I am using Windows, but say that I have a NTFS partition mounted on Linux, can I set the Archive bit for a file on Linux also?

Kusalananda
  • 333,661
  • To avoid being too broad, I’d suggest making this question specific to ntfs, so that answers could specify what features are currently enabled. – Jeff Schaller Apr 11 '18 at 19:35

1 Answers1

2

The most popular tool, named ntfs-3g supports this capability. It's named NTFS attributes.

You should ensure setfattr (man 1 setfattr) is installed. NTFS attributes constitute two groups of attributes: system.ntfs_attrib (small-endian) and system.ntfs_attrib_be(big-endian). It's just for convenient usage.

Each attribute is presented by it's own HEX value (i.e. 0x20 for FILE_ATTRIBUTE_ARCHIVE). More info and values you can see at the official resource. NTFS attributes group consist of 4 bytes within that you can combine several attributes (Archive + System ...).

Display current NTFS attributes of test.file:

# Big-Endian
getfattr -h -e hex -n system.ntfs_attrib_be source-file

Set FILE_ATTRIBUTE_ARCHIVE for test.file:

# Big-Endian.
setfattr -h -v 0x00000020 -n system.ntfs_attrib_be target-file

# Little-Endian (in this manner in x86 family CPU bytes are stored.
# IMHO it's not very convenient for usage.
setfattr -h -v 0x20000000 -n system.ntfs_attrib target-file