2

Today I was devastated to see that a software project that I had backed up in my external HDD was almost completely ruined because the execution (and other permissions) where "reset" because the external HDD uses NTFS filesystem.

Is there a way to backup data to an NTFS or FAT32 filesystem while preserving permissions set in linux?

Kristof Tak
  • 171
  • 2
  • 6
  • 2
    Linux has had stable NTFS drivers for years, and FAT32 is more or less fully compliant, which file system are you going to use specifically? expecting Linux though to respect Windows permissions or vice versa is a tall order – Ramhound Jul 07 '15 at 20:35

1 Answers1

4

Yes you can use tar to create an archive on the ntfs filesystem. tar archives preserve linux owner and permission info.

If you use linux acls and extended attributes look for the options in the tar manpage.

You can also save your ownership and permission info recursivly by getfacl -r folder > permissions.txt.

You can save that file, too and restore with setfacl.

Off topic:

By the way:

NEVER use windows explorer to copy folders to another disk as a backup if you have long directory paths, it cuts away everything with a path longer 255 charakters SILENTLY (i hope i remember the number correctly)

Ntfs can store longer paths just fine and robocopy can copy them but not widows explorer.

I lost a java project that way once ...

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
Uwe Burger
  • 166
  • 1
  • NTFS and ext both have a 255 character limit on filenames https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits Now windows doesn't allow `/` is filenames but that is a different issue. – William Oct 23 '15 at 16:13
  • @William - You don't understand Uwe's comment about the length of the path. They were pointing out a limitation with `Windows Explorer` which has nothing to do with the underline support for NTFS. – Ramhound Oct 23 '15 at 16:49
  • @Uwe [the classic maximum path length on Windows is 260 characters, not 255](https://superuser.com/a/811155/241386). But it'll throw an error for too long path, not cutting it out. In Windows 10 the limit was removed – phuclv Jun 14 '17 at 16:00
  • `setfacl` has a few different options, `--restore` is the one you want for this. – Don Kirkby Jul 10 '23 at 18:12