4

I want to make a backup of my home directory to an NTFS partition (an unfortunate limitation). However, when I last tried using just cp, the attributes (owner, etc) went away. How can I make a backup while still preserving these attributes? My first instinct is to make a tarball, but I'm not sure if this will work.

For reference, I'm running Ubuntu Raring devel.

strugee
  • 14,951

3 Answers3

9

Unfortunately, the NTFS permissions model and the Unix one don't look alike at all. There simply is no way to sanely map between them.

Use tar, but read the documentation carefully so all permissions get faithfully stored (including ACLs and SELinux contexts).

vonbrand
  • 18,253
  • what's an ACL? if I haven't used ACLs or SELinux contexts on purpose, can I assume that I don't have them? if it's relevant, I'm running Ubuntu Raring devel – strugee Apr 23 '13 at 01:21
  • 2
    @strugee ACLs are advanced POSIX Access Control Lists which allow significantly finer control on a per-user basis. As with SELinux, if you don't explicitly activated or used them, you probably don't have to worry them. – Shadur-don't-feed-the-AI Apr 23 '13 at 07:24
2

I find it interesting how nobody ever gives examples and assumes the 'backup using tar' is a helpful enough answer. It isn't, by my standards. Here's how I do it:

ionice -c2 -n5 nice -n9 tar czvf - /media/somelinuxdrivepath | split -b 16m - /media/usb/ntfsmounted/back.tar.gz.

and then to unpack:

ionice -c2 -n5 nice -n9 cat /media/usb/ntfsmounted/back.tar.gz.* | tar xzvf - /media/somenewlinuxpath

I use ionice, nice and split in 16 MB files because the mounted NTFS usb drive is slow and RAM would fill up entirely without it, and/or the linux system would just freeze and crash. Your mileage may vary, depending on your hardware.

Julius
  • 466
1

Just use tar to dump the data and getfacl/setfacl for storing/restoring the ACLs. Even if NTFS supported UNIX permissions you'd have to ensure mapping od user/group IDs and names, which tar does for you automatically (be aware that some - usually rather ancient or non-mainstream - versions of the utility don't store user/group names, only the numerical IDs).

peterph
  • 30,838