5

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.

  • 8
    A tarball will preserve the attributes. Note, if you have ACL(s), tarballs will not preserve that unless it's been compiled to support it. – Wing Tang Wong Apr 22 '13 at 19:08
  • Most recent linux distros and recent versions of tar support ACLs by default, I think... – Shadur Apr 23 '13 at 7:26
8

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).

  • 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 1: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 Apr 23 '13 at 7:24
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).

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.